diff --git a/ports/python2/portfile.cmake b/ports/python2/portfile.cmake index fa5fea78c7ef75..7d0d9a527426b6 100644 --- a/ports/python2/portfile.cmake +++ b/ports/python2/portfile.cmake @@ -87,10 +87,62 @@ else() ) vcpkg_install_make() + vcpkg_fixup_pkgconfig() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") endif() +if (NOT VCPKG_TARGET_IS_WINDOWS) + foreach(lib_suffix IN ITEMS "" "/debug") + set(python_config_file "${CURRENT_PACKAGES_DIR}${lib_suffix}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/_sysconfigdata.py") + if(NOT EXISTS "${python_config_file}") + continue() + endif() + + file(READ "${python_config_file}" contents) + + string(PREPEND contents "import os\n_base = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))\n") + # make contents a list of lines + string(REPLACE ";" "\\;" old_contents "${contents}") + string(REGEX REPLACE "\r?\n" ";" old_contents "${contents}") + + set(new_contents "") + foreach(line IN LISTS old_contents) + if(line MATCHES "\"") + string(REGEX REPLACE + "${CURRENT_PACKAGES_DIR}|${CURRENT_INSTALLED_DIR}" + "\" + _base + \"" + line + "${line}" + ) + string(REGEX REPLACE + "\"[^\"]*${CURRENT_BUILDTREES_DIR}[^\"]*\"" + "''" + line + "${line}" + ) + else() + string(REGEX REPLACE + "${CURRENT_PACKAGES_DIR}|${CURRENT_INSTALLED_DIR}" + "' + _base + '" + line + "${line}" + ) + string(REGEX REPLACE + "'[^']*${CURRENT_BUILDTREES_DIR}[^']*'" + "''" + line + "${line}" + ) + endif() + list(APPEND new_contents "${line}") + endforeach() + + list(JOIN new_contents "\n" contents) + file(WRITE "${python_config_file}" "${contents}") + endforeach() +endif() + # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}) file(RENAME ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/python${PYTHON_VERSION_MAJOR}/copyright) diff --git a/ports/python2/vcpkg.json b/ports/python2/vcpkg.json index f4f4b4e0c41f11..6be1869d01f999 100644 --- a/ports/python2/vcpkg.json +++ b/ports/python2/vcpkg.json @@ -1,7 +1,7 @@ { "name": "python2", "version": "2.7.18", - "port-version": 2, + "port-version": 3, "description": "The Python programming language as an embeddable library", "homepage": "https://www.python.org", "license": "Python-2.0" diff --git a/versions/baseline.json b/versions/baseline.json index 5f7c521b145264..3a109e9a1358a4 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5546,7 +5546,7 @@ }, "python2": { "baseline": "2.7.18", - "port-version": 2 + "port-version": 3 }, "python3": { "baseline": "3.10.1", diff --git a/versions/p-/python2.json b/versions/p-/python2.json index 0331d02ffa7c70..cbb06c836db015 100644 --- a/versions/p-/python2.json +++ b/versions/p-/python2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "2a9fb7f96d762e213e9901452492aee00f6fe049", + "version": "2.7.18", + "port-version": 3 + }, { "git-tree": "fc1f7aaa8a2312a56ce7dc1324c2eaf608a7a331", "version": "2.7.18",