cpython: de226a510b52 (original) (raw)
Mercurial > cpython
changeset 71034:de226a510b52 3.2
Issue #12141: Install a copy of template C module file so that test_build_ext of test_distutils is no longer silently skipped when run outside of a build directory. [#12141]
Ned Deily nad@acm.org | |
---|---|
date | Tue, 28 Jun 2011 00:42:50 -0700 |
parents | 529e26aa4fa3 |
children | ef8e9e99de88 ecf17d9b0212 bb89023191a0 |
files | Lib/distutils/tests/test_build_ext.py Makefile.pre.in Misc/NEWS |
diffstat | 3 files changed, 19 insertions(+), 2 deletions(-)[+] [-] Lib/distutils/tests/test_build_ext.py 11 Makefile.pre.in 6 Misc/NEWS 4 |
line wrap: on
line diff
--- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -22,6 +22,11 @@ from test.support import run_unittest ALREADY_TESTED = False def _get_source_filename():
use installed copy if available
- tests_f = os.path.join(os.path.dirname(file), 'xxmodule.c')
- if os.path.exists(tests_f):
return tests_f[](#l1.10)
srcdir = sysconfig.get_config_var('srcdir') otherwise try using copy from build directory return os.path.join(srcdir, 'Modules', 'xxmodule.c') @@ -35,7 +40,9 @@ class BuildExtTestCase(TempdirManager, self.tmp_dir = self.mkdtemp() self.sys_path = sys.path, sys.path[:] sys.path.append(self.tmp_dir)
shutil.copy(_get_source_filename(), self.tmp_dir)[](#l1.19)
filename = _get_source_filename()[](#l1.20)
if os.path.exists(filename):[](#l1.21)
shutil.copy(filename, self.tmp_dir)[](#l1.22) if sys.version > "2.6":[](#l1.23) import site[](#l1.24) self.old_user_base = site.USER_BASE[](#l1.25)
@@ -65,6 +72,8 @@ class BuildExtTestCase(TempdirManager, def test_build_ext(self): global ALREADY_TESTED xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
if not os.path.exists(xx_c):[](#l1.30)
return[](#l1.31) xx_ext = Extension('xx', [xx_c])[](#l1.32) dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})[](#l1.33) dist.package_dir = self.tmp_dir[](#l1.34)
--- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -928,7 +928,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter multiprocessing multiprocessing/dummy [](#l2.4) unittest unittest/test [](#l2.5) curses pydoc_data $(MACHDEPS) -libinstall: build_all (srcdir)/Lib/(srcdir)/Lib/(srcdir)/Lib/(PLATDIR) +libinstall: build_all (srcdir)/Lib/(srcdir)/Lib/(srcdir)/Lib/(PLATDIR) $(srcdir)/Modules/xxmodule.c @for i in (SCRIPTDIR)(SCRIPTDIR) (SCRIPTDIR)(LIBDEST); [](#l2.9) do [](#l2.10) if test ! -d (DESTDIR)(DESTDIR)(DESTDIR)$i; then [](#l2.11) @@ -984,6 +984,10 @@ libinstall: build_all (srcdir)/Lib/(srcdir)/Lib/(srcdir)/Lib/(PL done; [](#l2.13) done (INSTALLDATA)(INSTALL_DATA) (INSTALLDATA)(srcdir)/LICENSE (DESTDIR)(DESTDIR)(DESTDIR)(LIBDEST)/LICENSE.txt + if test -d (DESTDIR)(DESTDIR)(DESTDIR)(LIBDEST)/distutils/tests; then [](#l2.16) + (INSTALLDATA)(INSTALL_DATA) (INSTALLDATA)(srcdir)/Modules/xxmodule.c [](#l2.17) + (DESTDIR)(DESTDIR)(DESTDIR)(LIBDEST)/distutils/tests ; [](#l2.18) + fi -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) [](#l2.20) ./$(BUILDPYTHON) -Wi (DESTDIR)(DESTDIR)(DESTDIR)(LIBDEST)/compileall.py [](#l2.21) -d $(LIBDEST) -f [](#l2.22)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -111,6 +111,10 @@ Build Tests ----- +- Issue #12141: Install a copy of template C module file so that