mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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.
This commit is contained in:
parent
3eb67d58d6
commit
58f27b203c
3 changed files with 19 additions and 2 deletions
|
@ -22,6 +22,11 @@ from test.support import run_unittest
|
||||||
ALREADY_TESTED = False
|
ALREADY_TESTED = False
|
||||||
|
|
||||||
def _get_source_filename():
|
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
|
||||||
|
# otherwise try using copy from build directory
|
||||||
srcdir = sysconfig.get_config_var('srcdir')
|
srcdir = sysconfig.get_config_var('srcdir')
|
||||||
return os.path.join(srcdir, 'Modules', 'xxmodule.c')
|
return os.path.join(srcdir, 'Modules', 'xxmodule.c')
|
||||||
|
|
||||||
|
@ -35,7 +40,9 @@ class BuildExtTestCase(TempdirManager,
|
||||||
self.tmp_dir = self.mkdtemp()
|
self.tmp_dir = self.mkdtemp()
|
||||||
self.sys_path = sys.path, sys.path[:]
|
self.sys_path = sys.path, sys.path[:]
|
||||||
sys.path.append(self.tmp_dir)
|
sys.path.append(self.tmp_dir)
|
||||||
shutil.copy(_get_source_filename(), self.tmp_dir)
|
filename = _get_source_filename()
|
||||||
|
if os.path.exists(filename):
|
||||||
|
shutil.copy(filename, self.tmp_dir)
|
||||||
if sys.version > "2.6":
|
if sys.version > "2.6":
|
||||||
import site
|
import site
|
||||||
self.old_user_base = site.USER_BASE
|
self.old_user_base = site.USER_BASE
|
||||||
|
@ -65,6 +72,8 @@ class BuildExtTestCase(TempdirManager,
|
||||||
def test_build_ext(self):
|
def test_build_ext(self):
|
||||||
global ALREADY_TESTED
|
global ALREADY_TESTED
|
||||||
xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
|
xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
|
||||||
|
if not os.path.exists(xx_c):
|
||||||
|
return
|
||||||
xx_ext = Extension('xx', [xx_c])
|
xx_ext = Extension('xx', [xx_c])
|
||||||
dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
|
dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
|
||||||
dist.package_dir = self.tmp_dir
|
dist.package_dir = self.tmp_dir
|
||||||
|
|
|
@ -928,7 +928,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
|
||||||
multiprocessing multiprocessing/dummy \
|
multiprocessing multiprocessing/dummy \
|
||||||
unittest unittest/test \
|
unittest unittest/test \
|
||||||
curses pydoc_data $(MACHDEPS)
|
curses pydoc_data $(MACHDEPS)
|
||||||
libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
|
libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
|
||||||
@for i in $(SCRIPTDIR) $(LIBDEST); \
|
@for i in $(SCRIPTDIR) $(LIBDEST); \
|
||||||
do \
|
do \
|
||||||
if test ! -d $(DESTDIR)$$i; then \
|
if test ! -d $(DESTDIR)$$i; then \
|
||||||
|
@ -984,6 +984,10 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
|
||||||
done; \
|
done; \
|
||||||
done
|
done
|
||||||
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
|
||||||
|
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
|
||||||
|
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
|
||||||
|
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
|
||||||
|
fi
|
||||||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
||||||
./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
|
./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
|
||||||
-d $(LIBDEST) -f \
|
-d $(LIBDEST) -f \
|
||||||
|
|
|
@ -111,6 +111,10 @@ Build
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
||||||
- Issue #8746: Add additional tests for os.chflags() and os.lchflags().
|
- Issue #8746: Add additional tests for os.chflags() and os.lchflags().
|
||||||
Patch by Garrett Cooper.
|
Patch by Garrett Cooper.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue