[Distutils] complicated setup

Donald Stufft donald at stufft.io
Wed Jun 26 22:23:08 CEST 2013


On Jun 26, 2013, at 4:21 PM, Erik Bray <erik.m.bray at gmail.com> wrote:

> On Sun, Jun 16, 2013 at 3:13 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
>> 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 at 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.
> 
> That's odd.  I work on a package that ships Python 2 and Python 3
> versions of some modules and I have never seen this problem before.
> Perhaps you could post your setup.py?
> 
> Erik
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig

If I recall this is because it's trying to compile byte code.

-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130626/b0c621df/attachment.pgp>


More information about the Distutils-SIG mailing list