[python2] no absolute paths (#22329)

* [python2] no absolute paths

* this is how I'd solve it

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
autoantwort 2022-03-02 22:29:24 +01:00 committed by GitHub
parent 11be87ec56
commit a46f923db1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 2 deletions

View File

@ -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)

View File

@ -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"

View File

@ -5554,7 +5554,7 @@
},
"python2": {
"baseline": "2.7.18",
"port-version": 2
"port-version": 3
},
"python3": {
"baseline": "3.10.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2a9fb7f96d762e213e9901452492aee00f6fe049",
"version": "2.7.18",
"port-version": 3
},
{
"git-tree": "fc1f7aaa8a2312a56ce7dc1324c2eaf608a7a331",
"version": "2.7.18",