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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 96a5a899445bee3bc1b750cc4aca730cc1733375 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. Upstream: N/A
  8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  9. [ Andrey Smrinov: ported to Python 3.6 ]
  10. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
  11. [ Adam Duskett: ported to Python 3.12.0 ]
  12. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
  13. [ Vincent Fazio: ported to Python 3.13.2 ]
  14. Signed-off-by: Vincent Fazio <vfazio@gmail.com>
  15. ---
  16. Makefile.pre.in | 2 ++
  17. configure.ac | 7 +++++++
  18. 2 files changed, 9 insertions(+)
  19. diff --git a/Makefile.pre.in b/Makefile.pre.in
  20. index 46a37ded970..b9a2ab2b02b 100644
  21. --- a/Makefile.pre.in
  22. +++ b/Makefile.pre.in
  23. @@ -2563,6 +2563,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
  24. patch --force --reject-file "$(abs_builddir)/app-store-compliance.rej" --strip 2 --directory "$(DESTDIR)$(LIBDEST)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)" || true ; \
  25. fi
  26. @ # Build PYC files for the 3 optimization levels (0, 1, 2)
  27. +ifeq (@PYC_BUILD@,yes)
  28. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  29. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  30. -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \
  31. @@ -2572,6 +2573,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
  32. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  33. -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \
  34. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  35. +endif
  36. # bpo-21536: Misc/python-config.sh is generated in the build directory
  37. # from $(srcdir)Misc/python-config.sh.in.
  38. diff --git a/configure.ac b/configure.ac
  39. index 3fcb18922c5..c60381f9605 100644
  40. --- a/configure.ac
  41. +++ b/configure.ac
  42. @@ -1513,6 +1513,13 @@ fi
  43. AC_MSG_CHECKING([LDLIBRARY])
  44. +AC_SUBST(PYC_BUILD)
  45. +
  46. +AC_ARG_ENABLE(pyc-build,
  47. + AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
  48. + [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
  49. +
  50. +
  51. # Apple framework builds need more magic. LDLIBRARY is the dynamic
  52. # library that we build, but we do not want to link against it (we
  53. # will find it with a -framework option). For this reason there is an
  54. --
  55. 2.34.1