Skip to content

Commit

Permalink
Merge branch 'main' into fix-pyqt6-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored May 13, 2024
2 parents f196f96 + bcb470e commit 27e03ce
Show file tree
Hide file tree
Showing 34 changed files with 385 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
ref: 345ac44ab8d6a16239d3af55df9608bf725e7a48 # TODO: can we have a canonical baseline for tests?
ref: a1212c93cabaa9c5c36c1ffdb4bddd59fdf31e43 # TODO: can we have a canonical baseline for tests?
path: vcpkg
fetch-depth: 1

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: microsoft/vcpkg
ref: 345ac44ab8d6a16239d3af55df9608bf725e7a48 # TODO: can we have a canonical baseline for tests?
ref: a1212c93cabaa9c5c36c1ffdb4bddd59fdf31e43 # TODO: can we have a canonical baseline for tests?
path: vcpkg
fetch-depth: 1

Expand All @@ -57,7 +57,7 @@ jobs:
- name: 🌋 Build
run: |
.\vcpkg\vcpkg.exe install --overlay-ports="${{ github.workspace }}/ports" --triplet=${{ matrix.triplet }} --x-buildtrees-root=C:/vcpkg-build py-pyqt6
.\vcpkg\vcpkg.exe install --overlay-ports="${{ github.workspace }}/ports" --triplet=${{ matrix.triplet }} --x-buildtrees-root=C:/vcpkg-build py-pyqt6 py-pyyaml py-numpy
- name: 📑 Upload logs
uses: actions/upload-artifact@v4
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ Enable registries feature flag in vcpkg and write a vcpkg-configuration.json fil
{
"kind": "git",
"repository": "https://github.com/open-vcpkg/vcpkg-python.git",
"packages": [ "List the packages to use from this registry here" ]
"packages": [
"python3",
"vcpkg-python-scripts",
"py-*"
]
}
]
}
Expand Down
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"
}
18 changes: 18 additions & 0 deletions ports/py-cython/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO cython/cython
REF ${VERSION}
SHA512 585d3fe810ace55278fcc6ea4508b3b5259320f92998cd688da787cd5f88ac5fc2467025f20da6d968969eb3296ae9c517136d24a4dbb475441271227968f6be
HEAD_REF main
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}")

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

if(NOT VCPKG_TARGET_IS_WINDOWS)
vcpkg_copy_tools(TOOL_NAMES cygdb cython cythonize DESTINATION "${CURRENT_PACKAGES_DIR}/${VCPKG_PYTHON3_SCRIPTS}" AUTO_CLEAN)
endif()

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled)
15 changes: 15 additions & 0 deletions ports/py-cython/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "py-cython",
"version": "3.0.5",
"description": "Cython is a Python compiler that makes writing C extensions for Python as easy as Python itself. Cython is based on Pyrex, but supports more cutting edge functionality and optimizations.",
"homepage": "https://cython.org/",
"license": "Apache-2.0",
"dependencies": [
"py-setuptools",
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
125 changes: 125 additions & 0 deletions ports/py-numpy/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) # Numpy includes are stored in the module itself
set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled)
set(VCPKG_BUILD_TYPE release) # No debug builds required for pure python modules since vcpkg does not install a debug python executable.

#TODO: Fix E:\vcpkg_folders\numpy\installed\x64-windows-release\tools\python3\Lib\site-packages\numpy\testing\_private\extbuild.py

set(VCPKG_PYTHON3_BASEDIR "${CURRENT_HOST_INSTALLED_DIR}/tools/python3")
find_program(VCPKG_PYTHON3 NAMES python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR} python${PYTHON3_VERSION_MAJOR} python PATHS "${VCPKG_PYTHON3_BASEDIR}" NO_DEFAULT_PATH)
find_program(VCPKG_CYTHON NAMES cython PATHS "${VCPKG_PYTHON3_BASEDIR}" "${VCPKG_PYTHON3_BASEDIR}/Scripts" NO_DEFAULT_PATH)

set(ENV{PYTHON3} "${VCPKG_PYTHON3}")
set(PYTHON3 "${VCPKG_PYTHON3}")

vcpkg_add_to_path(PREPEND "${VCPKG_PYTHON3_BASEDIR}")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_add_to_path(PREPEND "${VCPKG_PYTHON3_BASEDIR}/Scripts")
endif()

