1 From 168e6c594e80395583de5ab0d082be119b2061fc Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Tue, 7 Mar 2017 22:18:57 +0100
4 Subject: [PATCH] Make the compilation of .pyc and .pyo conditional
6 This commit adds --{enable,disable}-{pyc,pyo} options to enable/disable
7 the compilation of pyc/pyo files.
9 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
11 Makefile.pre.in | 8 ++++++++
12 configure.ac | 11 +++++++++++
13 2 files changed, 19 insertions(+)
15 diff --git a/Makefile.pre.in b/Makefile.pre.in
16 index 5367df7..96fc718 100644
19 @@ -1128,24 +1128,32 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
20 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
21 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
23 +ifeq (@PYC_BUILD@,yes)
24 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
25 $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
27 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
30 +ifeq (@PYO_BUILD@,yes)
31 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
32 $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
34 -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
37 +ifeq (@PYC_BUILD@,yes)
38 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
39 $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
40 -d $(LIBDEST)/site-packages -f \
41 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
43 +ifeq (@PYO_BUILD@,yes)
44 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
45 $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
46 -d $(LIBDEST)/site-packages -f \
47 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
49 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
50 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
51 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
52 diff --git a/configure.ac b/configure.ac
53 index 5f89797..4aafc82 100644
56 @@ -759,6 +759,17 @@ SunOS*)
62 +AC_ARG_ENABLE(pyc-build,
63 + AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
64 + [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
68 +AC_ARG_ENABLE(pyo-build,
69 + AS_HELP_STRING([--disable-pyo-build], [disable build of pyo files]),
70 + [ PYO_BUILD="${enableval}" ], [ PYO_BUILD=yes ])
73 AC_MSG_CHECKING(LIBRARY)