diff mbox series

[3/4] python: compile Python bytecode when installing Python files

Message ID 20191102172812.22492-3-nicolas.iooss@m4x.org (mailing list archive)
State Rejected
Headers show
Series [1/4] libselinux: compile Python bytecode when installing Python files | expand

Commit Message

Nicolas Iooss Nov. 2, 2019, 5:28 p.m. UTC
Create a cache directory such as
/usr/lib/python3.7/site-packages/sepolgen/__pycache__/ in order to
prevent it from being dynamically created when sepolgen module is
imported.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 python/semanage/Makefile              | 1 +
 python/sepolgen/src/sepolgen/Makefile | 1 +
 2 files changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/python/semanage/Makefile b/python/semanage/Makefile
index 024e9640fed0..c6a16918360d 100644
--- a/python/semanage/Makefile
+++ b/python/semanage/Makefile
@@ -28,6 +28,7 @@  install: all
 	done
 	test -d $(DESTDIR)/$(PACKAGEDIR) || install -m 755 -d $(DESTDIR)/$(PACKAGEDIR)
 	install -m 644 seobject.py $(DESTDIR)/$(PACKAGEDIR)
+	$(PYTHON) -m compileall $(DESTDIR)/$(PACKAGEDIR)/seobject.py
 	-mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR)
 	install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/semanage
 
diff --git a/python/sepolgen/src/sepolgen/Makefile b/python/sepolgen/src/sepolgen/Makefile
index cac8def7204e..95a9d41571e7 100644
--- a/python/sepolgen/src/sepolgen/Makefile
+++ b/python/sepolgen/src/sepolgen/Makefile
@@ -8,6 +8,7 @@  all:
 install: all
 	-mkdir -p $(DESTDIR)$(PACKAGEDIR)
 	install -m 644 *.py $(DESTDIR)$(PACKAGEDIR)
+	$(PYTHON) -m compileall $(DESTDIR)$(PACKAGEDIR)
 
 clean:
 	rm -f parser.out parsetab.py