Subject: [Instant-dev] import_module

From: Anders Logg <[email-masked]>
Date: Thu, 4 Sep 2008 15:33:59 +0200

I get the following error when calling import_module:

  File "/usr/lib/python2.5/site-packages/ffc/jit/jit.py", line 69, in jit
    module = instant.import_module(jit_object)
  File "/usr/lib/python2.5/site-packages/instant/cache.py", line 118, in import_module
    if os.path.isdir(os.path.join(cache_dir, modulename)):
  File "/usr/lib/python2.5/posixpath.py", line 62, in join
    elif path == '' or path.endswith('/'):
  AttributeError: 'NoneType' object has no attribute 'endswith'

Any ideas what goes wrong?

-- 
Anders

---

From: Anders Logg <[email-masked]>
Date: Thu, 4 Sep 2008 15:54:49 +0200

File "/usr/lib/python2.5/site-packages/ffc/jit/jit.py", line 69, in
  jit
    module = instant.import_module(jit_object)
  File "/usr/lib/python2.5/site-packages/instant/cache.py", line 126,
  in import_module
    path, modulename = find_module_location(moduleid, cache_dir)
  File "/usr/lib/python2.5/site-packages/instant/cache.py", line 74,
  in find_module_location
    instant_assert(isinstance(moduleid, str), "In
    instant.find_module_location: Expecting moduleid to be string in
    find_module_location.")
  File "/usr/lib/python2.5/site-packages/instant/output.py", line 53,
  in instant_assert
    raise AssertionError(text)
AssertionError: In instant.find_module_location: Expecting moduleid to
be string in find_module_location.

On Thu, Sep 04, 2008 at 03:41:39PM +0200, Martin Sandve Alnæs wrote:
> Try now.
> 
> 2008/9/4 Anders Logg <[email-masked]>:
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.6 (GNU/Linux)
> >
> > iD8DBQFIv+PHTuwUCDsYZdERAuaeAJ4zme6+WxvGpgE+GhpkrTchKgG//QCdF6gs
> > fcshzAXDjQPTgWnv+tuZecg=
> > =BUGw
> > -----END PGP SIGNATURE-----
> >
> > _______________________________________________
> > Instant-dev mailing list
> > [email-masked]
> > http://fenics.org/mailman/listinfo/instant-dev
> >
> >
> 
> 
>

---

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Thu, 4 Sep 2008 15:59:52 +0200

I know, the in-memory cache isn't quite done. I'll look at it.

-- 
Martin

2008/9/4 Anders Logg <[email-masked]>:
> iD8DBQFIv+ioTuwUCDsYZdERAlLnAJ40V8IJ9MyqVRSO8BgtTfZujV+IVgCffrYc
> LPdbEL7BjryAvP7sgZrl9cw=
> =9ARF

---

From: Anders Logg <[email-masked]>
Date: Thu, 4 Sep 2008 16:20:13 +0200

> I know, the in-memory cache isn't quite done. I'll look at it.

ok.

It's important that this step is fast, so it should be as simple as
possible. Isn't it just a matter of doing

  if object in cache:
    return cache[object]

  signature = object.signature()
  if signature in cache:
    return cache[signature]

  Then look at the disc-cache

-- 
Anders

---

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Thu, 4 Sep 2008 16:26:24 +0200

>  Then look at the disc-cache

Except that object doesn't have .signature if it is a string.

Try now. I don't have any tests for this, we need better test coverage.

-- 
Martin

---

From: Anders Logg <[email-masked]>
Date: Thu, 4 Sep 2008 16:34:41 +0200

> Try now. I don't have any tests for this, we need better test coverage.

Yes, it seems to work now, at least in part. I don't get an error at
least, but I have some more code to write (remove) before I know if it
works.

-- 
Anders

---

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Thu, 4 Sep 2008 16:38:11 +0200

> least, but I have some more code to write (remove) before I know if it

It still isn't added properly to the cache when calling build_module.

-- 
Martin

---

From: Anders Logg <[email-masked]>
Date: Thu, 4 Sep 2008 17:02:11 +0200

ok.

Do you have a good way to get the include directory for ufc.h (which
needs to be sent with the argument additional_declarations)?

FFC does the following:

  (path, dummy, dummy, dummy) =
  instant.header_and_libs_from_pkgconfig("ufc-1")
  if len(path) == 0:
      path = [("/").join(sysconfig.get_python_inc().split("/")[:-2]) + "/include"]
  ufc_include = '%%include "%s/ufc.h"' % path[0]

-- 
Anders

---

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Thu, 4 Sep 2008 18:40:41 +0200

I do about the same. Don't know any better.

2008/9/4 Anders Logg <[email-masked]>:
> iD8DBQFIv/hyTuwUCDsYZdERAnD9AJ9HFIFy7zcy/wztZjEIb4KjJT7EOwCfV1rV
> pswPjnICd+t8udiZGmGtn4E=
> =/LXc

-- 
Martin