selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Iooss <nicolas.iooss@m4x.org>
To: selinux@vger.kernel.org
Subject: [PATCH 3/4] python: compile Python bytecode when installing Python files
Date: Sat,  2 Nov 2019 18:28:11 +0100	[thread overview]
Message-ID: <20191102172812.22492-3-nicolas.iooss@m4x.org> (raw)
In-Reply-To: <20191102172812.22492-1-nicolas.iooss@m4x.org>

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 --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
-- 
2.23.0


  parent reply	other threads:[~2019-11-02 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02 17:28 [PATCH 1/4] libselinux: compile Python bytecode when installing Python files Nicolas Iooss
2019-11-02 17:28 ` [PATCH 2/4] libsemanage: " Nicolas Iooss
2019-11-02 17:28 ` Nicolas Iooss [this message]
2019-11-02 17:28 ` [PATCH 4/4] gui: " Nicolas Iooss
2019-11-02 20:18 ` [PATCH 1/4] libselinux: " Thomas Petazzoni
2019-11-03 20:57   ` Nicolas Iooss
2019-11-09 15:55     ` Nicolas Iooss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191102172812.22492-3-nicolas.iooss@m4x.org \
    --to=nicolas.iooss@m4x.org \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).