Gordons installer or imputil problem?

Gordon McMillan gmcm at hypernet.com
Thu Aug 5 16:49:52 EDT 1999


Thomas Heller wrote:

> I tried out your installer (the new beta) and am really impressed.
> IMHO the best part is parsing the binary files (dlls, pyds) for
> dependecies.
> 
> I noticed a strange problem however, and I do not know where to look
> for the solution.

[import package.mod vs from package import mod]
 
> The only difference between a.py and b.py is that in the first case
>  'import package.mod' is executed before 'from package import mod',
> while in the other case the order is different. Since I'm working
> with packages a lot, and normally use 'from package import module' I
> would stronly prefer to find a solution other than rewriting all the
> import statements.

OK, just tested imputil on a .pyz built with a package= option. No 
problem using "from package import mod".

Just poked around with modulefinder - no problem there.

AHA! It's the way the zlib gets built. When you specify a package, 
the TOC has an entry for "package.__init__" and "package.mod", as it 
should. But when it's built from chasing dependencies, it has an 
entry for "package" and "package.mod", so imputil thinks "package" is 
a module...

Hack hack hack...

archivebuilder line 139 to end of function:

  for (k, v) in mf.modules.items():
    ispkg = os.path.basename(v.__file__) == '__init__.py'
    d = os.path.dirname(v.__file__)
    if not d:
      v.__file__ = os.path.join(os.getcwd(), v.__file__)
    if ispkg:
        rslt.append(k+'.__init__', v.__file__)
    else:
        rslt.append(k, v.__file__)
  return rslt

or-wait-for-the-next-rev-of-the-beta-ly y'rs

- Gordon




More information about the Python-list mailing list