nanopb.patch 1.6 KB

123456789101112131415161718192021222324252627282930
  1. diff -Naur nanopb/CMakeLists.txt nanopb-fix/CMakeLists.txt
  2. --- nanopb/CMakeLists.txt 2021-03-22 08:50:07.000000000 -0400
  3. +++ nanopb-fix/CMakeLists.txt 2022-06-24 16:17:09.130783413 -0400
  4. @@ -41,10 +41,10 @@
  5. if(nanopb_BUILD_GENERATOR)
  6. set(generator_protos nanopb plugin)
  7. - find_package(PythonInterp 2.7 REQUIRED)
  8. + find_package(PythonInterp 3.7 REQUIRED)
  9. execute_process(
  10. COMMAND ${PYTHON_EXECUTABLE} -c
  11. - "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))"
  12. + "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))"
  13. OUTPUT_VARIABLE PYTHON_INSTDIR
  14. OUTPUT_STRIP_TRAILING_WHITESPACE
  15. )
  16. diff -Naur nanopb/generator/nanopb_generator.py nanopb-fix/generator/nanopb_generator.py
  17. --- nanopb/generator/nanopb_generator.py 2021-03-22 08:50:07.000000000 -0400
  18. +++ nanopb-fix/generator/nanopb_generator.py 2022-11-01 15:37:38.112297044 -0400
  19. @@ -1641,7 +1641,9 @@
  20. optfilename = os.path.join(p, optfilename)
  21. if options.verbose:
  22. sys.stderr.write('Reading options from ' + optfilename + '\n')
  23. - Globals.separate_options = read_options_file(open(optfilename, "rU"))
  24. + # Patch in https://github.com/nanopb/nanopb/commit/01e9186a8b to avoid
  25. + # using "U" in the filemode, whose support was removed in Python 3.11.
  26. + Globals.separate_options = read_options_file(open(optfilename, 'r', encoding = 'utf-8'))
  27. break
  28. else:
  29. # If we are given a full filename and it does not exist, give an error.