diff --git a/ports/py-lazy-loader/portfile.cmake b/ports/py-lazy-loader/portfile.cmake new file mode 100644 index 0000000..cb9c2f4 --- /dev/null +++ b/ports/py-lazy-loader/portfile.cmake @@ -0,0 +1,17 @@ +set(VCPKG_BUILD_TYPE release) + +vcpkg_from_pythonhosted( + OUT_SOURCE_PATH SOURCE_PATH + PACKAGE_NAME "lazy-loader" + VERSION ${VERSION} + SHA512 29e3589929869351ea62cf7cbba86b581bd7935918b54cfd5ac107cbf7cc427d6d4e050ec1f9bef084587e55286d7afa31d5cdb6deb7d072d25493d19d6bbce6 + FILENAME lazy_loader +) + +vcpkg_python_build_and_install_wheel(SOURCE_PATH "${SOURCE_PATH}") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") + +vcpkg_python_test_import(MODULE "lazy_loader") + +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) diff --git a/ports/py-lazy-loader/vcpkg.json b/ports/py-lazy-loader/vcpkg.json new file mode 100644 index 0000000..a8cdb01 --- /dev/null +++ b/ports/py-lazy-loader/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "py-lazy-loader", + "version": "0.4", + "description": "Makes it easy to load subpackages and functions on demand.", + "homepage": "https://scientific-python.org/specs/spec-0001/", + "dependencies": [ + "py-packaging", + { + "name": "py-setuptools", + "host": true + }, + "python3", + { + "name": "vcpkg-python-scripts", + "host": true + } + ] +} diff --git a/ports/py-pysal/vcpkg.json b/ports/py-pysal/vcpkg.json index 0a582ed..4d5c747 100644 --- a/ports/py-pysal/vcpkg.json +++ b/ports/py-pysal/vcpkg.json @@ -1,9 +1,11 @@ { "name": "py-pysal", "version": "26.1", + "port-version": 1, "description": "Python Spatial Analysis Library - meta-package for the PySAL ecosystem.", "homepage": "https://pysal.org/", "dependencies": [ + "py-lazy-loader", { "name": "py-setuptools", "host": true diff --git a/ports/py-scipy/portfile.cmake b/ports/py-scipy/portfile.cmake index 3bbd669..ed9e8b7 100644 --- a/ports/py-scipy/portfile.cmake +++ b/ports/py-scipy/portfile.cmake @@ -13,6 +13,31 @@ endif() cmake_path(GET VCPKG_CYTHON PARENT_PATH CYTHON_DIR) vcpkg_add_to_path("${CYTHON_DIR}") +set(z_vcpkg_python_func_python ${PYTHON3}) + +# Scipy depends on NumPy's command-line f2py utility, but +# the open-vcpkg py-numpy port doesn't install it. Here, we +# create it from scratch based on the one pip/PyPi installs. +# At present, it is a unix-like only solution. + +# TODO: figure out how pip creates/installs this +if(NOT VCPKG_HOST_IS_WINDOWS) + file(WRITE "${CURRENT_HOST_INSTALLED_DIR}/tools/tmp/f2py" + "\ +#!/bin/sh\n\ +'''exec' ${PYTHON3} \"$0\" \"$@\"\n\ +' '''\n\ +import sys\n\ +from numpy.f2py.f2py2e import main\n\ +if __name__ == '__main__':\n\ + if sys.argv[0].endswith('.exe'):\n\ + sys.argv[0] = sys.argv[0][:-4]\n\ + sys.exit(main())\n\ +\n\ +" + ) +endif() + vcpkg_from_pythonhosted( OUT_SOURCE_PATH SOURCE_PATH PACKAGE_NAME scipy @@ -20,6 +45,8 @@ vcpkg_from_pythonhosted( SHA512 299339cf7885ae6ad81bb29ab1a9128c1e7baef387e64e03a5ca784c14f08de1fe58c8d58b25c76c9068b09d8d97fc8b38d2e03922f0f8ada4e5d00910d56dae ) +vcpkg_replace_string("${SOURCE_PATH}/meson.build" "py3.dependency()" "dependency('python-3.${PYTHON3_VERSION_MINOR}', method : 'pkg-config')") + vcpkg_mesonpy_prepare_build_options(OUTPUT meson_opts) z_vcpkg_setup_pkgconfig_path(CONFIG "RELEASE") @@ -45,50 +72,34 @@ else() ) endif() -# Scipy depends on NumPy's command-line f2py utility, but -# the open-vcpkg py-numpy port doesn't install it. Here, we -# create it from scratch based on the one pip/PyPi installs. -# At present, it is a unix-like only solution. - -# TODO: figure out how pip creates/installs this -if(NOT VCPKG_HOST_IS_WINDOWS) - file(WRITE "${CURRENT_HOST_INSTALLED_DIR}/tools/tmp/f2py" - "\ -#!/bin/sh\n\ -'''exec' ${PYTHON3} \"$0\" \"$@\"\n\ -' '''\n\ -import sys\n\ -from numpy.f2py.f2py2e import main\n\ -if __name__ == '__main__':\n\ - if sys.argv[0].endswith('.exe'):\n\ - sys.argv[0] = sys.argv[0][:-4]\n\ - sys.exit(main())\n\ -\n\ -" - ) -endif() file(COPY "${CURRENT_HOST_INSTALLED_DIR}/tools/tmp/f2py" DESTINATION ${CURRENT_HOST_INSTALLED_DIR}/tools/numpy/bin FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ) file(REMOVE_RECURSE "${CURRENT_HOST_INSTALLED_DIR}/tools/tmp") vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/numpy/bin") -vcpkg_configure_meson( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS ${meson_opts} - ADDITIONAL_BINARIES - cython=['${VCPKG_CYTHON}'] - python3=['${VCPKG_PYTHON3}'] +list(APPEND meson_opts "--python.platlibdir" "${CURRENT_INSTALLED_DIR}/lib") +list(JOIN meson_opts "\",\"" meson_opts) + +vcpkg_python_build_and_install_wheel( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + --config-json "{\"setup-args\" : [\"${meson_opts}\" ] }" ) -vcpkg_install_meson() -vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/wheels") # don't need to keep the wheel + +set(subdir "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/") +if(VCPKG_TARGET_IS_WINDOWS) + set(subdir "${CURRENT_PACKAGES_DIR}/lib/site-packages/") +endif() +set(pyfile "${subdir}/scipy/__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}") file(GLOB licenses "${SOURCE_PATH}/LICENSE*") vcpkg_install_copyright(FILE_LIST ${licenses}) -# vcpkg_python_test_import uses z_vckpkg_python_func_python instead of PYTHON3 -# and somehow, that variable is getting set to the system python instead of the -# vcpkg-built python -set(z_vcpkg_python_func_python ${PYTHON3}) vcpkg_python_test_import(MODULE "scipy") # Add required Metadata for some python build plugins diff --git a/ports/py-scipy/vcpkg.json b/ports/py-scipy/vcpkg.json index cbc2255..a22d696 100644 --- a/ports/py-scipy/vcpkg.json +++ b/ports/py-scipy/vcpkg.json @@ -1,6 +1,7 @@ { "name": "py-scipy", "version": "1.17.0", + "port-version": 1, "description": "Fundamental algorithms for scientific computing in Python", "homepage": "https://scipy.org/", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index e3bbcf5..2ee3209 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -188,6 +188,10 @@ "baseline": "1.4.5", "port-version": 0 }, + "py-lazy-loader": { + "baseline": "0.4", + "port-version": 0 + }, "py-lxml": { "baseline": "6.0.2", "port-version": 2 @@ -322,7 +326,7 @@ }, "py-pysal": { "baseline": "26.1", - "port-version": 0 + "port-version": 1 }, "py-pyspnego": { "baseline": "0.12.0", @@ -374,7 +378,7 @@ }, "py-scipy": { "baseline": "1.17.0", - "port-version": 0 + "port-version": 1 }, "py-semantic-version": { "baseline": "2.10.0", diff --git a/versions/p-/py-lazy-loader.json b/versions/p-/py-lazy-loader.json new file mode 100644 index 0000000..462f753 --- /dev/null +++ b/versions/p-/py-lazy-loader.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "ec9268444c993f14d67d2ba298e342797aa8004d", + "version": "0.4", + "port-version": 0 + } + ] +} diff --git a/versions/p-/py-pysal.json b/versions/p-/py-pysal.json index 5ae865e..52ef27f 100644 --- a/versions/p-/py-pysal.json +++ b/versions/p-/py-pysal.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "34ec0ba0e4600ba5333314463a3495e18810ed57", + "version": "26.1", + "port-version": 1 + }, { "git-tree": "2d716c71491dc13a427e554fb88824fc2627d69e", "version": "26.1", diff --git a/versions/p-/py-scipy.json b/versions/p-/py-scipy.json index b6e16e5..a3d14c5 100644 --- a/versions/p-/py-scipy.json +++ b/versions/p-/py-scipy.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3ff048c0846f7d1e5c113407ab43fa45c97fa1dc", + "version": "1.17.0", + "port-version": 1 + }, { "git-tree": "3742d07c9df93f25546ba4ebb99089f2dd01f92a", "version": "1.17.0",