[gnome-ostree] ostbuild: Don't ship .pyc, .pyo files



commit a2269f4f4c37d8f06a90b4b263530aaa5cd60664
Author: Colin Walters <walters verbum org>
Date:   Wed Jun 20 08:23:14 2012 -0400

    ostbuild: Don't ship .pyc, .pyo files
    
    They contain embedded timestamps which means they change at every
    build.  This bloats diffs unnecessarily.

 src/ostbuild/pyostbuild/builtin_compile_one.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_compile_one.py b/src/ostbuild/pyostbuild/builtin_compile_one.py
index aa5fc84..33d5981 100755
--- a/src/ostbuild/pyostbuild/builtin_compile_one.py
+++ b/src/ostbuild/pyostbuild/builtin_compile_one.py
@@ -30,6 +30,10 @@ from .subprocess_helpers import run_sync, run_sync_get_output
 
 PREFIX = '/usr'
 
+# Applied to filenames only
+_IGNORE_FILENAME_REGEXPS = map(re.compile,
+                               [r'.*\.py[co]$'])
+
 _DOC_DIRS = ['usr/share/doc',
              'usr/share/gtk-doc',
              'usr/share/man',
@@ -260,6 +264,16 @@ class OstbuildCompileOne(builtins.Builtin):
                 self._install_and_unlink(src_child, dest_child)
             os.rmdir(src)
         else:
+            basename = os.path.basename(src)
+            ignored = False
+            for r in _IGNORE_FILENAME_REGEXPS:
+                if r.match(basename):
+                    ignored = True
+                    break
+            if ignored:
+                log("Not installing %s" % (src, ))
+                os.unlink(src)
+                return
             try:
                 os.rename(src, dest)
             except OSError, e:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]