[jhbuild] Delete all .la files, not just toplevel ones



commit 965c8d5ceda9d1c5d6021ef2c534e0a7f68ca976
Author: Colin Walters <walters verbum org>
Date:   Thu Nov 3 18:22:41 2011 -0400

    Delete all .la files, not just toplevel ones
    
    Just removing the toplevel ones is problematic because ones in
    subdirectories may reference the now-deleted ones.
    
    Fedora seems to be doing fine just deleting them all on a per-module
    basis, so let's try just doing it by default.  No one in GNOME should
    be using libtldl anyways, they should be using GModule.

 jhbuild/modtypes/__init__.py |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index 487855c..55576c8 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -180,25 +180,25 @@ class Package:
         os.makedirs(destdir)
         return destdir
 
+    def _clean_la_files_in_dir(self, buildscript, path):
+        for name in os.listdir(path):
+            subpath = os.path.join(path, name)
+            if os.path.isdir(subpath):
+                self._clean_la_files_in_dir(buildscript, subpath)
+            elif name.endswith('.la'):
+                    try:
+                        logging.info(_('Deleting .la file: %r') % (subpath, ))
+                        os.unlink(subpath)
+                    except OSError:
+                        pass
+
     def _clean_la_files(self, buildscript, installroot):
-        """This method removes .la files from the toplevel lib*/
-        directories.  See bug 654013."""
+        """This method removes all .la files. See bug 654013."""
         assert os.path.isabs(installroot)
         assert os.path.isabs(buildscript.config.prefix)
         prefixdir = os.path.join(installroot, buildscript.config.prefix[1:])
         if os.path.isdir(prefixdir):
-            for name in os.listdir(prefixdir):
-                namepath = os.path.join(prefixdir, name)
-                if not (name.startswith('lib') and os.path.isdir(namepath)):
-                    continue
-                for subname in os.listdir(namepath):
-                    subpath = os.path.join(namepath, subname)
-                    if subname.endswith('.la'):
-                        try:
-                            logging.info(_('Deleting toplevel .la file: %r') % (subpath, ))
-                            os.unlink(subpath)
-                        except OSError:
-                            pass
+            self._clean_la_files_in_dir(self, prefixdir)
 
     def _process_install_files(self, installroot, curdir, prefix):
         """Strip the prefix from all files in the install root, and move



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