nanopb.patch 1.4 KB

1234567891011121314151617181920212223242526
  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,7 +41,7 @@
  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. diff -Naur nanopb/generator/nanopb_generator.py nanopb-fix/generator/nanopb_generator.py
  13. --- nanopb/generator/nanopb_generator.py 2021-03-22 08:50:07.000000000 -0400
  14. +++ nanopb-fix/generator/nanopb_generator.py 2022-11-01 15:37:38.112297044 -0400
  15. @@ -1641,7 +1641,9 @@
  16. optfilename = os.path.join(p, optfilename)
  17. if options.verbose:
  18. sys.stderr.write('Reading options from ' + optfilename + '\n')
  19. - Globals.separate_options = read_options_file(open(optfilename, "rU"))
  20. + # Patch in https://github.com/nanopb/nanopb/commit/01e9186a8b to avoid
  21. + # using "U" in the filemode, whose support was removed in Python 3.11.
  22. + Globals.separate_options = read_options_file(open(optfilename, 'r', encoding = 'utf-8'))
  23. break
  24. else:
  25. # If we are given a full filename and it does not exist, give an error.