New submission from Greg Hazel <gha...@users.sourceforge.net>:

Probably applies to more versions, but I only tested on 2.5.2 and 2.6.5.

Distutils incorrectly constructs paths for the build/temp directory when 
relative paths are used in the "sources" list. This can result in failing to 
make the build/temp directory at all, and placing files in outside of the 
build/temp directory.

Consider the following example:

g...@duma:~$ mkdir libfoo
g...@duma:~$ cd libfoo
g...@duma:~/libfoo$ echo > foo.c
g...@duma:~/libfoo$ mkdir pyfoo
g...@duma:~/libfoo$ cd pyfoo
g...@duma:~/libfoo/pyfoo$ echo "from setuptools import setup, Library; 
setup(name='foo', ext_modules=[Library(name='foo',sources=['../foo.c'])])" > 
setup.py
g...@duma:~/libfoo/pyfoo$ python setup.py build
running build
running build_ext
building 'foo' extension
creating build
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c ../foo.c -o 
build/temp.linux-i686-2.5/../foo.o
Assembler messages:
Fatal error: can't create build/temp.linux-i686-2.5/../foo.o: No such file or 
directory
error: command 'gcc' failed with exit status 1


Using os.path.abspath('../foo.c') in the sources causes distutils to create 
build/temp.linux-i686-2.5/home/gah/libfoo/foo.o which is fine. However as a 
user, this situation is quite surprising, since distutils is responsible for 
managing the build and temp directories itself.

----------
assignee: tarek
components: Distutils
messages: 108085
nosy: ghazel, tarek
priority: normal
severity: normal
status: open
title: distutils relative path errors
type: behavior
versions: Python 2.5, Python 2.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9023>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to