On Mon, Aug 26, 2013 at 6:36 AM, Hartmut Goebel
<[email protected]> wrote:
> Hi,
>
> I'm one of the developers of www.pyinstaller.org, a tool for creating
> stand-alone executables.
>
> We need to reliable detect if a package is a namespace package (nspkg).
> For each namespace, we need to add an empty fake-module into our
> executable to keep the import mechanism working. This has to work in all
> versions of Python starting with 2.4.
>
> nspkgs set up via a nspkg.pth-file are detected by being in sys.modules,
> but imp.find_module() files.
>
> For nspkgs using __init__.py-files (which use
> pkg_resources.declare_namespace() or pkgutil.extend_path()) I have no
> clue how to detect them.
>
> I tried to query meta-information using pkgresources, but I did not find
> a solution.
>
> Any help?

Setuptools package metadata includes a namespace_packages.txt file
with this information:

   
http://peak.telecommunity.com/DevCenter/EggFormats#namespace-packages-txt-namespace-package-metadata

This won't help you with PEP 420 namespace packages (3.3+), unless
someone declares them, and likewise it won't help if somebody uses the
dynamic APIs without any declaration.  But at least it'll give you the
declared ones.
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to