libfreenect/libfreenect-0.7.0-py3.patch
Rich Mattes c24c1822bd Updates for Python 3.12 compatibility
Resolves: rhbz#2220025
2023-07-13 22:00:22 -04:00

62 lines
2.3 KiB
Diff

diff -up ./src/fwfetcher.py.py3 ./src/fwfetcher.py
--- ./src/fwfetcher.py.py3 2023-04-03 17:59:43.000000000 -0400
+++ ./src/fwfetcher.py 2023-07-13 21:54:27.641914564 -0400
@@ -1,5 +1,3 @@
-#!/usr/bin/env python2
-
from __future__ import absolute_import, division, print_function
import hashlib
@@ -10,10 +8,10 @@ import sys
import time
import zipfile
-try:
+if sys.version_info[0] > 2:
# Python 3
from urllib.request import Request, URLError, urlopen
-except ImportError:
+else:
# Python 2
from urllib2 import Request, URLError, urlopen
diff -up ./wrappers/python/CMakeLists.txt.py3 ./wrappers/python/CMakeLists.txt
--- ./wrappers/python/CMakeLists.txt.py3 2023-04-03 17:59:43.000000000 -0400
+++ ./wrappers/python/CMakeLists.txt 2023-07-13 21:56:32.387653639 -0400
@@ -19,10 +19,7 @@ find_program(CYTHON_EXECUTABLE cython)
# Figure out installation path
# CMake populates this var automatically but we need to specify prefix
-execute_process(COMMAND
- ${Python${Python_BUILD_VERSION}_EXECUTABLE}
- -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=False, standard_lib=False, prefix='${CMAKE_INSTALL_PREFIX}'))"
- OUTPUT_VARIABLE Python${Python_BUILD_VERSION}_SITELIB OUTPUT_STRIP_TRAILING_WHITESPACE)
+set(Python${Python_BUILD_VERSION}_SITELIB "${Python${Python_BUILD_VERSION}_SITEARCH}")
# Figure out numpy include path
# todo: CMake >= 3.14 populates this var automatically when using COMPONENTS NumPy
@@ -56,7 +53,10 @@ target_include_directories(cython${Pytho
# Install the extension
install(TARGETS cython${Python_BUILD_VERSION}_freenect
- DESTINATION ${Python${Python_BUILD_VERSION}_SITELIB})
+ DESTINATION ${Python${Python_BUILD_VERSION}_SITELIB}
+ ARCHIVE DESTINATION ${PYTHON${Python_BUILD_VERSION}_SITE_PACKAGES}
+ LIBRARY DESTINATION ${PYTHON${Python_BUILD_VERSION}_SITE_PACKAGES}
+ )
# TODO: decide on what to do with demo_ scripts and were to install
# them
diff -up ./wrappers/python/setup.py.py3 ./wrappers/python/setup.py
--- ./wrappers/python/setup.py.py3 2023-07-13 21:56:42.085711096 -0400
+++ ./wrappers/python/setup.py 2023-07-13 21:56:56.680797569 -0400
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from distutils.core import setup
-from distutils.extension import Extension
+from setuptools import setup
+from setuptools import Extension
import re
import numpy as np