cmake_path(GET SCRIPT_MESON PARENT_PATH MESON_DIR)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO numpy/numpy
REF v${VERSION}
SHA512 01b6a124c72d082f1dafdd98cdaaa84ab57f2bf0112d89d9355fa458a04deb8309c7e78449767429049971793c040e51412060681218a51c671ac6086dba2fa4
HEAD_REF main
)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH_SIMD
REPO intel/x86-simd-sort
REF 0631a88763a4a0a4c9e84d5eeb0ec5d36053730b
SHA512 cd44796fc10e13004932be05d5bee46070e061bcc429c7ee8d9e11520e18c45bdec2f4fcd3555d9769891a763e151b0a0a4c00385ea30f24c99da1c65d736e39
HEAD_REF main
)

file(COPY "${SOURCE_PATH_SIMD}/" DESTINATION "${SOURCE_PATH}/numpy/core/src/npysort/x86-simd-sort")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH_MESON_NUMPY
REPO numpy/meson
REF 4e370ca8ab73c07f7b84abe8a4b937caace050a4
SHA512 dec6e3b9428f95790f85a863778227a73e4f432f8f54e87d61fd6499b5a0723c59a334fcaf880afd59ae50c924d8f2cfa340a143f752cb39f976c731ca0ea123
HEAD_REF main
)

file(COPY "${SOURCE_PATH_MESON_NUMPY}/mesonbuild/modules/features" DESTINATION "${MESON_DIR}/mesonbuild/modules")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH_SVML
REPO numpy/SVML
REF 1b21e453f6b1ba6a6aca392b1d810d9d41576123
SHA512 c9ea7bf9effbf5750750ddfdfc7db3d95614ed176bd4540d68eddb90a15f819510e9564c9454ef34be02dd6a8e48a7f292a70cb5b63c25c3d1c450a8e3b77d35
HEAD_REF main
)

file(COPY "${SOURCE_PATH_SVML}/" DESTINATION "${SOURCE_PATH}/numpy/core/src/umath/svml")

vcpkg_replace_string("${SOURCE_PATH}/meson.build" "py.dependency()" "dependency('python-3.${PYTHON3_VERSION_MINOR}', method : 'pkg-config')")

#debug replacement
vcpkg_replace_string("${SOURCE_PATH}/numpy/_build_utils/tempita.py" "import argparse" "import argparse\nprint(sys.executable)\nimport os\n
print(os.environ['PATH'])")

if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CROSSCOMPILING AND VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(opts
ADDITIONAL_PROPERTIES
"longdouble_format = 'IEEE_DOUBLE_LE'"
)
endif()

message(STATUS "PATH is: '$ENV{PATH}'")
vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-Dblas=blas
-Dlapack=lapack
#-Duse-ilp64=true
ADDITIONAL_BINARIES
cython=['${VCPKG_CYTHON}']
python3=['${VCPKG_PYTHON3}']
# python=['${VCPKG_PYTHON3}']
${opts}
)
message(STATUS "PATH is: '$ENV{PATH}'")
vcpkg_install_meson()
message(STATUS "PATH is: '$ENV{PATH}'")
vcpkg_fixup_pkgconfig()

#E:\vcpkg_folders\numpy\packages\numpy_arm64-windows-release\tools\python3\Lib\site-packages\numpy\__config__.py
# "path": r"E:/vcpkg_folders/numpy/installed/x64-windows-release/tools/python3/python.exe", and full paths to compilers
#"commands": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/arm64/cl.exe, -DWIN32, -D_WINDOWS, -W3, -utf-8, -MP, -MD, -O2, -Oi, -Gy, -DNDEBUG, -Z7",

set(subdir "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/")
if(VCPKG_TARGET_IS_WINDOWS)
set(subdir "${CURRENT_PACKAGES_DIR}/lib/site-packages/")
endif()
set(pyfile "${subdir}/numpy/__config__.py")
file(READ "${pyfile}" contents)
string(REPLACE "${CURRENT_INSTALLED_DIR}" "$(prefix)" contents "${contents}")
string(REPLACE "r\"${VCPKG_PYTHON3}\"" "sys.executable" contents "${contents}")
file(WRITE "${pyfile}" "${contents}")


if(VCPKG_TARGET_IS_WINDOWS)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}")
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/site-packages/numpy" "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/numpy")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
endif()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

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

