diff options
| -rw-r--r-- | distutils/README (renamed from README) | 0 | ||||
| -rw-r--r-- | distutils/__init__.py (renamed from __init__.py) | 0 | ||||
| -rw-r--r-- | distutils/_msvccompiler.py (renamed from _msvccompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/archive_util.py (renamed from archive_util.py) | 0 | ||||
| -rw-r--r-- | distutils/bcppcompiler.py (renamed from bcppcompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/ccompiler.py (renamed from ccompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/cmd.py (renamed from cmd.py) | 0 | ||||
| -rw-r--r-- | distutils/command/__init__.py (renamed from command/__init__.py) | 0 | ||||
| -rw-r--r-- | distutils/command/bdist.py (renamed from command/bdist.py) | 0 | ||||
| -rw-r--r-- | distutils/command/bdist_dumb.py (renamed from command/bdist_dumb.py) | 0 | ||||
| -rw-r--r-- | distutils/command/bdist_msi.py (renamed from command/bdist_msi.py) | 0 | ||||
| -rw-r--r-- | distutils/command/bdist_rpm.py (renamed from command/bdist_rpm.py) | 0 | ||||
| -rw-r--r-- | distutils/command/bdist_wininst.py (renamed from command/bdist_wininst.py) | 0 | ||||
| -rw-r--r-- | distutils/command/build.py (renamed from command/build.py) | 0 | ||||
| -rw-r--r-- | distutils/command/build_clib.py (renamed from command/build_clib.py) | 0 | ||||
| -rw-r--r-- | distutils/command/build_ext.py (renamed from command/build_ext.py) | 0 | ||||
| -rw-r--r-- | distutils/command/build_py.py (renamed from command/build_py.py) | 0 | ||||
| -rw-r--r-- | distutils/command/build_scripts.py (renamed from command/build_scripts.py) | 0 | ||||
| -rw-r--r-- | distutils/command/check.py (renamed from command/check.py) | 0 | ||||
| -rw-r--r-- | distutils/command/clean.py (renamed from command/clean.py) | 0 | ||||
| -rw-r--r-- | distutils/command/command_template (renamed from command/command_template) | 0 | ||||
| -rw-r--r-- | distutils/command/config.py (renamed from command/config.py) | 0 | ||||
| -rw-r--r-- | distutils/command/install.py (renamed from command/install.py) | 22 | ||||
| -rw-r--r-- | distutils/command/install_data.py (renamed from command/install_data.py) | 0 | ||||
| -rw-r--r-- | distutils/command/install_egg_info.py (renamed from command/install_egg_info.py) | 0 | ||||
| -rw-r--r-- | distutils/command/install_headers.py (renamed from command/install_headers.py) | 0 | ||||
| -rw-r--r-- | distutils/command/install_lib.py (renamed from command/install_lib.py) | 0 | ||||
| -rw-r--r-- | distutils/command/install_scripts.py (renamed from command/install_scripts.py) | 0 | ||||
| -rw-r--r-- | distutils/command/register.py (renamed from command/register.py) | 0 | ||||
| -rw-r--r-- | distutils/command/sdist.py (renamed from command/sdist.py) | 0 | ||||
| -rw-r--r-- | distutils/command/upload.py (renamed from command/upload.py) | 0 | ||||
| -rw-r--r-- | distutils/command/wininst-10.0-amd64.exe (renamed from command/wininst-10.0-amd64.exe) | bin | 222208 -> 222208 bytes | |||
| -rw-r--r-- | distutils/command/wininst-10.0.exe (renamed from command/wininst-10.0.exe) | bin | 190976 -> 190976 bytes | |||
| -rw-r--r-- | distutils/command/wininst-14.0-amd64.exe (renamed from command/wininst-14.0-amd64.exe) | bin | 587776 -> 587776 bytes | |||
| -rw-r--r-- | distutils/command/wininst-14.0.exe (renamed from command/wininst-14.0.exe) | bin | 458240 -> 458240 bytes | |||
| -rw-r--r-- | distutils/command/wininst-6.0.exe (renamed from command/wininst-6.0.exe) | bin | 61440 -> 61440 bytes | |||
| -rw-r--r-- | distutils/command/wininst-7.1.exe (renamed from command/wininst-7.1.exe) | bin | 65536 -> 65536 bytes | |||
| -rw-r--r-- | distutils/command/wininst-8.0.exe (renamed from command/wininst-8.0.exe) | bin | 61440 -> 61440 bytes | |||
| -rw-r--r-- | distutils/command/wininst-9.0-amd64.exe (renamed from command/wininst-9.0-amd64.exe) | bin | 224256 -> 224256 bytes | |||
| -rw-r--r-- | distutils/command/wininst-9.0.exe (renamed from command/wininst-9.0.exe) | bin | 196096 -> 196096 bytes | |||
| -rw-r--r-- | distutils/config.py (renamed from config.py) | 0 | ||||
| -rw-r--r-- | distutils/core.py (renamed from core.py) | 0 | ||||
| -rw-r--r-- | distutils/cygwinccompiler.py (renamed from cygwinccompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/debug.py (renamed from debug.py) | 0 | ||||
| -rw-r--r-- | distutils/dep_util.py (renamed from dep_util.py) | 0 | ||||
| -rw-r--r-- | distutils/dir_util.py (renamed from dir_util.py) | 0 | ||||
| -rw-r--r-- | distutils/dist.py (renamed from dist.py) | 3 | ||||
| -rw-r--r-- | distutils/errors.py (renamed from errors.py) | 0 | ||||
| -rw-r--r-- | distutils/extension.py (renamed from extension.py) | 0 | ||||
| -rw-r--r-- | distutils/fancy_getopt.py (renamed from fancy_getopt.py) | 0 | ||||
| -rw-r--r-- | distutils/file_util.py (renamed from file_util.py) | 0 | ||||
| -rw-r--r-- | distutils/filelist.py (renamed from filelist.py) | 0 | ||||
| -rw-r--r-- | distutils/log.py (renamed from log.py) | 0 | ||||
| -rw-r--r-- | distutils/msvc9compiler.py (renamed from msvc9compiler.py) | 0 | ||||
| -rw-r--r-- | distutils/msvccompiler.py (renamed from msvccompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/spawn.py (renamed from spawn.py) | 0 | ||||
| -rw-r--r-- | distutils/sysconfig.py (renamed from sysconfig.py) | 94 | ||||
| -rw-r--r-- | distutils/tests/Setup.sample (renamed from tests/Setup.sample) | 0 | ||||
| -rw-r--r-- | distutils/tests/__init__.py (renamed from tests/__init__.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/includetest.rst (renamed from tests/includetest.rst) | 0 | ||||
| -rw-r--r-- | distutils/tests/py35compat.py | 77 | ||||
| -rw-r--r-- | distutils/tests/py38compat.py | 50 | ||||
| -rw-r--r-- | distutils/tests/support.py (renamed from tests/support.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/test_archive_util.py (renamed from tests/test_archive_util.py) | 5 | ||||
| -rw-r--r-- | distutils/tests/test_bdist.py (renamed from tests/test_bdist.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_bdist_dumb.py (renamed from tests/test_bdist_dumb.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_bdist_msi.py (renamed from tests/test_bdist_msi.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/test_bdist_rpm.py (renamed from tests/test_bdist_rpm.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_bdist_wininst.py (renamed from tests/test_bdist_wininst.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/test_build.py (renamed from tests/test_build.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_build_clib.py (renamed from tests/test_build_clib.py) | 4 | ||||
| -rw-r--r-- | distutils/tests/test_build_ext.py (renamed from tests/test_build_ext.py) | 6 | ||||
| -rw-r--r-- | distutils/tests/test_build_py.py (renamed from tests/test_build_py.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_build_scripts.py (renamed from tests/test_build_scripts.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_check.py (renamed from tests/test_check.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_clean.py (renamed from tests/test_clean.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_cmd.py (renamed from tests/test_cmd.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_config.py (renamed from tests/test_config.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_config_cmd.py (renamed from tests/test_config_cmd.py) | 4 | ||||
| -rw-r--r-- | distutils/tests/test_core.py (renamed from tests/test_core.py) | 2 | ||||
| -rw-r--r-- | distutils/tests/test_cygwinccompiler.py (renamed from tests/test_cygwinccompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_dep_util.py (renamed from tests/test_dep_util.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_dir_util.py (renamed from tests/test_dir_util.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_dist.py (renamed from tests/test_dist.py) | 6 | ||||
| -rw-r--r-- | distutils/tests/test_extension.py (renamed from tests/test_extension.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/test_file_util.py (renamed from tests/test_file_util.py) | 2 | ||||
| -rw-r--r-- | distutils/tests/test_filelist.py (renamed from tests/test_filelist.py) | 7 | ||||
| -rw-r--r-- | distutils/tests/test_install.py (renamed from tests/test_install.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/test_install_data.py (renamed from tests/test_install_data.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_install_headers.py (renamed from tests/test_install_headers.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_install_lib.py (renamed from tests/test_install_lib.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_install_scripts.py (renamed from tests/test_install_scripts.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_log.py (renamed from tests/test_log.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_msvc9compiler.py (renamed from tests/test_msvc9compiler.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_msvccompiler.py (renamed from tests/test_msvccompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_register.py (renamed from tests/test_register.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/test_sdist.py (renamed from tests/test_sdist.py) | 3 | ||||
| -rw-r--r-- | distutils/tests/test_spawn.py (renamed from tests/test_spawn.py) | 6 | ||||
| -rw-r--r-- | distutils/tests/test_sysconfig.py (renamed from tests/test_sysconfig.py) | 6 | ||||
| -rw-r--r-- | distutils/tests/test_text_file.py (renamed from tests/test_text_file.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_unixccompiler.py (renamed from tests/test_unixccompiler.py) | 17 | ||||
| -rw-r--r-- | distutils/tests/test_upload.py (renamed from tests/test_upload.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_util.py (renamed from tests/test_util.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_version.py (renamed from tests/test_version.py) | 0 | ||||
| -rw-r--r-- | distutils/tests/test_versionpredicate.py (renamed from tests/test_versionpredicate.py) | 0 | ||||
| -rw-r--r-- | distutils/text_file.py (renamed from text_file.py) | 0 | ||||
| -rw-r--r-- | distutils/unixccompiler.py (renamed from unixccompiler.py) | 0 | ||||
| -rw-r--r-- | distutils/util.py (renamed from util.py) | 0 | ||||
| -rw-r--r-- | distutils/version.py (renamed from version.py) | 0 | ||||
| -rw-r--r-- | distutils/versionpredicate.py (renamed from versionpredicate.py) | 0 | ||||
| -rw-r--r-- | pytest.ini | 4 | ||||
| -rw-r--r-- | tox.ini | 8 |
112 files changed, 282 insertions, 65 deletions
diff --git a/README b/distutils/README index 23f48850..23f48850 100644 --- a/README +++ b/distutils/README diff --git a/__init__.py b/distutils/__init__.py index d823d040..d823d040 100644 --- a/__init__.py +++ b/distutils/__init__.py diff --git a/_msvccompiler.py b/distutils/_msvccompiler.py index af8099a4..af8099a4 100644 --- a/_msvccompiler.py +++ b/distutils/_msvccompiler.py diff --git a/archive_util.py b/distutils/archive_util.py index 565a3117..565a3117 100644 --- a/archive_util.py +++ b/distutils/archive_util.py diff --git a/bcppcompiler.py b/distutils/bcppcompiler.py index 071fea5d..071fea5d 100644 --- a/bcppcompiler.py +++ b/distutils/bcppcompiler.py diff --git a/ccompiler.py b/distutils/ccompiler.py index b5ef143e..b5ef143e 100644 --- a/ccompiler.py +++ b/distutils/ccompiler.py diff --git a/cmd.py b/distutils/cmd.py index dba3191e..dba3191e 100644 --- a/cmd.py +++ b/distutils/cmd.py diff --git a/command/__init__.py b/distutils/command/__init__.py index 481eea9f..481eea9f 100644 --- a/command/__init__.py +++ b/distutils/command/__init__.py diff --git a/command/bdist.py b/distutils/command/bdist.py index 014871d2..014871d2 100644 --- a/command/bdist.py +++ b/distutils/command/bdist.py diff --git a/command/bdist_dumb.py b/distutils/command/bdist_dumb.py index f0d6b5b8..f0d6b5b8 100644 --- a/command/bdist_dumb.py +++ b/distutils/command/bdist_dumb.py diff --git a/command/bdist_msi.py b/distutils/command/bdist_msi.py index 0863a188..0863a188 100644 --- a/command/bdist_msi.py +++ b/distutils/command/bdist_msi.py diff --git a/command/bdist_rpm.py b/distutils/command/bdist_rpm.py index 550cbfa1..550cbfa1 100644 --- a/command/bdist_rpm.py +++ b/distutils/command/bdist_rpm.py diff --git a/command/bdist_wininst.py b/distutils/command/bdist_wininst.py index 0e9ddaa2..0e9ddaa2 100644 --- a/command/bdist_wininst.py +++ b/distutils/command/bdist_wininst.py diff --git a/command/build.py b/distutils/command/build.py index a86df0bc..a86df0bc 100644 --- a/command/build.py +++ b/distutils/command/build.py diff --git a/command/build_clib.py b/distutils/command/build_clib.py index 3e20ef23..3e20ef23 100644 --- a/command/build_clib.py +++ b/distutils/command/build_clib.py diff --git a/command/build_ext.py b/distutils/command/build_ext.py index 1a9bd120..1a9bd120 100644 --- a/command/build_ext.py +++ b/distutils/command/build_ext.py diff --git a/command/build_py.py b/distutils/command/build_py.py index edc2171c..edc2171c 100644 --- a/command/build_py.py +++ b/distutils/command/build_py.py diff --git a/command/build_scripts.py b/distutils/command/build_scripts.py index ccc70e64..ccc70e64 100644 --- a/command/build_scripts.py +++ b/distutils/command/build_scripts.py diff --git a/command/check.py b/distutils/command/check.py index ada25006..ada25006 100644 --- a/command/check.py +++ b/distutils/command/check.py diff --git a/command/clean.py b/distutils/command/clean.py index 0cb27016..0cb27016 100644 --- a/command/clean.py +++ b/distutils/command/clean.py diff --git a/command/command_template b/distutils/command/command_template index 6106819d..6106819d 100644 --- a/command/command_template +++ b/distutils/command/command_template diff --git a/command/config.py b/distutils/command/config.py index aeda408e..aeda408e 100644 --- a/command/config.py +++ b/distutils/command/config.py diff --git a/command/install.py b/distutils/command/install.py index aaa300ef..13feeb89 100644 --- a/command/install.py +++ b/distutils/command/install.py @@ -43,6 +43,20 @@ INSTALL_SCHEMES = { 'data' : '$base', }, 'nt': WINDOWS_SCHEME, + 'pypy': { + 'purelib': '$base/site-packages', + 'platlib': '$base/site-packages', + 'headers': '$base/include/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', + }, + 'pypy_nt': { + 'purelib': '$base/site-packages', + 'platlib': '$base/site-packages', + 'headers': '$base/include/$dist_name', + 'scripts': '$base/Scripts', + 'data' : '$base', + }, } # user site schemes @@ -298,7 +312,7 @@ class install(Command): 'sys_exec_prefix': exec_prefix, 'exec_prefix': exec_prefix, 'abiflags': abiflags, - 'platlibdir': sys.platlibdir, + 'platlibdir': getattr(sys, 'platlibdir', 'lib'), } if HAS_USER_SITE: @@ -455,6 +469,12 @@ class install(Command): def select_scheme(self, name): """Sets the install directories by applying the install schemes.""" # it's the caller's problem if they supply a bad name! + if (hasattr(sys, 'pypy_version_info') and + not name.endswith(('_user', '_home'))): + if os.name == 'nt': + name = 'pypy_nt' + else: + name = 'pypy' scheme = INSTALL_SCHEMES[name] for key in SCHEME_KEYS: attrname = 'install_' + key diff --git a/command/install_data.py b/distutils/command/install_data.py index 947cd76a..947cd76a 100644 --- a/command/install_data.py +++ b/distutils/command/install_data.py diff --git a/command/install_egg_info.py b/distutils/command/install_egg_info.py index 0ddc7367..0ddc7367 100644 --- a/command/install_egg_info.py +++ b/distutils/command/install_egg_info.py diff --git a/command/install_headers.py b/distutils/command/install_headers.py index 9bb0b18d..9bb0b18d 100644 --- a/command/install_headers.py +++ b/distutils/command/install_headers.py diff --git a/command/install_lib.py b/distutils/command/install_lib.py index 6154cf09..6154cf09 100644 --- a/command/install_lib.py +++ b/distutils/command/install_lib.py diff --git a/command/install_scripts.py b/distutils/command/install_scripts.py index 31a1130e..31a1130e 100644 --- a/command/install_scripts.py +++ b/distutils/command/install_scripts.py diff --git a/command/register.py b/distutils/command/register.py index 0fac94e9..0fac94e9 100644 --- a/command/register.py +++ b/distutils/command/register.py diff --git a/command/sdist.py b/distutils/command/sdist.py index b4996fcb..b4996fcb 100644 --- a/command/sdist.py +++ b/distutils/command/sdist.py diff --git a/command/upload.py b/distutils/command/upload.py index 95e9fda1..95e9fda1 100644 --- a/command/upload.py +++ b/distutils/command/upload.py diff --git a/command/wininst-10.0-amd64.exe b/distutils/command/wininst-10.0-amd64.exe Binary files differindex 6fa0dce1..6fa0dce1 100644 --- a/command/wininst-10.0-amd64.exe +++ b/distutils/command/wininst-10.0-amd64.exe diff --git a/command/wininst-10.0.exe b/distutils/command/wininst-10.0.exe Binary files differindex afc3bc6c..afc3bc6c 100644 --- a/command/wininst-10.0.exe +++ b/distutils/command/wininst-10.0.exe diff --git a/command/wininst-14.0-amd64.exe b/distutils/command/wininst-14.0-amd64.exe Binary files differindex 253c2e2e..253c2e2e 100644 --- a/command/wininst-14.0-amd64.exe +++ b/distutils/command/wininst-14.0-amd64.exe diff --git a/command/wininst-14.0.exe b/distutils/command/wininst-14.0.exe Binary files differindex 46f5f356..46f5f356 100644 --- a/command/wininst-14.0.exe +++ b/distutils/command/wininst-14.0.exe diff --git a/command/wininst-6.0.exe b/distutils/command/wininst-6.0.exe Binary files differindex f57c855a..f57c855a 100644 --- a/command/wininst-6.0.exe +++ b/distutils/command/wininst-6.0.exe diff --git a/command/wininst-7.1.exe b/distutils/command/wininst-7.1.exe Binary files differindex 1433bc1a..1433bc1a 100644 --- a/command/wininst-7.1.exe +++ b/distutils/command/wininst-7.1.exe diff --git a/command/wininst-8.0.exe b/distutils/command/wininst-8.0.exe Binary files differindex 7403bfab..7403bfab 100644 --- a/command/wininst-8.0.exe +++ b/distutils/command/wininst-8.0.exe diff --git a/command/wininst-9.0-amd64.exe b/distutils/command/wininst-9.0-amd64.exe Binary files differindex 94fbd434..94fbd434 100644 --- a/command/wininst-9.0-amd64.exe +++ b/distutils/command/wininst-9.0-amd64.exe diff --git a/command/wininst-9.0.exe b/distutils/command/wininst-9.0.exe Binary files differindex 2ec261f9..2ec261f9 100644 --- a/command/wininst-9.0.exe +++ b/distutils/command/wininst-9.0.exe diff --git a/config.py b/distutils/config.py index 2171abd6..2171abd6 100644 --- a/config.py +++ b/distutils/config.py diff --git a/core.py b/distutils/core.py index d603d4a4..d603d4a4 100644 --- a/core.py +++ b/distutils/core.py diff --git a/cygwinccompiler.py b/distutils/cygwinccompiler.py index 66c12dd3..66c12dd3 100644 --- a/cygwinccompiler.py +++ b/distutils/cygwinccompiler.py diff --git a/debug.py b/distutils/debug.py index daf1660f..daf1660f 100644 --- a/debug.py +++ b/distutils/debug.py diff --git a/dep_util.py b/distutils/dep_util.py index d74f5e4e..d74f5e4e 100644 --- a/dep_util.py +++ b/distutils/dep_util.py diff --git a/dir_util.py b/distutils/dir_util.py index d5cd8e3e..d5cd8e3e 100644 --- a/dir_util.py +++ b/distutils/dir_util.py diff --git a/dist.py b/distutils/dist.py index 6cf0a0d6..37db4d6c 100644 --- a/dist.py +++ b/distutils/dist.py @@ -35,7 +35,8 @@ def _ensure_list(value, fieldname): elif not isinstance(value, list): # passing a tuple or an iterator perhaps, warn and convert typename = type(value).__name__ - msg = f"Warning: '{fieldname}' should be a list, got type '{typename}'" + msg = "Warning: '{fieldname}' should be a list, got type '{typename}'" + msg = msg.format(**locals()) log.log(log.WARN, msg) value = list(value) return value diff --git a/errors.py b/distutils/errors.py index 8b93059e..8b93059e 100644 --- a/errors.py +++ b/distutils/errors.py diff --git a/extension.py b/distutils/extension.py index c507da36..c507da36 100644 --- a/extension.py +++ b/distutils/extension.py diff --git a/fancy_getopt.py b/distutils/fancy_getopt.py index 7d170dd2..7d170dd2 100644 --- a/fancy_getopt.py +++ b/distutils/fancy_getopt.py diff --git a/file_util.py b/distutils/file_util.py index b3fee35a..b3fee35a 100644 --- a/file_util.py +++ b/distutils/file_util.py diff --git a/filelist.py b/distutils/filelist.py index c92d5fdb..c92d5fdb 100644 --- a/filelist.py +++ b/distutils/filelist.py diff --git a/log.py b/distutils/log.py index 8ef6b28e..8ef6b28e 100644 --- a/log.py +++ b/distutils/log.py diff --git a/msvc9compiler.py b/distutils/msvc9compiler.py index 6934e964..6934e964 100644 --- a/msvc9compiler.py +++ b/distutils/msvc9compiler.py diff --git a/msvccompiler.py b/distutils/msvccompiler.py index d5857cb1..d5857cb1 100644 --- a/msvccompiler.py +++ b/distutils/msvccompiler.py diff --git a/spawn.py b/distutils/spawn.py index 0d1bd039..0d1bd039 100644 --- a/spawn.py +++ b/distutils/spawn.py diff --git a/sysconfig.py b/distutils/sysconfig.py index 37feae5d..879b6981 100644 --- a/sysconfig.py +++ b/distutils/sysconfig.py @@ -16,6 +16,8 @@ import sys from .errors import DistutilsPlatformError +IS_PYPY = '__pypy__' in sys.builtin_module_names + # These are needed in a couple of spots, so just compute them once. PREFIX = os.path.normpath(sys.prefix) EXEC_PREFIX = os.path.normpath(sys.exec_prefix) @@ -97,7 +99,9 @@ def get_python_inc(plat_specific=0, prefix=None): """ if prefix is None: prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX - if os.name == "posix": + if IS_PYPY: + return os.path.join(prefix, 'include') + elif os.name == "posix": if python_build: # Assume the executable is in the build directory. The # pyconfig.h file should be in the same directory. Since @@ -138,6 +142,14 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'. """ + if IS_PYPY: + # PyPy-specific schema + if prefix is None: + prefix = PREFIX + if standard_lib: + return os.path.join(prefix, "lib-python", sys.version[0]) + return os.path.join(prefix, 'site-packages') + if prefix is None: if standard_lib: prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX @@ -148,7 +160,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): if plat_specific or standard_lib: # Platform-specific modules (any module from a non-pure-Python # module distribution) or standard Python library modules. - libdir = sys.platlibdir + libdir = getattr(sys, "platlibdir", "lib") else: # Pure Python libdir = "lib" @@ -444,7 +456,12 @@ def _init_posix(): platform=sys.platform, multiarch=getattr(sys.implementation, '_multiarch', ''), )) - _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) + try: + _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) + except ImportError: + # Python 3.5 and pypy 7.3.1 + _temp = __import__( + '_sysconfigdata', globals(), locals(), ['build_time_vars'], 0) build_time_vars = _temp.build_time_vars global _config_vars _config_vars = {} @@ -494,41 +511,42 @@ def get_config_vars(*args): _config_vars['prefix'] = PREFIX _config_vars['exec_prefix'] = EXEC_PREFIX - # For backward compatibility, see issue19555 - SO = _config_vars.get('EXT_SUFFIX') - if SO is not None: - _config_vars['SO'] = SO - - # Always convert srcdir to an absolute path - srcdir = _config_vars.get('srcdir', project_base) - if os.name == 'posix': - if python_build: - # If srcdir is a relative path (typically '.' or '..') - # then it should be interpreted relative to the directory - # containing Makefile. - base = os.path.dirname(get_makefile_filename()) - srcdir = os.path.join(base, srcdir) - else: - # srcdir is not meaningful since the installation is - # spread about the filesystem. We choose the - # directory containing the Makefile since we know it - # exists. - srcdir = os.path.dirname(get_makefile_filename()) - _config_vars['srcdir'] = os.path.abspath(os.path.normpath(srcdir)) - - # Convert srcdir into an absolute path if it appears necessary. - # Normally it is relative to the build directory. However, during - # testing, for example, we might be running a non-installed python - # from a different directory. - if python_build and os.name == "posix": - base = project_base - if (not os.path.isabs(_config_vars['srcdir']) and - base != os.getcwd()): - # srcdir is relative and we are not in the same directory - # as the executable. Assume executable is in the build - # directory and make srcdir absolute. - srcdir = os.path.join(base, _config_vars['srcdir']) - _config_vars['srcdir'] = os.path.normpath(srcdir) + if not IS_PYPY: + # For backward compatibility, see issue19555 + SO = _config_vars.get('EXT_SUFFIX') + if SO is not None: + _config_vars['SO'] = SO + + # Always convert srcdir to an absolute path + srcdir = _config_vars.get('srcdir', project_base) + if os.name == 'posix': + if python_build: + # If srcdir is a relative path (typically '.' or '..') + # then it should be interpreted relative to the directory + # containing Makefile. + base = os.path.dirname(get_makefile_filename()) + srcdir = os.path.join(base, srcdir) + else: + # srcdir is not meaningful since the installation is + # spread about the filesystem. We choose the + # directory containing the Makefile since we know it + # exists. + srcdir = os.path.dirname(get_makefile_filename()) + _config_vars['srcdir'] = os.path.abspath(os.path.normpath(srcdir)) + + # Convert srcdir into an absolute path if it appears necessary. + # Normally it is relative to the build directory. However, during + # testing, for example, we might be running a non-installed python + # from a different directory. + if python_build and os.name == "posix": + base = project_base + if (not os.path.isabs(_config_vars['srcdir']) and + base != os.getcwd()): + # srcdir is relative and we are not in the same directory + # as the executable. Assume executable is in the build + # directory and make srcdir absolute. + srcdir = os.path.join(base, _config_vars['srcdir']) + _config_vars['srcdir'] = os.path.normpath(srcdir) # OS X platforms require special customization to handle # multi-architecture, multi-os-version installers diff --git a/tests/Setup.sample b/distutils/tests/Setup.sample index 36c4290d..36c4290d 100644 --- a/tests/Setup.sample +++ b/distutils/tests/Setup.sample diff --git a/tests/__init__.py b/distutils/tests/__init__.py index 16d011fd..c7dcc7ec 100644 --- a/tests/__init__.py +++ b/distutils/tests/__init__.py @@ -16,7 +16,8 @@ import os import sys import unittest from test.support import run_unittest -from test.support.warnings_helper import save_restore_warnings_filters + +from .py38compat import save_restore_warnings_filters here = os.path.dirname(__file__) or os.curdir diff --git a/tests/includetest.rst b/distutils/tests/includetest.rst index d7b4ae38..d7b4ae38 100644 --- a/tests/includetest.rst +++ b/distutils/tests/includetest.rst diff --git a/distutils/tests/py35compat.py b/distutils/tests/py35compat.py new file mode 100644 index 00000000..0c755261 --- /dev/null +++ b/distutils/tests/py35compat.py @@ -0,0 +1,77 @@ +""" +Backward compatibility support for Python 3.5 +""" + +import sys +import test.support +import subprocess + + +# copied from Python 3.9 test.support module +def _missing_compiler_executable(cmd_names=[]): + """Check if the compiler components used to build the interpreter exist. + + Check for the existence of the compiler executables whose names are listed + in 'cmd_names' or all the compiler executables when 'cmd_names' is empty + and return the first missing executable or None when none is found + missing. + + """ + from distutils import ccompiler, sysconfig, spawn + compiler = ccompiler.new_compiler() + sysconfig.customize_compiler(compiler) + for name in compiler.executables: + if cmd_names and name not in cmd_names: + continue + cmd = getattr(compiler, name) + if cmd_names: + assert cmd is not None, \ + "the '%s' executable is not configured" % name + elif not cmd: + continue + if spawn.find_executable(cmd[0]) is None: + return cmd[0] + + +missing_compiler_executable = vars(test.support).setdefault( + 'missing_compiler_executable', + _missing_compiler_executable, +) + + +try: + from test.support import unix_shell +except ImportError: + # Adapted from Python 3.9 test.support module + is_android = hasattr(sys, 'getandroidapilevel') + unix_shell = ( + None if sys.platform == 'win32' else + '/system/bin/sh' if is_android else + '/bin/sh' + ) + + +# copied from Python 3.9 subprocess module +def _optim_args_from_interpreter_flags(): + """Return a list of command-line arguments reproducing the current + optimization settings in sys.flags.""" + args = [] + value = sys.flags.optimize + if value > 0: + args.append('-' + 'O' * value) + return args + + +vars(subprocess).setdefault( + '_optim_args_from_interpreter_flags', + _optim_args_from_interpreter_flags, +) + + +def adapt_glob(regex): + """ + Supply legacy expectation on Python 3.5 + """ + if sys.version_info > (3, 6): + return regex + return regex.replace('(?s:', '').replace(r')\Z', r'\Z(?ms)') diff --git a/distutils/tests/py38compat.py b/distutils/tests/py38compat.py new file mode 100644 index 00000000..46ff5758 --- /dev/null +++ b/distutils/tests/py38compat.py @@ -0,0 +1,50 @@ +# flake8: noqa + +import contextlib + +try: + from test.support.warnings_helper import check_warnings +except (ModuleNotFoundError, ImportError): + from test.support import check_warnings + + +try: + from test.support.os_helper import ( + change_cwd, + rmtree, + EnvironmentVarGuard, + TESTFN, + unlink, + skip_unless_symlink, + temp_dir, + create_empty_file, + temp_cwd, + ) +except (ModuleNotFoundError, ImportError): + from test.support import ( + change_cwd, + rmtree, + EnvironmentVarGuard, + TESTFN, + unlink, + skip_unless_symlink, + temp_dir, + create_empty_file, + temp_cwd, + ) + + +# From Python 3.9 +@contextlib.contextmanager +def _save_restore_warnings_filters(): + old_filters = warnings.filters[:] + try: + yield + finally: + warnings.filters[:] = old_filters + + +try: + from test.support.warnings_helper import save_restore_warnings_filters +except (ModuleNotFoundError, ImportError): + save_restore_warnings_filters = _save_restore_warnings_filters diff --git a/tests/support.py b/distutils/tests/support.py index 23b907b6..b4410fc9 100644 --- a/tests/support.py +++ b/distutils/tests/support.py @@ -6,7 +6,8 @@ import tempfile import unittest import sysconfig from copy import deepcopy -from test.support import os_helper + +from . import py38compat as os_helper from distutils import log from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL diff --git a/tests/test_archive_util.py b/distutils/tests/test_archive_util.py index edcec251..ce6456dc 100644 --- a/tests/test_archive_util.py +++ b/distutils/tests/test_archive_util.py @@ -14,8 +14,9 @@ from distutils.archive_util import (check_archive_formats, make_tarball, from distutils.spawn import find_executable, spawn from distutils.tests import support from test.support import run_unittest, patch -from test.support.os_helper import change_cwd -from test.support.warnings_helper import check_warnings + +from .py38compat import change_cwd +from .py38compat import check_warnings try: import grp diff --git a/tests/test_bdist.py b/distutils/tests/test_bdist.py index 130d8bf1..130d8bf1 100644 --- a/tests/test_bdist.py +++ b/distutils/tests/test_bdist.py diff --git a/tests/test_bdist_dumb.py b/distutils/tests/test_bdist_dumb.py index 01a233bc..01a233bc 100644 --- a/tests/test_bdist_dumb.py +++ b/distutils/tests/test_bdist_dumb.py diff --git a/tests/test_bdist_msi.py b/distutils/tests/test_bdist_msi.py index a61266a1..937266f8 100644 --- a/tests/test_bdist_msi.py +++ b/distutils/tests/test_bdist_msi.py @@ -2,9 +2,10 @@ import sys import unittest from test.support import run_unittest -from test.support.warnings_helper import check_warnings from distutils.tests import support +from .py38compat import check_warnings + @unittest.skipUnless(sys.platform == 'win32', 'these tests require Windows') class BDistMSITestCase(support.TempdirManager, diff --git a/tests/test_bdist_rpm.py b/distutils/tests/test_bdist_rpm.py index 6453a02b..6453a02b 100644 --- a/tests/test_bdist_rpm.py +++ b/distutils/tests/test_bdist_rpm.py diff --git a/tests/test_bdist_wininst.py b/distutils/tests/test_bdist_wininst.py index c338069a..31cf2628 100644 --- a/tests/test_bdist_wininst.py +++ b/distutils/tests/test_bdist_wininst.py @@ -3,7 +3,8 @@ import sys import platform import unittest from test.support import run_unittest -from test.support.warnings_helper import check_warnings + +from .py38compat import check_warnings from distutils.command.bdist_wininst import bdist_wininst from distutils.tests import support diff --git a/tests/test_build.py b/distutils/tests/test_build.py index b020a5ba..b020a5ba 100644 --- a/tests/test_build.py +++ b/distutils/tests/test_build.py diff --git a/tests/test_build_clib.py b/distutils/tests/test_build_clib.py index abd83137..259c4352 100644 --- a/tests/test_build_clib.py +++ b/distutils/tests/test_build_clib.py @@ -3,7 +3,9 @@ import unittest import os import sys -from test.support import run_unittest, missing_compiler_executable +from test.support import run_unittest + +from .py35compat import missing_compiler_executable from distutils.command.build_clib import build_clib from distutils.errors import DistutilsSetupError diff --git a/tests/test_build_ext.py b/distutils/tests/test_build_ext.py index f9e0d766..5a72458c 100644 --- a/tests/test_build_ext.py +++ b/distutils/tests/test_build_ext.py @@ -15,7 +15,7 @@ from distutils.errors import ( import unittest from test import support -from test.support import os_helper +from . import py38compat as os_helper from test.support.script_helper import assert_python_ok # http://bugs.python.org/issue4373 @@ -83,7 +83,7 @@ class BuildExtTestCase(TempdirManager, else: ALREADY_TESTED = type(self).__name__ - code = textwrap.dedent(f""" + code = textwrap.dedent(""" tmp_dir = {self.tmp_dir!r} import sys @@ -109,7 +109,7 @@ class BuildExtTestCase(TempdirManager, unittest.main() - """) + """.format(**locals())) assert_python_ok('-c', code) def test_solaris_enable_shared(self): diff --git a/tests/test_build_py.py b/distutils/tests/test_build_py.py index 0712e92c..0712e92c 100644 --- a/tests/test_build_py.py +++ b/distutils/tests/test_build_py.py diff --git a/tests/test_build_scripts.py b/distutils/tests/test_build_scripts.py index 954fc763..954fc763 100644 --- a/tests/test_build_scripts.py +++ b/distutils/tests/test_build_scripts.py diff --git a/tests/test_check.py b/distutils/tests/test_check.py index e534aca1..e534aca1 100644 --- a/tests/test_check.py +++ b/distutils/tests/test_check.py diff --git a/tests/test_clean.py b/distutils/tests/test_clean.py index c605afd8..c605afd8 100644 --- a/tests/test_clean.py +++ b/distutils/tests/test_clean.py diff --git a/tests/test_cmd.py b/distutils/tests/test_cmd.py index cf5197c3..cf5197c3 100644 --- a/tests/test_cmd.py +++ b/distutils/tests/test_cmd.py diff --git a/tests/test_config.py b/distutils/tests/test_config.py index 344084af..344084af 100644 --- a/tests/test_config.py +++ b/distutils/tests/test_config.py diff --git a/tests/test_config_cmd.py b/distutils/tests/test_config_cmd.py index 9aeab07b..4cd9a6b9 100644 --- a/tests/test_config_cmd.py +++ b/distutils/tests/test_config_cmd.py @@ -2,7 +2,9 @@ import unittest import os import sys -from test.support import run_unittest, missing_compiler_executable +from test.support import run_unittest + +from .py35compat import missing_compiler_executable from distutils.command.config import dump_file, config from distutils.tests import support diff --git a/tests/test_core.py b/distutils/tests/test_core.py index 4e6694a3..666ff4a3 100644 --- a/tests/test_core.py +++ b/distutils/tests/test_core.py @@ -6,7 +6,7 @@ import os import shutil import sys from test.support import captured_stdout, run_unittest -from test.support import os_helper +from . import py38compat as os_helper import unittest from distutils.tests import support from distutils import log diff --git a/tests/test_cygwinccompiler.py b/distutils/tests/test_cygwinccompiler.py index 9dc869de..9dc869de 100644 --- a/tests/test_cygwinccompiler.py +++ b/distutils/tests/test_cygwinccompiler.py diff --git a/tests/test_dep_util.py b/distutils/tests/test_dep_util.py index c6fae39c..c6fae39c 100644 --- a/tests/test_dep_util.py +++ b/distutils/tests/test_dep_util.py diff --git a/tests/test_dir_util.py b/distutils/tests/test_dir_util.py index d436cf83..d436cf83 100644 --- a/tests/test_dir_util.py +++ b/distutils/tests/test_dir_util.py diff --git a/tests/test_dist.py b/distutils/tests/test_dist.py index f8a9e86b..45eadee8 100644 --- a/tests/test_dist.py +++ b/distutils/tests/test_dist.py @@ -14,7 +14,7 @@ from distutils.cmd import Command from test.support import ( captured_stdout, captured_stderr, run_unittest ) -from test.support.os_helper import TESTFN +from .py38compat import TESTFN from distutils.tests import support from distutils import log @@ -84,6 +84,10 @@ class DistributionTestCase(support.LoggingSilencer, self.assertIsInstance(cmd, test_dist) self.assertEqual(cmd.sample_option, "sometext") + @unittest.skipIf( + 'distutils' not in Distribution.parse_config_files.__module__, + 'Cannot test when virtualenv has monkey-patched Distribution.', + ) def test_venv_install_options(self): sys.argv.append("install") self.addCleanup(os.unlink, TESTFN) diff --git a/tests/test_extension.py b/distutils/tests/test_extension.py index 81fad02d..2eb5b422 100644 --- a/tests/test_extension.py +++ b/distutils/tests/test_extension.py @@ -4,9 +4,10 @@ import os import warnings from test.support import run_unittest -from test.support.warnings_helper import check_warnings from distutils.extension import read_setup_file, Extension +from .py38compat import check_warnings + class ExtensionTestCase(unittest.TestCase): def test_read_setup_file(self): diff --git a/tests/test_file_util.py b/distutils/tests/test_file_util.py index c7783b85..d2536075 100644 --- a/tests/test_file_util.py +++ b/distutils/tests/test_file_util.py @@ -9,7 +9,7 @@ from distutils import log from distutils.tests import support from distutils.errors import DistutilsFileError from test.support import run_unittest -from test.support.os_helper import unlink +from .py38compat import unlink class FileUtilTestCase(support.TempdirManager, unittest.TestCase): diff --git a/tests/test_filelist.py b/distutils/tests/test_filelist.py index cee97d43..d8e4b39f 100644 --- a/tests/test_filelist.py +++ b/distutils/tests/test_filelist.py @@ -8,10 +8,13 @@ from distutils.errors import DistutilsTemplateError from distutils.filelist import glob_to_re, translate_pattern, FileList from distutils import filelist -from test.support import os_helper from test.support import captured_stdout, run_unittest from distutils.tests import support +from .py35compat import adapt_glob +from . import py38compat as os_helper + + MANIFEST_IN = """\ include ok include xo @@ -60,7 +63,7 @@ class FileListTestCase(support.LoggingSilencer, ('foo????', r'(?s:foo[^%(sep)s][^%(sep)s][^%(sep)s][^%(sep)s])\Z'), (r'foo\\??', r'(?s:foo\\\\[^%(sep)s][^%(sep)s])\Z')): regex = regex % {'sep': sep} - self.assertEqual(glob_to_re(glob), regex) + self.assertEqual(glob_to_re(glob), adapt_glob(regex)) def test_process_template_line(self): # testing all MANIFEST.in template patterns diff --git a/tests/test_install.py b/distutils/tests/test_install.py index 51c80e04..eb684a09 100644 --- a/tests/test_install.py +++ b/distutils/tests/test_install.py @@ -58,7 +58,8 @@ class InstallTestCase(support.TempdirManager, libdir = os.path.join(destination, "lib", "python") check_path(cmd.install_lib, libdir) - platlibdir = os.path.join(destination, sys.platlibdir, "python") + _platlibdir = getattr(sys, "platlibdir", "lib") + platlibdir = os.path.join(destination, _platlibdir, "python") check_path(cmd.install_platlib, platlibdir) check_path(cmd.install_purelib, libdir) check_path(cmd.install_headers, diff --git a/tests/test_install_data.py b/distutils/tests/test_install_data.py index 32ab296a..32ab296a 100644 --- a/tests/test_install_data.py +++ b/distutils/tests/test_install_data.py diff --git a/tests/test_install_headers.py b/distutils/tests/test_install_headers.py index 2217b321..2217b321 100644 --- a/tests/test_install_headers.py +++ b/distutils/tests/test_install_headers.py diff --git a/tests/test_install_lib.py b/distutils/tests/test_install_lib.py index fda6315b..fda6315b 100644 --- a/tests/test_install_lib.py +++ b/distutils/tests/test_install_lib.py diff --git a/tests/test_install_scripts.py b/distutils/tests/test_install_scripts.py index 1f7b1038..1f7b1038 100644 --- a/tests/test_install_scripts.py +++ b/distutils/tests/test_install_scripts.py diff --git a/tests/test_log.py b/distutils/tests/test_log.py index 75cf9006..75cf9006 100644 --- a/tests/test_log.py +++ b/distutils/tests/test_log.py diff --git a/tests/test_msvc9compiler.py b/distutils/tests/test_msvc9compiler.py index 77a07ef3..77a07ef3 100644 --- a/tests/test_msvc9compiler.py +++ b/distutils/tests/test_msvc9compiler.py diff --git a/tests/test_msvccompiler.py b/distutils/tests/test_msvccompiler.py index b518d6a7..b518d6a7 100644 --- a/tests/test_msvccompiler.py +++ b/distutils/tests/test_msvccompiler.py diff --git a/tests/test_register.py b/distutils/tests/test_register.py index bba48633..84607f99 100644 --- a/tests/test_register.py +++ b/distutils/tests/test_register.py @@ -6,7 +6,8 @@ import urllib import warnings from test.support import run_unittest -from test.support.warnings_helper import check_warnings + +from .py38compat import check_warnings from distutils.command import register as register_module from distutils.command.register import register diff --git a/tests/test_sdist.py b/distutils/tests/test_sdist.py index 752e9db5..b087a817 100644 --- a/tests/test_sdist.py +++ b/distutils/tests/test_sdist.py @@ -7,7 +7,8 @@ import zipfile from os.path import join from textwrap import dedent from test.support import captured_stdout, run_unittest -from test.support.warnings_helper import check_warnings + +from .py38compat import check_warnings try: import zlib diff --git a/tests/test_spawn.py b/distutils/tests/test_spawn.py index 4ec767b1..f620da78 100644 --- a/tests/test_spawn.py +++ b/distutils/tests/test_spawn.py @@ -3,8 +3,10 @@ import os import stat import sys import unittest.mock -from test.support import run_unittest, unix_shell -from test.support import os_helper +from test.support import run_unittest + +from .py35compat import unix_shell +from . import py38compat as os_helper from distutils.spawn import find_executable from distutils.spawn import spawn diff --git a/tests/test_sysconfig.py b/distutils/tests/test_sysconfig.py index 59676b0e..c7571942 100644 --- a/tests/test_sysconfig.py +++ b/distutils/tests/test_sysconfig.py @@ -11,8 +11,9 @@ from distutils import sysconfig from distutils.ccompiler import get_default_compiler from distutils.tests import support from test.support import run_unittest, swap_item -from test.support.os_helper import TESTFN -from test.support.warnings_helper import check_warnings + +from .py38compat import TESTFN +from .py38compat import check_warnings class SysconfigTestCase(support.EnvironGuard, unittest.TestCase): @@ -48,6 +49,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase): self.assertIsInstance(cvars, dict) self.assertTrue(cvars) + @unittest.skip('sysconfig.IS_PYPY') def test_srcdir(self): # See Issues #15322, #15364. srcdir = sysconfig.get_config_var('srcdir') diff --git a/tests/test_text_file.py b/distutils/tests/test_text_file.py index 7e76240a..7e76240a 100644 --- a/tests/test_text_file.py +++ b/distutils/tests/test_text_file.py diff --git a/tests/test_unixccompiler.py b/distutils/tests/test_unixccompiler.py index eefe4ba4..1828ba1a 100644 --- a/tests/test_unixccompiler.py +++ b/distutils/tests/test_unixccompiler.py @@ -2,7 +2,8 @@ import sys import unittest from test.support import run_unittest -from test.support.os_helper import EnvironmentVarGuard + +from .py38compat import EnvironmentVarGuard from distutils import sysconfig from distutils.unixccompiler import UnixCCompiler @@ -12,6 +13,7 @@ class UnixCCompilerTestCase(unittest.TestCase): def setUp(self): self._backup_platform = sys.platform self._backup_get_config_var = sysconfig.get_config_var + self._backup_get_config_vars = sysconfig.get_config_vars class CompilerWrapper(UnixCCompiler): def rpath_foo(self): return self.runtime_library_dir_option('/foo') @@ -20,6 +22,7 @@ class UnixCCompilerTestCase(unittest.TestCase): def tearDown(self): sys.platform = self._backup_platform sysconfig.get_config_var = self._backup_get_config_var + sysconfig.get_config_vars = self._backup_get_config_vars @unittest.skipIf(sys.platform == 'win32', "can't test on Windows") def test_runtime_libdir_option(self): @@ -111,7 +114,13 @@ class UnixCCompilerTestCase(unittest.TestCase): if v == 'LDSHARED': return 'gcc-4.2 -bundle -undefined dynamic_lookup ' return 'gcc-4.2' + + def gcvs(*args, _orig=sysconfig.get_config_vars): + if args: + return list(map(sysconfig.get_config_var, args)) + return _orig() sysconfig.get_config_var = gcv + sysconfig.get_config_vars = gcvs with EnvironmentVarGuard() as env: env['CC'] = 'my_cc' del env['LDSHARED'] @@ -127,7 +136,13 @@ class UnixCCompilerTestCase(unittest.TestCase): if v == 'LDSHARED': return 'gcc-4.2 -bundle -undefined dynamic_lookup ' return 'gcc-4.2' + + def gcvs(*args, _orig=sysconfig.get_config_vars): + if args: + return list(map(sysconfig.get_config_var, args)) + return _orig() sysconfig.get_config_var = gcv + sysconfig.get_config_vars = gcvs with EnvironmentVarGuard() as env: env['CC'] = 'my_cc' env['LDSHARED'] = 'my_ld -bundle -dynamic' diff --git a/tests/test_upload.py b/distutils/tests/test_upload.py index bca5516d..bca5516d 100644 --- a/tests/test_upload.py +++ b/distutils/tests/test_upload.py diff --git a/tests/test_util.py b/distutils/tests/test_util.py index bf0d4333..bf0d4333 100644 --- a/tests/test_util.py +++ b/distutils/tests/test_util.py diff --git a/tests/test_version.py b/distutils/tests/test_version.py index 8671cd2f..8671cd2f 100644 --- a/tests/test_version.py +++ b/distutils/tests/test_version.py diff --git a/tests/test_versionpredicate.py b/distutils/tests/test_versionpredicate.py index 28ae09dc..28ae09dc 100644 --- a/tests/test_versionpredicate.py +++ b/distutils/tests/test_versionpredicate.py diff --git a/text_file.py b/distutils/text_file.py index 93abad38..93abad38 100644 --- a/text_file.py +++ b/distutils/text_file.py diff --git a/unixccompiler.py b/distutils/unixccompiler.py index 4d7a6de7..4d7a6de7 100644 --- a/unixccompiler.py +++ b/distutils/unixccompiler.py diff --git a/util.py b/distutils/util.py index 4b002ece..4b002ece 100644 --- a/util.py +++ b/distutils/util.py diff --git a/version.py b/distutils/version.py index c33bebae..c33bebae 100644 --- a/version.py +++ b/distutils/version.py diff --git a/versionpredicate.py b/distutils/versionpredicate.py index 062c98f2..062c98f2 100644 --- a/versionpredicate.py +++ b/distutils/versionpredicate.py diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..3e01b439 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +filterwarnings= + # acknowledge that TestDistribution isn't a test + ignore:cannot collect test class 'TestDistribution' diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..1590e308 --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +[testenv] +deps = + pytest +commands = + pytest {posargs} +setenv = + PYTHONPATH = {toxinidir} +skip_install = True |
