diff --git a/vcpkg/ports/py-setuptools/fix-prefix.patch b/vcpkg/ports/py-setuptools/fix-prefix.patch new file mode 100644 index 000000000000..13f8af9ce524 --- /dev/null +++ b/vcpkg/ports/py-setuptools/fix-prefix.patch @@ -0,0 +1,61 @@ +diff --git a/setuptools/_distutils/command/build_ext.py b/setuptools/_distutils/command/build_ext.py +index 06d949a..0dee0fe 100644 +--- a/setuptools/_distutils/command/build_ext.py ++++ b/setuptools/_distutils/command/build_ext.py +@@ -209,6 +209,14 @@ class build_ext(Command): + elif isinstance(self.rpath, str): + self.rpath = self.rpath.split(os.pathsep) + ++ prefix = os.path.normpath(sys.prefix) ++ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) # Add debug compile? ++ ++ if self.debug: ++ self.library_dirs.append(os.path.join(vcpkg_prefix, 'debug', 'lib')) ++ else: ++ self.library_dirs.append(os.path.join(vcpkg_prefix, 'lib')) ++ + # for extensions under windows use different directories + # for Release and Debug builds. + # also Python's library directory must be appended to library_dirs +@@ -216,9 +224,9 @@ class build_ext(Command): + # the 'libs' directory is for binary installs - we assume that + # must be the *native* platform. But we don't really support + # cross-compiling via a binary install anyway, so we let it go. +- self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) +- if sys.base_exec_prefix != sys.prefix: # Issue 16116 +- self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs')) ++ # self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) ++ # if sys.base_exec_prefix != sys.prefix: # Issue 16116 ++ # self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs')) + if self.debug: + self.build_temp = os.path.join(self.build_temp, "Debug") + else: +diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py +index 1a38e9f..2c8174d 100644 +--- a/setuptools/_distutils/sysconfig.py ++++ b/setuptools/_distutils/sysconfig.py +@@ -191,18 +191,21 @@ def _get_python_inc_from_config(plat_specific, spec_prefix): + def _get_python_inc_posix_prefix(prefix): + implementation = 'pypy' if IS_PYPY else 'python' + python_dir = implementation + get_python_version() + build_flags +- return os.path.join(prefix, "include", python_dir) ++ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) ++ return os.path.join(vcpkg_prefix, "include", python_dir) + + + def _get_python_inc_nt(prefix, spec_prefix, plat_specific): ++ vcpkg_prefix = os.path.dirname(os.path.dirname(prefix)) ++ python_dir = 'python' + get_python_version() + if python_build: + # Include both include dirs to ensure we can find pyconfig.h + return ( +- os.path.join(prefix, "include") ++ os.path.join(vcpkg_prefix, "include", python_dir) + + os.path.pathsep + + os.path.dirname(sysconfig.get_config_h_filename()) + ) +- return os.path.join(prefix, "include") ++ return os.path.join(vcpkg_prefix, "include", python_dir) + + + # allow this behavior to be monkey-patched. Ref pypa/distutils#2. diff --git a/vcpkg/ports/py-setuptools/portfile.cmake b/vcpkg/ports/py-setuptools/portfile.cmake new file mode 100644 index 000000000000..1df3e6ebeee3 --- /dev/null +++ b/vcpkg/ports/py-setuptools/portfile.cmake @@ -0,0 +1,18 @@ +vcpkg_from_pythonhosted( + OUT_SOURCE_PATH SOURCE_PATH + PACKAGE_NAME setuptools + VERSION ${VERSION} + SHA512 d0a34f16dfa6bb9a6df39076cd43528cf854d343f6f801c448ea0ebab2a259aec3d03571e2a26709df6082ed2fcb6c43b86448be556fd559b6af41831b4f38e0 + PATCHES + fix-prefix.patch +) + +vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}") + +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +#execute_process(COMMAND ${PYTHON3} "${SOURCE_PATH}/setup.py" install "--prefix=${CURRENT_INSTALLED_DIR}/tools/python3" "--root=${CURRENT_PACKAGES_DIR}" +# COMMAND_ERROR_IS_FATAL ANY +# WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/python3" +#) diff --git a/vcpkg/ports/py-setuptools/vcpkg.json b/vcpkg/ports/py-setuptools/vcpkg.json new file mode 100644 index 000000000000..b98586c650be --- /dev/null +++ b/vcpkg/ports/py-setuptools/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "py-setuptools", + "version": "72.1.0", + "description": "Official project repository for the Setuptools build system ", + "homepage": "https://pypi.org/project/setuptools/", + "license": "MIT", + "dependencies": [ + "py-packaging", + "py-wheel", + "python3", + { + "name": "vcpkg-python-scripts", + "host": true + } + ] +}