|
| 1 | +diff --git a/setuptools/_distutils/command/build_ext.py b/setuptools/_distutils/command/build_ext.py |
| 2 | +index 06d949a..0dee0fe 100644 |
| 3 | +--- a/setuptools/_distutils/command/build_ext.py |
| 4 | ++++ b/setuptools/_distutils/command/build_ext.py |
| 5 | +@@ -209,6 +209,14 @@ class build_ext(Command): |
| 6 | + elif isinstance(self.rpath, str): |
| 7 | + self.rpath = self.rpath.split(os.pathsep) |
| 8 | + |
| 9 | ++ prefix = os.path.normpath(sys.prefix) |
| 10 | ++ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) # Add debug compile? |
| 11 | ++ |
| 12 | ++ if self.debug: |
| 13 | ++ self.library_dirs.append(os.path.join(vcpkg_prefix, 'debug', 'lib')) |
| 14 | ++ else: |
| 15 | ++ self.library_dirs.append(os.path.join(vcpkg_prefix, 'lib')) |
| 16 | ++ |
| 17 | + # for extensions under windows use different directories |
| 18 | + # for Release and Debug builds. |
| 19 | + # also Python's library directory must be appended to library_dirs |
| 20 | +@@ -216,9 +224,9 @@ class build_ext(Command): |
| 21 | + # the 'libs' directory is for binary installs - we assume that |
| 22 | + # must be the *native* platform. But we don't really support |
| 23 | + # cross-compiling via a binary install anyway, so we let it go. |
| 24 | +- self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) |
| 25 | +- if sys.base_exec_prefix != sys.prefix: # Issue 16116 |
| 26 | +- self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs')) |
| 27 | ++ # self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) |
| 28 | ++ # if sys.base_exec_prefix != sys.prefix: # Issue 16116 |
| 29 | ++ # self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs')) |
| 30 | + if self.debug: |
| 31 | + self.build_temp = os.path.join(self.build_temp, "Debug") |
| 32 | + else: |
| 33 | +diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py |
| 34 | +index 1a38e9f..2c8174d 100644 |
| 35 | +--- a/setuptools/_distutils/sysconfig.py |
| 36 | ++++ b/setuptools/_distutils/sysconfig.py |
| 37 | +@@ -191,18 +191,21 @@ def _get_python_inc_from_config(plat_specific, spec_prefix): |
| 38 | + def _get_python_inc_posix_prefix(prefix): |
| 39 | + implementation = 'pypy' if IS_PYPY else 'python' |
| 40 | + python_dir = implementation + get_python_version() + build_flags |
| 41 | +- return os.path.join(prefix, "include", python_dir) |
| 42 | ++ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) |
| 43 | ++ return os.path.join(vcpkg_prefix, "include", python_dir) |
| 44 | + |
| 45 | + |
| 46 | + def _get_python_inc_nt(prefix, spec_prefix, plat_specific): |
| 47 | ++ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) |
| 48 | ++ python_dir = 'python' + get_python_version() |
| 49 | + if python_build: |
| 50 | + # Include both include dirs to ensure we can find pyconfig.h |
| 51 | + return ( |
| 52 | +- os.path.join(prefix, "include") |
| 53 | ++ os.path.join(vcpkg_prefix, "include", python_dir) |
| 54 | + + os.path.pathsep |
| 55 | + + os.path.dirname(sysconfig.get_config_h_filename()) |
| 56 | + ) |
| 57 | +- return os.path.join(prefix, "include") |
| 58 | ++ return os.path.join(vcpkg_prefix, "include", python_dir) |
| 59 | + |
| 60 | + |
| 61 | + # allow this behavior to be monkey-patched. Ref pypa/distutils#2. |
0 commit comments