Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
run: |
# There can be several Python versions installed. We must use the exact one discovered by CMake.
PYTHON=`grep -m1 'Python3_EXECUTABLE.*=' build/CMakeCache.txt | cut -d= -f2`
PYTHONPATH=$PYTHONPATH:$PREFIX/$($PYTHON -c "import sysconfig as sc; print(sc.get_path('platlib', 'posix_prefix', vars={'platbase': '.'}))")
$PYTHON tests/pyhook_smoketest.py
- name: Build AppImage
if: matrix.target == 'Release'
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/scripts/setup_linux_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ echo "DEPSPREFIX=$DEPSPREFIX" >> $GITHUB_ENV
echo "PATH=$PATH:$DEPSPREFIX/bin:$PREFIX/bin:~/.local/bin" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPSPREFIX/lib:$PREFIX/lib" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$DEPSPREFIX/lib/pkgconfig" >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH:$PREFIX/$($PYTHON -c "import sysconfig as sc; print(sc.get_path('platlib', vars={'platbase': '.'}))")" >> $GITHUB_ENV
PYCODE="
import sysconfig as sc
p = sc.get_path('platlib', vars={'platbase': '.'})
# sc.get_default_scheme() does no exist in Python < 3.10
scheme = getattr(sc, 'get_default_scheme', lambda: None)()
# strip leading 'local/' from 'platlib' in 'posix_local' to avoid '/usr/local/local/...' (#5840)
if (
scheme == 'posix_local' and
'$DESTDIR$PREFIX' != sc.get_config_var('platbase') and
p.startswith('local/')
):
p = p[6:]
print(p)
"
echo "PYTHONPATH=$PYTHONPATH:$PREFIX/$($PYTHON -c "$PYCODE")" >> $GITHUB_ENV

if [ ! -d deps/install ]; then
echo "Custom dependencies not present - will build them"
Expand Down
1 change: 1 addition & 0 deletions Packaging/win/ffbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ log_status "Stripping Python cache files (*.pyc,*.pyo,__pycache__)..."
find "$RELEASE/lib/$PYVER" -regextype sed -regex ".*\.py[co]" | xargs rm -rfv
find "$RELEASE/lib/$PYVER" -name "__pycache__" | xargs rm -rfv

# no need to check for 'posix_local' scheme because we are on MSYS2
PY_DLLS_SRC_PATH=`/$MINGVER/bin/python.exe -c "import sysconfig as sc; print(sc.get_path('platlib', vars={'platbase': '.'}))"`

log_status "Copying the Python extension dlls..."
Expand Down
19 changes: 17 additions & 2 deletions pyhook/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,25 @@ else()
# So do it ourselves, getting the prefix-relative path instead
if(NOT DEFINED PYHOOK_INSTALL_DIR)
if(APPLE)
set(_PYHOOK_SYSCONFIG_PREFIX " 'posix_prefix',")
set(_pycode "import sysconfig as sc; print(sc.get_path('platlib','posix_prefix', vars={'platbase': '.'}))")
else()
set(_pycode "
import sysconfig as sc
p = sc.get_path('platlib', vars={'platbase': '.'})
# sc.get_default_scheme() does no exist in Python < 3.10
scheme = getattr(sc, 'get_default_scheme', lambda: None)()
# strip leading 'local/' from 'platlib' in 'posix_local' to avoid '/usr/local/local/...' (#5840)
if (
scheme == 'posix_local' and
\"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}\" != sc.get_config_var('platbase') and
p.startswith('local/')
):
p = p[6:]
print(p)
")
endif()
execute_process(
COMMAND "${Python3_EXECUTABLE}" -c "import sysconfig as sc; print(sc.get_path('platlib',${_PYHOOK_SYSCONFIG_PREFIX} vars={'platbase': '.'}))"
COMMAND "${Python3_EXECUTABLE}" -c "${_pycode}"
RESULT_VARIABLE _pyhook_install_dir_result
OUTPUT_VARIABLE PYHOOK_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down
Loading