Issue 8577: test_distutils fails if srcdir != builddir (original) (raw)

Created on 2010-04-30 10:40 by ronaldoussoren, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue8577.patch ronaldoussoren,2010-04-30 11:51
Messages (19)
msg104616 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-30 10:40
When I build the trunk with srcdir != builddir test_distutils fails when running tests. To reproduce: * Create a checkout of the trunk and chdir into this * mkdir build * cd build * ../configure * make test This results in a failure for test_distutils
msg104620 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-04-30 11:14
distutils.sysconfig.get_python_inc() uses "os.path.dirname(os.path.abspath(sys.executable))" to find the srcdir. I'll change it to "sysconfig.get_config_var('srcdir')"
msg104622 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-04-30 11:22
Mmm, the problem is that srcdir is given by the Makefile. So I need to find the Makefile. I don't know how to get these info from a python built in another directory. Investigating...
msg104623 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-30 11:27
get_config_var('srcdir') should work, with should then be combined with the path to the Makefile, something like: os.path.join( os.path.dirname(os.path.abspath( _get_makefile_filename(), get_config_var('srcdir'))) The path.join is necessary because srcdir is most likely a relative path (in my example the value is 'srcdir')
msg104626 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-04-30 11:45
Ah, found a way: buildir = os.path.dirname(sys.executable) srcdir = os.path.abspath(os.path.join(buildir, get_config_var('srcdir')))
msg104627 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-30 11:50
It does work just fine, see the attached patch.
msg104628 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-30 11:51
Actually attaching the patch might help. With this patch test_distutils passes, without it it doesn't.
msg104629 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-04-30 11:54
Yes it's pretty similar to what I've done in my earlier message. No need to call os.path.dirname(get_makefile_filename()), os.path.dirname(sys.executable) is enough. I guess the patch part concerning unixcompiler is unrelated to this issue, right ?
msg104630 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-30 11:57
Yes, sorry about that. The patch in unixcompiler is for issue #7724.
msg104632 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-04-30 12:33
Fixed in r80649, r80650 I'll merge in the py3k branch once I've reverted distutils there
msg105428 - (view) Author: Roumen Petrov (rpetrov) * Date: 2010-05-10 11:23
Hmm, this issue was fixed before. My be restore of 2.6 distutils ignore those fixes. It is good to compare current Lib/distutils/sysconfig.py with version from Dec 2009 .
msg105429 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-05-10 11:29
I intend to forward port the fix to 3.2 in the near future, to avoid missing real issues when I do updates to the platform support for OSX.
msg107878 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-15 16:06
I've fixed this issue for the 3.2 branch in r81999.
msg107880 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-06-15 16:45
Looks like this just broke the 3.x buildbots. ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/cpython-ucs2/3.x.pitrou-ubuntu/build/Lib/distutils/tests/support.py", line 16, in _capture_warnings return func(*args, **kw) File "/home/buildbot/cpython-ucs2/3.x.pitrou-ubuntu/build/Lib/distutils/tests/test_sysconfig.py", line 47, in test_get_python_inc self.assertTrue(os.path.isdir(inc_dir), inc_dir) AssertionError: Include ====================================================================== FAIL: test_user_site (distutils.tests.test_install.InstallTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/cpython-ucs2/3.x.pitrou-ubuntu/build/Lib/distutils/tests/test_install.py", line 100, in test_user_site self._test_user_site() File "/home/buildbot/cpython-ucs2/3.x.pitrou-ubuntu/build/Lib/distutils/tests/test_install.py", line 129, in _test_user_site self.assertTrue(os.path.exists(self.user_base)) AssertionError: False is not True
msg107884 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-15 17:16
Sigh. test.test_distutils behaves different when run through regrtest than when run directly. I have a fix, but am running an extended test cycle before committing (that is, both with and without srcdir==builddir)
msg107896 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-15 21:20
This should be fixed in r82005, this passes all tests both with and without srcdir==builddir
msg107897 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-06-15 21:27
As I said earlier, I am going to revert Distutils state in py3k so it's like the 3.1 branch. So the changes in distutils/ in py3k that are not backported in 3.1 will be lost. I had a lack of time lately, but I should be able to do it this week.
msg107908 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-16 05:58
Tarek: I'm not 100% that all my changes in Lib/distutils were backported to 3.1. This last patch definitely wasn't, but isn't also isn't relevant for 3.1.
msg108788 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-27 12:58
As r82005 fixed the problem this issue can be closed.
History
Date User Action Args
2022-04-11 14:57:00 admin set github: 52823
2010-06-27 12:58:31 ronaldoussoren set status: open -> closednosy: + nobodymessages: + assignee: ronaldoussoren -> nobody
2010-06-16 05:58:03 ronaldoussoren set messages: +
2010-06-15 21:27:37 tarek set messages: +
2010-06-15 21:20:25 ronaldoussoren set messages: +
2010-06-15 17:16:44 ronaldoussoren set messages: +
2010-06-15 16:45:15 pitrou set status: closed -> opennosy: + pitrouversions: - Python 2.6, Python 3.1, Python 2.7, Python 3.3messages: + assignee: tarek -> ronaldoussoren
2010-06-15 16:06:14 ronaldoussoren set status: open -> closedresolution: fixedmessages: +
2010-05-10 11:29:09 ronaldoussoren set messages: +
2010-05-10 11:23:46 rpetrov set nosy: + rpetrovmessages: +
2010-04-30 12:33:25 tarek set messages: +
2010-04-30 12:11:43 tarek set versions: + Python 2.6, Python 3.1, Python 3.2, Python 3.3
2010-04-30 11:57:06 ronaldoussoren set messages: +
2010-04-30 11:54:40 tarek set messages: +
2010-04-30 11:51:27 ronaldoussoren set files: + issue8577.patchkeywords: + patchmessages: +
2010-04-30 11:50:37 ronaldoussoren set messages: +
2010-04-30 11:49:53 tarek set messages: -
2010-04-30 11:45:30 tarek set messages: +
2010-04-30 11:34:16 tarek set messages: +
2010-04-30 11:27:56 ronaldoussoren set messages: +
2010-04-30 11:22:29 tarek set messages: +
2010-04-30 11:14:44 tarek set messages: +
2010-04-30 10:40:02 ronaldoussoren create