LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File mftrace-python-compile.patch of Package mftrace (Project graphics)

The timestamp embedded in the python bytecode file (mtime of
original source in 2006) isn't equal to the mtime of the installed
source file (now), which will force the interpreter to recompile
the .py source every time, ignoring the saved bytecode.

This patch should fix it by moving compilation to the install
phase.

Index: mftrace-1.2.17/GNUmakefile.in
===================================================================
--- mftrace-1.2.17.orig/GNUmakefile.in
+++ mftrace-1.2.17/GNUmakefile.in
@@ -1,7 +1,6 @@
 # -*-makefile-*-
 
 PY_MODULES= afm.py tfm.py
-PYC_MODULES = $(PY_MODULES:%=%c)
 FILES= mftrace.py GNUmakefile.in \
 	gf2pbm.c mftrace.1 \
 	COPYING \
@@ -65,18 +64,16 @@ GNUmakefile: GNUmakefile.in configure
 	./config.status
 	chmod a-w GNUmakefile
 
-%.pyc: %.py
-	$(PYTHON) -c 'import py_compile; py_compile.compile ("$<", cfile="$@")'
-
-install: mftrace gf2pbm $(PYC_MODULES) install-man install-py
+install: mftrace gf2pbm install-man install-py
 	install -d $(DESTDIR)$(bindir) 
 	install mftrace $(DESTDIR)$(bindir)
 	install gf2pbm$(EXEEXT) $(DESTDIR)$(bindir)/gf2pbm$(EXEEXT)
 
 
-install-py: $(PY_MODULES) $(PYC_MODULES) 
+install-py: $(PY_MODULES)
 	install -d $(DESTDIR)$(datadir)
 	install -m644 $^ $(DESTDIR)$(datadir) 
+	$(PYTHON) -m compileall -d $(datadir) $(DESTDIR)$(datadir)
 
 install-man: $(MANPAGES)
 	install -d $(DESTDIR)$(mandir)/man1
@@ -95,7 +92,7 @@ uninstall:
 
 clean:
 	rm -f config.cache config.h config.log config.status GNUmakefile
-	rm -f mftrace gf2pbm $(PYC_MODULES)
+	rm -f mftrace gf2pbm
 	rm -f *'~' '#'*