Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dll search path on windows via dedicated port #23

Merged
merged 13 commits into from
May 13, 2024
7 changes: 7 additions & 0 deletions ports/py-add-vcpkg-dll-path/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file(INSTALL
"${CMAKE_CURRENT_LIST_DIR}/sitecustomize.py"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/python3/Lib")

vcpkg_install_copyright(FILE_LIST "${VCPKG_ROOT_DIR}/LICENSE.txt")

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
8 changes: 8 additions & 0 deletions ports/py-add-vcpkg-dll-path/sitecustomize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os
import sys
from pathlib import Path

vcpkg_bin_path = Path(sys.prefix) / '/../../bin'
if not vcpkg_bin_path.is_dir():
raise RuntimeError(f'Could not add "{vcpkg_bin_path}" to dll paths because it does not exist. If you copied the files from vcpkg either delete this file or adjust it accordingly.')
os.add_dll_directory(vcpkg_bin_path)
8 changes: 8 additions & 0 deletions ports/py-add-vcpkg-dll-path/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "py-add-vcpkg-dll-path",
"version-date": "2024-03-13",
"description": "Adds the vcpkg dll path to python",
"documentation": "https://vcpkg.io/en/docs/README.html",
"license": "MIT",
"supports": "windows"
}
17 changes: 17 additions & 0 deletions ports/py-pyyaml/cy-me-a-river.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/setup.py b/setup.py
index 65b0ea0..4461580 100644
--- a/setup.py
+++ b/setup.py
@@ -82,7 +82,11 @@ if 'sdist' in sys.argv or os.environ.get('PYYAML_FORCE_CYTHON') == '1':
with_cython = True
try:
from Cython.Distutils.extension import Extension as _Extension
- from Cython.Distutils import build_ext as _build_ext
+ try:
+ from Cython.Distutils.old_build_ext import old_build_ext as _build_ext
+ except ImportError:
+ from Cython.Distutils import build_ext as _build_ext
+
with_cython = True
except ImportError:
if with_cython:
2 changes: 2 additions & 0 deletions ports/py-pyyaml/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ vcpkg_from_pythonhosted(
PACKAGE_NAME PyYAML
VERSION ${VERSION}
SHA512 94a29924484f557c0966d485c2b70232909253f27fcea9b89e1db1462abf61f2f85d55fbae0177b2bed70eb5daa75813551e868df4df4cddfdee9a87bd08485f
PATCHES
cy-me-a-river.patch
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)
Expand Down
1 change: 1 addition & 0 deletions ports/py-pyyaml/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "py-pyyaml",
"version": "6.0.1",
"port-version": 1,
"description": "YAML parser and emitter for Python",
"homepage": "https://pyyaml.org/",
"dependencies": [
Expand Down
126 changes: 0 additions & 126 deletions ports/python3/add-vcpkg-search-path.patch

This file was deleted.

1 change: 0 additions & 1 deletion ports/python3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ set(PATCHES
0014-fix-get-python-inc-output.patch
0015-dont-use-WINDOWS-def.patch
0018-fix-sysconfig-include.patch
add-vcpkg-search-path.patch
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
Expand Down
7 changes: 6 additions & 1 deletion ports/python3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "python3",
"version": "3.11.9",
"port-version": 1,
"description": "The Python programming language",
"homepage": "https://github.com/python/cpython",
"license": "Python-2.0",
Expand Down Expand Up @@ -48,7 +49,11 @@
"host": true,
"platform": "windows"
},
"zlib"
"zlib",
{
"name": "py-add-vcpkg-dll-path",
"platform": "windows"
}
],
"features": {
"deprecated-win7-support": {
Expand Down