Skip to content

Commit

Permalink
Fix cmake builds with Python 3.12, which deleted the long-deprecated …
Browse files Browse the repository at this point in the history
…'distutils' module (#13583)
  • Loading branch information
dconeybe authored Sep 4, 2024
1 parent e0158c0 commit 3755841
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmake/external/nanopb.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
diff -Naur nanopb/CMakeLists.txt nanopb-fix/CMakeLists.txt
--- nanopb/CMakeLists.txt 2021-03-22 08:50:07.000000000 -0400
+++ nanopb-fix/CMakeLists.txt 2022-06-24 16:17:09.130783413 -0400
@@ -41,7 +41,7 @@
@@ -41,10 +41,10 @@
if(nanopb_BUILD_GENERATOR)
set(generator_protos nanopb plugin)

- find_package(PythonInterp 2.7 REQUIRED)
+ find_package(PythonInterp 3.7 REQUIRED)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c
"from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))"
- "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))"
+ "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))"
OUTPUT_VARIABLE PYTHON_INSTDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
diff -Naur nanopb/generator/nanopb_generator.py nanopb-fix/generator/nanopb_generator.py
--- nanopb/generator/nanopb_generator.py 2021-03-22 08:50:07.000000000 -0400
+++ nanopb-fix/generator/nanopb_generator.py 2022-11-01 15:37:38.112297044 -0400
Expand Down

0 comments on commit 3755841

Please sign in to comment.