Here's my file layout:

<root> /
       |- setup.py
       |
       |- enum /
               |- __init__.py
               |
               |- py2_enum.py
               |
               |- py3_enum.py
               |
               |- test /
                       |- test_enum.py
                       |
                       |- py2_test_enum.py
                       |
                       |- py3_test_enum.py

__init__ and test_enum are both smart enough to pull in the correct code when 
imported.  The issue I am having is this:

--8<--------------------------------------------------------------
ethan@hydra:~$ sudo easy_install enum34
[sudo] password for ethan:
Searching for enum34
Reading http://pypi.python.org/simple/enum34/
Best match: enum34 0.9
Downloading 
http://pypi.python.org/packages/source/e/enum34/enum34-0.9.zip#md5=4717b8c328083d816b3b987f24446ad8
Processing enum34-0.9.zip
Writing /tmp/easy_install-sB55B5/enum34-0.9/setup.cfg
Running enum34-0.9/setup.py -q bdist_egg --dist-dir 
/tmp/easy_install-sB55B5/enum34-0.9/egg-dist-tmp-qUYAv5
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/enum/py3_enum.py', 211, 43, ' def __call__(cls, value, names=None, *, module=None, type=None):\n'))

SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/enum/test/py3_test_enum.py', 630, 47, ' class AutoNumberedEnum(Enum, metaclass=auto_enum):\n'))

zip_safe flag not set; analyzing archive contents...
SyntaxError: ('invalid syntax', ('/usr/local/lib/python2.7/dist-packages/enum34-0.9-py2.7.egg/enum/py3_enum.py', 211, 43, ' def __call__(cls, value, names=None, *, module=None, type=None):\n'))

SyntaxError: ('invalid syntax', ('/usr/local/lib/python2.7/dist-packages/enum34-0.9-py2.7.egg/enum/test/py3_test_enum.py', 630, 47, ' class AutoNumberedEnum(Enum, metaclass=auto_enum):\n'))

Adding enum34 0.9 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/enum34-0.9-py2.7.egg
Processing dependencies for enum34
Finished processing dependencies for enum34
--8<--------------------------------------------------------------

distutils is trying to load the py3 versions, which of course fails on a py2 install. The package installs successfully anyway, but if I were a user I would be wondering if the install was trustworthy.

It seems to me that I need to either have distutils only install the version appropriate files, or to not try to scan the version inappropriate files, but at this point I do not know how to do either.

Any pointers would be greatly appreciated.

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

Reply via email to