New submission from Elvis Stansvik:
I noticed the following strange behavior:
estan@newton:~/testdist$ find
.
./testext.c
./setup.cfg
./setup.py
estan@newton:~/testdist$ cat setup.py
from distutils.core import setup, Extension
setup(
name='testdist',
version='1.0.0',
ext_modules = [Extension('testext', ['testext.c'])]
)
estan@newton:~/testdist$ cat setup.cfg
[build_ext]
inplace=1
estan@newton:~/testdist$ ~/cpython/python setup.py install --prefix=~/prefix
--record record.txt
running install
running build
running build_ext
building 'testext' extension
creating build
creating build/temp.linux-x86_64-3.7-pydebug
gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes
-fPIC -I/home/estan/cpython/Include -I/home/estan/cpython -c testext.c -o
build/temp.linux-x86_64-3.7-pydebug/testext.o
gcc -pthread -shared build/temp.linux-x86_64-3.7-pydebug/testext.o -o
/home/estan/testdist/testext.cpython-37dm-x86_64-linux-gnu.so
running install_lib
warning: install_lib: 'build/lib.linux-x86_64-3.7-pydebug' does not exist -- no
Python modules to install
running install_egg_info
Creating /home/estan/prefix/lib/python3.7/site-packages/
Writing
/home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info
writing list of installed files to 'record.txt'
estan@newton:~/testdist$ cat record.txt
/home/estan/prefix/lib/python3.7/site-packages/n-37dm-x86_64-linux-gnu.so
/home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info
estan@newton:~/testdist$ find ~/prefix
/home/estan/prefix
/home/estan/prefix/lib
/home/estan/prefix/lib/python3.7
/home/estan/prefix/lib/python3.7/site-packages
/home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info
estan@newton:~/testdist$
Notice how in the written record.txt, the path to the extension is wrong
("testext.cpytho" is missing), and the extension is not installed.
I did a little digging and found that the reason is install_lib.get_outputs()
returns the wrong result for extensions that are built inplace: It assumes they
are built in the build directory.
The attached patch fixes the problem. The failure of the included test case
without the change to install_lib is:
======================================================================
FAIL: test_get_outputs_inplace_ext
(distutils.tests.test_install_lib.InstallLibTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/estan/cpython/Lib/distutils/tests/test_install_lib.py", line 91,
in test_get_outputs_inplace_ext
self.assertEqual(expected, actual)
AssertionError: Lists differ:
['/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so'] !=
['/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so']
First differing element 0:
'/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so'
'/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so'
- ['/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so']
? --------------
+ ['/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so']
----------------------------------------------------------------------
Notice the missing "foo.cpython-37". With the change to install_lib, the test
passes.
----------
components: Distutils
messages: 285127
nosy: Elvis Stansvik, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils.command.install_lib.get_outputs() wrong with extensions built
inplace
type: behavior
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29225>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com