File: 1000-fix-python-paths.patch

package info (click to toggle)
opencamlib 2023.01.11-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,800 kB
  • sloc: cpp: 8,722; python: 5,530; sh: 604; javascript: 310; makefile: 209
file content (29 lines) | stat: -rw-r--r-- 1,079 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Description: Adjust where python code and shared library is placed.
 Make sure the files are where python expect to find it using
 'python -c "import site; print(site.getsitepackages()[-2])"'.
Author: Petter Reinholdtsen <pere@debian.org>
Forwarded: https://github.com/aewallin/opencamlib/pull/166
Last-Update: 2023-09-03

--- opencamlib-salsa.orig/src/pythonlib/pythonlib.cmake	2023-08-27 07:21:02.659465638 +0200
+++ opencamlib-salsa/src/pythonlib/pythonlib.cmake	2023-08-27 07:22:19.696171690 +0200
@@ -41,11 +41,17 @@
   target_link_libraries(ocl PRIVATE OpenMP::OpenMP_CXX)
 endif()
 
-install(TARGETS ocl LIBRARY DESTINATION "opencamlib")
+execute_process(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[-2])"
+    OUTPUT_VARIABLE PYTHON_ARCH_PACKAGES
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+install(TARGETS ocl LIBRARY DESTINATION "${PYTHON_ARCH_PACKAGES}/opencamlib")
 if(NOT SKBUILD)
   install(
     DIRECTORY pythonlib/opencamlib/
-    DESTINATION "opencamlib"
+    DESTINATION "${PYTHON_ARCH_PACKAGES}/opencamlib"
   )
 endif()