This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_disutils fails
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: nas, ronaldoussoren, spatz
Priority: high Keywords: patch

Created on 2008-06-06 21:34 by ronaldoussoren, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_build_ext.patch spatz, 2008-06-07 13:50
get_python_inc.patch nas, 2008-06-20 00:53
Messages (6)
msg67785 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2008-06-06 21:34
test_distutils fails when you're not building in the root of the source 
tree.

That is:

  mkdir build
  cd build
  ../configure
  make
  make check

This fails like this:

test test_distutils failed -- Traceback (most recent call last):
  File "/Users/ronald/Projects/python/python-
trunk/Lib/distutils/tests/test_build_ext.py", line 23, in setUp
    shutil.copy(xx_c, self.tmp_dir)
  File "/Users/ronald/Projects/python/python-trunk/Lib/shutil.py", line 
82, in copy
    copyfile(src, dst)
  File "/Users/ronald/Projects/python/python-trunk/Lib/shutil.py", line 
46, in copyfile
    fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory: 
'/Users/ronald/Projects/python/python-trunk/build104/Modules/xxmodule.c'
msg67807 - (view) Author: Dror Levin (spatz) Date: 2008-06-07 13:50
This also happens in py3k.
Attached a patch that fixes this by using the dirname of
sysconfig.project_base if the file is not found, but perhaps a better
solution could be found...
msg68423 - (view) Author: Neil Schemenauer (nas) Date: 2008-06-19 20:36
Looks like this has exposed some ugly code.  From setup.py:

  # Figure out the location of the source code for extension modules
  # (This logic is copied in distutils.test.test_sysconfig,
  # so building in a separate directory does not break test_distutils.)

I believe the proper fix is to move some of the code from setup.py into
sysconfig so that it does more than just set "python_build" when running
inside a Python build directory.  For example, it should also add
<srcdir>/Include to the standard list of includes that distutils uses.

The attached patch fixes test_build_ext.py to use the right source file
(perhaps it should be tested on Windows).  The test still fails because
Python.h cannot be found.
msg68430 - (view) Author: Neil Schemenauer (nas) Date: 2008-06-20 00:00
I think my previous patch combined with sysconfig_builddir.patch fixes
this issue.  Someone will need to test on other platforms.  Note that
the messy code in setup.py and in the tests should still be cleaned up.

BTW, distutils is a den of stinking evil. ;-)
msg68436 - (view) Author: Neil Schemenauer (nas) Date: 2008-06-20 00:53
One final patch for today (get_python_inc.patch).  The patch combines my
previous two patches and also cleans up some ugly code in setup.py and
test_sysconfig.py.  The source of the ugliness was that get_python_inc()
did not work when running from within a build directory.  The patch also 
fixes the header dependency feature introduced in svn r60287 (it assumed
that builddir == srcdir and also that os.path.sep == '/').
msg96888 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-12-26 13:18
This issue is fixed in the 2.7 and 3.2 trees.

I'm therefore closing this issue.
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47304
2009-12-26 13:18:12ronaldoussorensetstatus: open -> closed
resolution: fixed
messages: + msg96888

stage: resolved
2008-06-20 00:54:27nassetfiles: - sysconfig_builddir.patch
2008-06-20 00:54:22nassetfiles: - test_ext_src.patch
2008-06-20 00:54:00nassetfiles: + get_python_inc.patch
messages: + msg68436
2008-06-20 00:00:27nassetfiles: + sysconfig_builddir.patch
messages: + msg68430
2008-06-19 20:36:30nassetfiles: + test_ext_src.patch
nosy: + nas
messages: + msg68423
2008-06-07 13:50:59spatzsetfiles: + test_build_ext.patch
keywords: + patch
messages: + msg67807
nosy: + spatz
versions: + Python 3.0
2008-06-06 21:39:51ronaldoussorensettype: behavior
components: + Tests, - Distutils
2008-06-06 21:34:17ronaldoussorencreate