Skip to content

Commit

Permalink
Add newer python ports
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 12, 2024
1 parent 49f9192 commit a95c97c
Show file tree
Hide file tree
Showing 51 changed files with 726 additions and 709 deletions.
13 changes: 13 additions & 0 deletions vcpkg/ports/py-build/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pypa/build
REF cd06da25481b9a610f846fa60cb67b5a5fa9a051
SHA512 02e7021ec3ddd2fa3d5aa3b34193e858ba35d04d36244f1db2e84efbc37fc1f0e118d8ecd32d54ee1feb276e79d753f69979f430ebec7b3e0a0e85e144d1b692
HEAD_REF main
)

file(COPY "${SOURCE_PATH}/src/build" DESTINATION "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}")

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

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
10 changes: 10 additions & 0 deletions vcpkg/ports/py-build/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "py-build",
"version": "0.10.0",
"description": "A simple, correct Python build frontend ",
"homepage": "python-build.readthedocs.io/en/stable/",
"license": "MIT",
"dependencies": [
"python3"
]
}
29 changes: 29 additions & 0 deletions vcpkg/ports/py-flit-core/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pypa/flit
REF c8ae08dc9f3f067feeec9dfd2c443db592f4d3d1
SHA512 4f561b142bb97432d7815f8e0579b562ce5c7eec666f36d52f088adcdd1846337b89ca090ae9849feafc6beb49f7b59fdd11c2b4c730d7b8337729c76cd346d3
HEAD_REF main
)

set(PYTHON3_BASEDIR "${CURRENT_INSTALLED_DIR}/tools/python3")
find_program(PYTHON3 NAMES python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR} python${PYTHON3_VERSION_MAJOR} python PATHS "${PYTHON3_BASEDIR}" NO_DEFAULT_PATH)

message(STATUS "Building dist with '${PYTHON3}'!")
execute_process(COMMAND "${PYTHON3}" "${SOURCE_PATH}/flit_core/build_dists.py"
COMMAND_ERROR_IS_FATAL ANY
#WORKING_DIRECTORY "${wheeldir}"
)

file(GLOB wheel "${SOURCE_PATH}/flit_core/dist/*.whl")

file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE})
message(STATUS "Installing wheel!")
execute_process(COMMAND "${PYTHON3}" "${SOURCE_PATH}/flit_core/bootstrap_install.py" "${wheel}" -i "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}"
COMMAND_ERROR_IS_FATAL ANY
#WORKING_DIRECTORY "${wheeldir}"
)
message(STATUS "Finished installing wheel!")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
10 changes: 10 additions & 0 deletions vcpkg/ports/py-flit-core/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "py-flit-core",
"version": "3.9.0",
"description": "Simplified packaging of Python modules",
"homepage": "flit.pypa.io/",
"license": "BSD-3-Clause",
"dependencies": [
"python3"
]
}
14 changes: 14 additions & 0 deletions vcpkg/ports/py-gpep517/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO projg2/gpep517
REF v${VERSION}
SHA512 7c3b878220e907ef801301eadc0e3031dd3c31770cc50bb7119ab32f9244c8a33792b4896ddeffc5d4b7be9f1d881fba5179de155f11845f510e455be59fb92e
HEAD_REF main
)

file(COPY "${SOURCE_PATH}/gpep517" DESTINATION "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}")
# TODO: python3 -m compileall "$pkgdir/$sitedir"

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

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
16 changes: 16 additions & 0 deletions vcpkg/ports/py-gpep517/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "py-gpep517",
"version": "15",
"description": "Python package builder and installer for non-pip-centric world",
"homepage": "https://github.com/projg2/gpep517",
"license": "MIT",
"dependencies": [
"py-flit-core",
"py-installer",
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
13 changes: 13 additions & 0 deletions vcpkg/ports/py-installer/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pypa/installer
REF b1d39180f8548820d09ce992dfadff0a42242c48
SHA512 09beb22bde94f2a5ec8c164d16af6322d9d05c6ec98507538070a9ab4f161802fc068c5e31540f4adf92c574488f3e0f94dc31e3bf58c09eac4096a8096bf873
HEAD_REF main
)

