Skip to content

Commit d22bb50

Browse files
Andrej730arvidn
authored andcommitted
cmake - fix python install path being treated as absolute
Otherwise it was installing binary in my case (Windows) to `Installing: /Lib/site-packages/libtorrent.cp313-win_amd64.pyd` which means `"L:\Lib\site-packages\libtorrent.cp313-win_amd64.pyd"` instead of `L:/my/install/prefix/Lib\site-packages\libtorrent.cp313-win_amd64.pyd`
1 parent f54abf6 commit d22bb50

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bindings/python/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ else()
9696
execute_process(
9797
COMMAND "${Python3_EXECUTABLE}" -c [=[
9898
import sysconfig
99-
print(sysconfig.get_path('platlib', vars={'platbase': '', 'base': ''}))
99+
# Strip leading separator - cmake would otherwise treat this as an absolute path.
100+
print(sysconfig.get_path('platlib', vars={'platbase': '', 'base': ''}).lstrip('/\\'))
100101
]=]
101102
OUTPUT_VARIABLE _PYTHON3_SITE_ARCH
102103
OUTPUT_STRIP_TRAILING_WHITESPACE

0 commit comments

Comments
 (0)