Am 12.09.2014 21:24, schrieb Eric V. Smith:
[Oops, replying to the list this time. Sorry for the dupe, Thomas.]

On 9/12/2014 3:14 PM, Thomas Heller wrote:
So it seems that it is a bug in setuptools:  It must not create or
install these pth files when installing in Python 3.3 or newer (which
implement PEP 420).

PEP 420 goes out of its way to support pkgutil.extend_path():
http://legacy.python.org/dev/peps/pep-0420/#migrating-from-legacy-namespace-packages

So it should be possible for some cross-version code to work.

My point is that the source code for zope.interface (for example) has
the magic code in the zope/__init__.py file, right beneath the
zope/interface/ directory:

"""
try:
    import pkg_resources
    pkg_resources.declare_namespace(__name__)
except ImportError:
    import pkgutil
    __path__ = pkgutil.extend_path(__path__, __name__)
"""

IMO this is to support the legacy way.
See:
https://github.com/zopefoundation/zope.interface/blob/master/src/zope/__init__.py

However, when installing it in Python 3.4, this __init__.py file is NOT installed. Instead, the 'zope' directory ONLY contains the 'interface' subdirectory with all the code. But a .pth file is installed that does
the strange things that I mentioned in the original post.

Thomas

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to