file(COPY "${SOURCE_PATH}/src/installer" DESTINATION "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}")

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

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
10 changes: 10 additions & 0 deletions vcpkg/ports/py-installer/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "py-installer",
"version": "0.7.0",
"description": "A low-level library for installing from a Python wheel distribution.",
"homepage": "installer.readthedocs.io/",
"license": "MIT",
"dependencies": [
"python3"
]
}
13 changes: 13 additions & 0 deletions vcpkg/ports/py-packaging/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pypa/packaging
REF d563917280d65a6ce2e622bd3d07438e1ee259f3
SHA512 eb556564096e05880413114437d857a062b12c3485f9833af5bd18a387f53b8727cf43a723e4562dacb6ed24e1e66d57978061fb474c074ceb2b287d46149e8a
HEAD_REF main
)

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)
16 changes: 16 additions & 0 deletions vcpkg/ports/py-packaging/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "py-packaging",
"version": "23.1",
"description": "Core utilities for Python packages",
"homepage": "packaging.pypa.io/",
"license": "MIT",
"dependencies": [
"python3",
"py-flit-core",
"py-gpep517",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
30 changes: 30 additions & 0 deletions vcpkg/ports/py-ply/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2001-2022
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Latest version: https://github.com/dabeaz/ply
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of David Beazley or Dabeaz LLC may be used to
# endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 changes: 12 additions & 0 deletions vcpkg/ports/py-ply/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
PACKAGE_NAME ply
VERSION ${VERSION}
SHA512 37e39a4f930874933223be58a3da7f259e155b75135f1edd47069b3b40e5e96af883ebf1c8a1bbd32f914a9e92cfc12e29fec05cf61b518f46c1d37421b20008
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)

vcpkg_install_copyright(FILE_LIST "${CURRENT_PORT_DIR}/copyright")

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "py3-ply",
"name": "py-ply",
"version": "3.11",
"description": "Python Lex & Yacc",
"homepage": "https://www.dabeaz.com/ply/",
"dependencies": [
"python3",
"vcpkg-get-python-packages"
"py-wheel",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
13 changes: 13 additions & 0 deletions vcpkg/ports/py-pyparsing/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pyparsing/pyparsing
REF ${VERSION}
SHA512 51e463c959d81737ac82ca1c9fb68dbf869d8e0140870e45fc77bdfcf258515dc4ea0a5f4dd1a31ce852bf4947cb1654e096036dd494ebab495214a7e1c97d6e
HEAD_REF master
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}")

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

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
14 changes: 14 additions & 0 deletions vcpkg/ports/py-pyparsing/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "py-pyparsing",
"version": "3.1.1",
"description": "Python library for creating PEG parsers",
"homepage": "https://github.com/pyparsing/pyparsing",
"license": "MIT",
"dependencies": [
"python3",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
13 changes: 13 additions & 0 deletions vcpkg/ports/py-pyproject-hooks/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pypa/pyproject-hooks
REF 4c9325f4e594bfc7178452d0d01eb8da6c3dbbdb
SHA512 953744e215798c2d7e88e0a0d1c7d64d06a21031659ba3e5f056786c5c0b6c57d3b0c6d26593ca77fedc947e5ccd50019a5797bfd052dea4461afca28371fc3a
HEAD_REF main
)

file(COPY "${SOURCE_PATH}/src/pyproject_hooks" DESTINATION "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}")

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

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
10 changes: 10 additions & 0 deletions vcpkg/ports/py-pyproject-hooks/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "py-pyproject-hooks",
"version": "1.0.0",
"description": "A low-level library for calling build-backends in `pyproject.toml`-based project",
"homepage": "pyproject-hooks.readthedocs.io/",
"license": "MIT",
"dependencies": [
"python3"
]
}
15 changes: 15 additions & 0 deletions vcpkg/ports/py-pyqt-builder/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
PACKAGE_NAME PyQt-builder
VERSION ${VERSION}
SHA512 ec0b9f7784a32af744111615b93f98d73f284bb752fd71359c798d3b093a01925823effea72c866a5f49f77e3dfc5dee4125bbb289f647d84000bf34b5db6931
)

vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -x)

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

# Shiver ... where do they come from
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/${python_versioned}/site-packages/pyqtbuild/bundle/dlls/)

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "py3-pyqt-builder",
"name": "py-pyqt-builder",
"version": "1.15.4",
"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": [
"python3",
"vcpkg-get-python-packages"
"py-wheel",
{
"name": "vcpkg-python-scripts",
"host": true
}
]
}
97 changes: 97 additions & 0 deletions vcpkg/ports/py-pyqt6/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

