0001-Make-the-build-of-pyc-files-conditional.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 5d0f69ce7fc05adbd3c71e113c11da0aedbca33a Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 22 Feb 2017 16:21:31 -0800
  4. Subject: [PATCH] Make the build of pyc files conditional
  5. This commit adds a new configure option --disable-pyc-build to disable
  6. the compilation of pyc.
  7. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  8. [ Andrey Smrinov: ported to Python 3.6 ]
  9. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
  10. [ Adam Duskett: ported to Python 3.12.0 ]
  11. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
  12. ---
  13. Makefile.pre.in | 2 ++
  14. configure.ac | 6 ++++++
  15. 2 files changed, 8 insertions(+)
  16. diff --git a/Makefile.pre.in b/Makefile.pre.in
  17. index 4a957fb004..9c5f3c031a 100644
  18. --- a/Makefile.pre.in
  19. +++ b/Makefile.pre.in
  20. @@ -2329,6 +2329,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
  21. $(DESTDIR)$(LIBDEST); \
  22. $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
  23. @ # Build PYC files for the 3 optimization levels (0, 1, 2)
  24. +ifeq (@PYC_BUILD@,yes)
  25. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  26. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  27. -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \
  28. @@ -2338,6 +2339,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
  29. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  30. -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \
  31. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  32. +endif
  33. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  34. $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
  35. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  36. diff --git a/configure.ac b/configure.ac
  37. index 8a32cb58f4..611c33949a 100644
  38. --- a/configure.ac
  39. +++ b/configure.ac
  40. @@ -1479,6 +1479,12 @@ fi
  41. AC_MSG_CHECKING([LDLIBRARY])
  42. +AC_SUBST(PYC_BUILD)
  43. +
  44. +AC_ARG_ENABLE(pyc-build,
  45. + AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
  46. + [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
  47. +
  48. # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
  49. # library that we build, but we do not want to link against it (we
  50. # will find it with a -framework option). For this reason there is an
  51. --
  52. 2.34.1