[jhbuild] Clean .la files post-install



commit 841b7fa188137d29ef81ff8f98d93c66704736ca
Author: Colin Walters <walters verbum org>
Date:   Thu Apr 28 22:11:32 2011 -0400

    Clean .la files post-install
    
    These do not serve any useful purpose (supposing one's software system
    supports "uninstall"), and are actively harmful in other scenarios; see
    https://live.gnome.org/GnomeShell/RemovingLaFiles
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647231

 jhbuild/modtypes/__init__.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index 702000d..3d10e47 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -158,6 +158,17 @@ class Package:
         os.makedirs(destdir)
         return destdir
 
+    def _clean_la_files(self, installroot):
+        assert os.path.isabs(installroot)
+        files = os.listdir(installroot)
+        for name in files:
+            path = os.path.join(installroot, name)
+            if name.endswith('.la'):
+                print "Deleting %r" % (path, )
+                os.unlink(path)
+            elif os.path.isdir(path):
+                self._clean_la_files(path)
+
     def _process_install_files(self, installroot, curdir, prefix):
         """Strip the prefix from all files in the install root, and move
 them into the prefix."""
@@ -188,6 +199,7 @@ them into the prefix."""
     def process_install(self, buildscript, revision):
         assert self.supports_install_destdir
         destdir = self._get_destdir(buildscript)
+        self._clean_la_files(destdir)
         buildscript.packagedb.add(self.name, revision or '', destdir)
         self._process_install_files(destdir, destdir, buildscript.config.prefix)
         try:



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