|
34 | 34 | except ImportError: |
35 | 35 | ctypes = None |
36 | 36 |
|
| 37 | +# Implementation name for lib directory (e.g., 'python' for CPython, 'pypy' for PyPy) |
| 38 | +IMPL_NAME = sysconfig._get_implementation().lower() |
| 39 | + |
37 | 40 | # Platforms that set sys._base_executable can create venvs from within |
38 | 41 | # another venv, so no need to skip tests that require venv.create(). |
39 | 42 | requireVenvCreate = unittest.skipUnless( |
@@ -75,7 +78,7 @@ def setUp(self): |
75 | 78 | self.include = 'Include' |
76 | 79 | else: |
77 | 80 | self.bindir = 'bin' |
78 | | - self.lib = ('lib', f'python{sysconfig._get_python_version_abi()}') |
| 81 | + self.lib = ('lib', f'{IMPL_NAME}{sysconfig._get_python_version_abi()}') |
79 | 82 | self.include = 'include' |
80 | 83 | executable = sys._base_executable |
81 | 84 | self.exe = os.path.split(executable)[-1] |
@@ -357,8 +360,8 @@ def test_sysconfig_symlinks(self): |
357 | 360 | ('bin',), |
358 | 361 | ('include',), |
359 | 362 | ('lib',), |
360 | | - ('lib', 'python%d.%d' % sys.version_info[:2]), |
361 | | - ('lib', 'python%d.%d' % sys.version_info[:2], 'site-packages'), |
| 363 | + ('lib', '%s%d.%d' % (IMPL_NAME, *sys.version_info[:2])), |
| 364 | + ('lib', '%s%d.%d' % (IMPL_NAME, *sys.version_info[:2]), 'site-packages'), |
362 | 365 | ) |
363 | 366 |
|
364 | 367 | def create_contents(self, paths, filename): |
@@ -688,7 +691,7 @@ def test_zippath_from_non_installed_posix(self): |
688 | 691 | os.makedirs(libdir) |
689 | 692 | landmark = os.path.join(libdir, "os.py") |
690 | 693 | abi_thread = "t" if sysconfig.get_config_var("Py_GIL_DISABLED") else "" |
691 | | - stdlib_zip = f"python{sys.version_info.major}{sys.version_info.minor}{abi_thread}" |
| 694 | + stdlib_zip = f"{IMPL_NAME}{sys.version_info.major}{sys.version_info.minor}{abi_thread}" |
692 | 695 | zip_landmark = os.path.join(non_installed_dir, |
693 | 696 | platlibdir, |
694 | 697 | stdlib_zip) |
|
0 commit comments