[Distutils] Installing a file into sitepackages

Stuart Axon stuaxo2 at yahoo.com
Tue Mar 10 17:29:07 CET 2015


I had more of a dig into this, with a minimal setup.py:


https://gist.github.com/stuaxo/c76a042cb7aa6e77285b

setup calls install_data

On win32 setup.py calls install_data which copies the file into the egg - even though I have given the absolute path to sitepackages


C:\> python setup.py install
....

running install_data
creating build\bdist.win32\egg
copying TEST_FILE.TXT -> build\bdist.win32\egg\ 
....



On Linux the file is copied to the right path:


$ python setup.py install
.....

installing package data to build/bdist.linux-x86_64/egg
running install_data
copying TEST_FILE.TXT -> /mnt/data/home/stu/.virtualenvs/tmpv/lib/python2.7/site-packages
....



*something* is normalising my absolute path to site packages into just '' - it's possible to see by looking at self.data_files in the 'run' function in:


distutils/command/install_data.py

-  on windows it the first part has been changed to '' unlike on linux where it's the absolute path I set... still not sure where it's happening though.



*This all took a while, as rebuilt VM and verified on 2.7.8 and 2.7.9..

S++




> On Monday, March 9, 2015 12:17 AM, Stuart Axon <stuaxo2 at yahoo.com> wrote:
> > I had a further look - and on windows the file ends up inside the .egg file, on 
> linux it ends up inside the site packages as intended.
> 
> 
> At a guess it seems like there might be a bug in the path handling on windows. 
> .. I wonder if it's something like this
> 
> http://stackoverflow.com/questions/4579908/cross-platform-splitting-of-path-in-python
> 
> which seems an easy way to get an off-by-one error in a path ?
> 


More information about the Distutils-SIG mailing list