# Add required Metadata for some python build plugins
file(WRITE "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/numpy-${VERSION}.dist-info/METADATA"
"Metadata-Version: 2.1\n\
Name: numpy\n\
Version: ${VERSION}"
)

vcpkg_python_test_import(MODULE "numpy")
28 changes: 28 additions & 0 deletions ports/py-numpy/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "py-numpy",
"version": "1.26.4",
"description": "The fundamental package for scientific computing with Python.",
"homepage": "https://www.numpy.org/",
"license": "BSD-3-Clause",
"dependencies": [
"blas",
"lapack",
{
"name": "py-cython",
"host": true
},
"python3",
{
"name": "python3",
"host": true
},
{
"name": "vcpkg-python-scripts",
"host": true
},
{
"name": "vcpkg-tool-meson",
"host": true
}
]
}
3 changes: 2 additions & 1 deletion ports/py-pyqt-builder/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
PACKAGE_NAME PyQt-builder
FILE_NAME pyqt_builder
VERSION ${VERSION}
SHA512 ec0b9f7784a32af744111615b93f98d73f284bb752fd71359c798d3b093a01925823effea72c866a5f49f77e3dfc5dee4125bbb289f647d84000bf34b5db6931
SHA512 64fc969799a12a176eb730fdc4581f18293dceb8edff20db0177ce409fe7e712cdfb07449b6c4abdd33f1fd9aabe8bee248fe9aeb5373df533d805f9d2a0c6a5
PATCHES
libpath.patch
)
Expand Down
3 changes: 1 addition & 2 deletions ports/py-pyqt-builder/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "py-pyqt-builder",
"version": "1.15.4",
"port-version": 3,
"version": "1.16.2",
"description": "PyQt-builder is the PEP 517 compliant build system for PyQt and projects that extend PyQt. It extends the SIP build system and uses Qt’s qmake to perform the actual compilation and installation of extension modules.",
"homepage": "https://www.riverbankcomputing.com/software/pyqt-builder",
"dependencies": [
Expand Down
2 changes: 1 addition & 1 deletion ports/py-pyqt6/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
PACKAGE_NAME PyQt6
VERSION ${VERSION}
SHA512 c2ff8c47c9b0e43c009d0c90f565a54344e6f384c67dd30c2d422465d0702c07713acc0095c8b67827d1146675611c07d548ba282a26e41bb60a0a21977a7a64
SHA512 619210d2de3e149b55e2d45cbd8ec2113b3effcaccd25eef6067ea99b82e250f1ce288b38136604536053690071f8c843339b934b5ce5e539a5dfdecc26f44d2
)

# https://www.riverbankcomputing.com/static/Docs/PyQt6/installation.html
Expand Down
3 changes: 2 additions & 1 deletion ports/py-pyqt6/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "py-pyqt6",
"version": "6.6.1",
"port-version": 3,
"version": "6.7.0",
"port-version": 1,
"description": "Python bindings for the Qt cross platform application toolkit",
"homepage": "https://www.riverbankcomputing.com/software/pyqt/",
"dependencies": [
Expand Down
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:
14 changes: 14 additions & 0 deletions ports/py-pyyaml/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
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)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
18 changes: 18 additions & 0 deletions ports/py-pyyaml/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "py-pyyaml",
"version": "6.0.1",
"port-version": 1,
"description": "YAML parser and emitter for Python",
"homepage": "https://pyyaml.org/",
"dependencies": [
{
"name": "py-setuptools",
"host": true
},
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
2 changes: 1 addition & 1 deletion ports/py-sip/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
PACKAGE_NAME sip
VERSION ${VERSION}
SHA512 885c32a051e882b82b59bf1365050933f8fc1c619b19f4bc03235edc5741a5e14aae8edf90479ad0283f74ba5c5233a2589c151ec865b130199a6db9800a2294
SHA512 8a0ff1c16ead4c2b1c53963a015fb3d149362f649eeec2523e6b243945493f28f5ecf29aabbf5cee5f7909ded40d64a1f469d2d0c1b3c33244e6213ab23ec733
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)
Expand Down
3 changes: 1 addition & 2 deletions ports/py-sip/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "py-sip",
"version": "6.7.12",
"port-version": 3,
"version": "6.8.3",
"description": "A tool that makes it easy to create Python bindings for C and C++ libraries",
"homepage": "https://www.riverbankcomputing.com/software/sip",
"dependencies": [
Expand Down
Loading

0 comments on commit 27e03ce

Please sign in to comment.