[jhbuild/wip/packaging: 3/6] Clean .la files post-install



commit fe02b489560b943cb25ee543afddf09b0dd136c7
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 9a511dc..a744392 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -159,6 +159,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."""
@@ -189,6 +200,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]