Skip to content

Commit

Permalink
Fix Python3 tool on Windows (#7051)
Browse files Browse the repository at this point in the history
* Delete python37._pth from python3-embed

* Add version number to SUBDIR

* [open62541] Use Python in version subdir
  • Loading branch information
cskrisz authored and vicroms committed Jul 2, 2019
1 parent f15d52b commit 4642a4f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ports/open62541/CONTROL
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Source: open62541
Version: 0.3.0-1
Version: 0.3.0-2
Description: open62541 is an open source C (C99) implementation of OPC UA licensed under the Mozilla Public License v2.0.
4 changes: 3 additions & 1 deletion ports/open62541/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ endif()

vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
get_filename_component(PYTHON3_DIR_NAME "${PYTHON3_DIR}" NAME)
vcpkg_add_to_path("${PYTHON3_DIR}")

if(NOT EXISTS ${PYTHON3_DIR}/easy_install${EXECUTABLE_SUFFIX})
if(NOT EXISTS ${PYTHON3_DIR}/Scripts/pip${EXECUTABLE_SUFFIX})
vcpkg_download_distfile(GET_PIP
URLS "https://bootstrap.pypa.io/get-pip.py"
FILENAME "tools/python/python3/get-pip.py"
FILENAME "tools/python/${PYTHON3_DIR_NAME}/get-pip.py"
SHA512 99520d223819708b8f6e4b839d1fa215e4e8adc7fcd0db6c25a0399cf2fa10034b35673cf450609303646d12497f301ef53b7e7cc65c78e7bce4af0c673555ad
)
execute_process(COMMAND ${PYTHON3_DIR}/python${EXECUTABLE_SUFFIX} ${PYTHON3_DIR}/get-pip.py)
Expand Down
12 changes: 11 additions & 1 deletion scripts/cmake/vcpkg_find_acquire_program.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function(vcpkg_find_acquire_program VAR)
unset(_vfa_RENAME)
unset(SUBDIR)
unset(REQUIRED_INTERPRETER)
unset(POST_INSTALL_COMMAND)

vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS)
vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT)
Expand Down Expand Up @@ -77,11 +78,12 @@ function(vcpkg_find_acquire_program VAR)
elseif(VAR MATCHES "PYTHON3")
if(CMAKE_HOST_WIN32)
set(PROGNAME python)
set(SUBDIR "python3")
set(SUBDIR "python-3.7.3")
set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
set(URL "https://www.python.org/ftp/python/3.7.3/python-3.7.3-embed-win32.zip")
set(ARCHIVE "python-3.7.3-embed-win32.zip")
set(HASH 2c1b1f0a29d40a91771ae21a5f733eedc10984cd182cb10c2793bbd24191a89f20612a3f23c34047f37fb06369016bfd4a52915ed1b4a56f8bd2b4ca6994eb31)
set(POST_INSTALL_COMMAND ${CMAKE_COMMAND} -E remove python37._pth)
else()
set(PROGNAME python3)
set(BREW_PACKAGE_NAME "python")
Expand Down Expand Up @@ -291,6 +293,14 @@ function(vcpkg_find_acquire_program VAR)
endif()
endif()

if(DEFINED POST_INSTALL_COMMAND)
vcpkg_execute_required_process(
COMMAND ${POST_INSTALL_COMMAND}
WORKING_DIRECTORY ${PROG_PATH_SUBDIR}
LOGNAME ${VAR}-tool-post-install
)
endif()

do_find()
endif()

Expand Down

0 comments on commit 4642a4f

Please sign in to comment.