vcpkg_from_pythonhosted(
OUT_SOURCE_PATH SOURCE_PATH
PACKAGE_NAME PyQt6
VERSION ${VERSION}
SHA512 c2ff8c47c9b0e43c009d0c90f565a54344e6f384c67dd30c2d422465d0702c07713acc0095c8b67827d1146675611c07d548ba282a26e41bb60a0a21977a7a64
)

set(SIPBUILD_ARGS
"--confirm-license"
"--qmake" "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qmake.exe" #TODO: append .exe only on windows
"--api-dir" "${CURRENT_PACKAGES_DIR}/share/qt6/qsci/api/python"
"--verbose"
"--qt-shared"
"--no-make"
"--disable" "QtDesigner"
"--pep484-pyi"
"--debug"
"--target-dir" "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages"
"--build-dir" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
)

set(SIPBUILD_ARGS
"--confirm-license"
"--qmake" "${CURRENT_INSTALLED_DIR}/tools/Qt6/bin/qmake.exe" #TODO: append .exe only on windows
"--api-dir" "${CURRENT_PACKAGES_DIR}/share/qt6/qsci/api/python"
"--verbose"
"--qt-shared"
"--no-make"
"--disable" "QtDesigner"
"--pep484-pyi"
# "--debug" # will create debuggable bindings
"--target-dir" "${CURRENT_PACKAGES_DIR}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages"
"--build-dir" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
)

message(STATUS "Running sipbuild... (${PYTHON3})")
vcpkg_execute_required_process(
COMMAND "${PYTHON3}" "-m" "sipbuild.tools.build" ${SIPBUILD_ARGS}
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "sipbuild-${TARGET_TRIPLET}-0"
)
message(STATUS "Running sipbuild...finished.")

# TODO: Can we use vcpkg_install_make here instead of duplicating code?
set(MAKEFILE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build/Makefile")

vcpkg_list(SET make_opts)
vcpkg_list(SET install_opts)
set(path_backup "$ENV{PATH}")
if (CMAKE_HOST_WIN32)
vcpkg_add_to_path(PREPEND "${SCRIPTS}/buildsystems/make_wrapper")
if(NOT DEFINED Z_VCPKG_MAKE)
vcpkg_acquire_msys(MSYS_ROOT)
find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED)
endif()
set(make_command "${Z_VCPKG_MAKE}")
vcpkg_list(SET make_opts -j ${VCPKG_CONCURRENCY} --trace -f ${MAKEFILE})

string(REPLACE " " [[\ ]] vcpkg_package_prefix "${CURRENT_PACKAGES_DIR}")
string(REGEX REPLACE [[([a-zA-Z]):/]] [[/\1/]] vcpkg_package_prefix "${vcpkg_package_prefix}")
vcpkg_list(SET install_opts -j ${VCPKG_CONCURRENCY} --trace -f ${MAKEFILE} DESTDIR=${vcpkg_package_prefix}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages)
#TODO: optimize for install-data (release) and install-exec (release/debug)

else()
if(VCPKG_HOST_IS_OPENBSD)
find_program(Z_VCPKG_MAKE gmake REQUIRED)
else()
find_program(Z_VCPKG_MAKE make REQUIRED)
endif()
set(make_command "${Z_VCPKG_MAKE}")
vcpkg_list(SET make_opts V=1 -j ${VCPKG_CONCURRENCY} -f ${MAKEFILE})
vcpkg_list(SET install_opts -j ${VCPKG_CONCURRENCY} -f ${MAKEFILE} DESTDIR=${CURRENT_PACKAGES_DIR}/lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages)

# To find sip-distinfo and python3 during install
set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/tools:${CURRENT_INSTALLED_DIR}/tools/python3:$ENV{PATH}")
endif()

vcpkg_list(SET make_cmd_line ${make_command} ${make_opts})
vcpkg_list(SET install_cmd_line ${make_command} install ${install_opts})

message(STATUS "Running build...")
vcpkg_execute_build_process(
COMMAND ${make_cmd_line}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
LOGNAME "build-${TARGET_TRIPLET}${short_buildtype}"
)
message(STATUS "Running build... finished.")
message(STATUS "Running install...")
vcpkg_execute_build_process(
COMMAND ${install_cmd_line}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel-build"
LOGNAME "install-${TARGET_TRIPLET}${short_buildtype}"
)
message(STATUS "Running install... finished.")
set(ENV{PATH} "${path_backup}")
Loading

0 comments on commit a95c97c

Please sign in to comment.