[Distutils] Not installing the install_requires

Sridhar Ratnakumar sridharr at activestate.com
Thu Jul 16 05:31:09 CEST 2009


 From my experience in building all the pypi packages, I can confirm that a  
significant number of packages (> 10 at least), fail to build[1] because  
it cannot read a file (usually LICENSE.txt, version.txt, README.txt in the  
sdist root) using __file__.

It is unfortunate that we have this mess.

-srid

[1] "python setup.py install --root=installdir/" run using subprocess

On Wed, 15 Jul 2009 08:45:21 -0700, P.J. Eby <pje at telecommunity.com> wrote:

> At 07:43 AM 7/15/2009 -0700, Peter Bengtsson wrote:
>> Crap!
>> That didn't work either!
>> IOError: [Errno 20] Not a directory: '/home/peterbe/virtualenvs/
>> djangopeoplenet/lib/python2.5/site-packages/premailer-1.2-py2.5.egg/
>> premailer/version.txt'
>>
>> This must be because of some egg magic that I don't understand.
>> What I did was this (in premailer.py):
>>
>> __version__ = open(os.path.join(os.path.dirname(__file__),
>> 'version.txt')
>>                    ).read().strip()
>
>
> from pkg_resources import resource_string
> __version__ = resource_string(__name__, 'version.txt').strip()
>
> Make sure that you either list 'version.txt' in your setup() data_files  
> or else use include_package_data=True and a revision control system that  
> includes the version.txt file, or else the version.txt won't be included  
> in your sdists and eggs.
>
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig




More information about the Distutils-SIG mailing list