changeset 3786:72c5ff3fddd9

Silence installer: Darwin.rewirer and map_command_dir to oslog.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Mon, 10 Sep 2007 10:39:52 +0200
parents 50be8f231c13
children 17fec0a42c33
files bin/cygwin-packager gub/darwin.py gub/installer.py gub/misc.py
diffstat 4 files changed, 34 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/bin/cygwin-packager	Mon Sep 10 10:38:52 2007 +0200
+++ b/bin/cygwin-packager	Mon Sep 10 10:39:52 2007 +0200
@@ -188,12 +188,14 @@
         return readme
 
     def strip_dir (self, dir):
-        misc.map_command_dir (self.expand (dir),
+        misc.map_command_dir (self,
+                              self.expand (dir),
                               self.expand ('%(strip_command)s'),
                               self.no_binary_strip,
                               (self.no_binary_strip_extensions
                                + self.binary_debug_strip_extensions))
-        misc.map_command_dir (self.expand (dir),
+        misc.map_command_dir (self,
+                              self.expand (dir),
                               self.expand ('%(strip_command)s -g'),
                               self.no_binary_strip,
                               self.no_binary_strip_extensions)
--- a/gub/darwin.py	Mon Sep 10 10:38:52 2007 +0200
+++ b/gub/darwin.py	Mon Sep 10 10:39:52 2007 +0200
@@ -15,11 +15,11 @@
         lib_str = self.read_pipe ('''
 %(cross_prefix)s/bin/%(target_architecture)s-otool -L %(name)s
 ''',
-                     locals (), ignore_errors=True)
+                                  locals (), ignore_errors=True)
 
         libs = []
-        for l in lib_str.split ('\n'):
-            m = re.search (r"\s+(.*) \(.*\)", l)
+        for i in lib_str.split ('\n'):
+            m = re.search (r'\s+(.*) \(.*\)', i)
             if not m:
                 continue
             if self.ignore_libs.has_key (m.group (1)):
@@ -33,7 +33,7 @@
         if not substitutions:
             return
         changes = ' '.join (['-change %s %s' % (o, d)
-                  for (o, d) in substitutions])
+                             for (o, d) in substitutions])
         self.system ('''
 %(cross_prefix)s/bin/%(target_architecture)s-install_name_tool %(changes)s %(name)s ''',
               locals ())
@@ -43,20 +43,22 @@
 
         libs = self.get_libaries (name)
         subs = []
-        for l in libs:
+        for i in libs:
 
+            # FIXME: I do not understand this comment
             ## ignore self.
-            print os.path.split (l)[1], os.path.split (name)[1]
+            self.os_interface.action (os.path.split (i)[1] + ' '
+                                      + os.path.split (name)[1] + '\n')
 
-            if os.path.split (l)[1] == os.path.split (name)[1]:
+            if os.path.split (i)[1] == os.path.split (name)[1]:
                 continue
 
             for o in orig_libs:
-                if re.search (o, l):
-                    newpath = re.sub (o, '@executable_path/../lib/', l);
-                    subs.append ((l, newpath))
-                elif l.find (self.expand ('%(targetdir)s')) >= 0:
-                    print 'found targetdir in linkage', l
+                if re.search (o, i):
+                    newpath = re.sub (o, '@executable_path/../lib/', i);
+                    subs.append ((i, newpath))
+                elif i.find (self.expand ('%(targetdir)s')) >= 0:
+                    print 'found targetdir in linkage', i
                     raise 'abort'
 
         self.rewire_mach_o_object (name, subs)
@@ -76,7 +78,7 @@
                 continue
 
             if os.path.isfile (f):
-                self.rewire_mach_o_object_executable_path(f)
+                self.rewire_mach_o_object_executable_path (f)
 
     def set_ignore_libs_from_tarball (self, tarball):
         file_str = self.read_pipe ('tar tzf %(tarball)s', locals())
@@ -84,7 +86,7 @@
         self.set_ignore_libs_from_files (files)
 
     def set_ignore_libs_from_files (self, files):
-        self.ignore_libs = dict ((k.strip()[1:], True)
+        self.ignore_libs = dict ((k.strip ()[1:], True)
              for k in files
              if re.match (r'^\./usr/lib/', k))
 
@@ -160,11 +162,11 @@
         if os.system (s):
             raise 'barf'
 
-    host  = 'maagd'
+    host = 'maagd'
     version = '0.4'
     darwin_version  = 8
 
-    dest =        'darwin%(darwin_version)d-sdk-%(version)s' % locals()
+    dest = 'darwin%(darwin_version)d-sdk-%(version)s' % locals()
 
     system ('rm -rf %s' % dest)
     os.mkdir (dest)
@@ -176,10 +178,10 @@
     else:
         src += 'MacOSX10.4u.sdk'
 
-    cmd =  ('rsync -a -v %s:%s/ %s/ ' % (host, src, dest))
+    cmd =  ('rsync -a -v %s:%s/ %s/' % (host, src, dest))
     system (cmd)
-    system ('chmod -R +w %s '  % dest)
-    system ('tar cfz %s.tar.gz %s '  % (dest, dest))
+    system ('chmod -R +w %s' % dest)
+    system ('tar cfz %s.tar.gz %s' % (dest, dest))
 
 if __name__== '__main__':
     import sys
--- a/gub/installer.py	Mon Sep 10 10:38:52 2007 +0200
+++ b/gub/installer.py	Mon Sep 10 10:39:52 2007 +0200
@@ -166,7 +166,8 @@
 
     def strip_dir (self, dir):
         from gub import misc
-        misc.map_command_dir (self.expand (dir),
+        misc.map_command_dir (self,
+                              self.expand (dir),
                               self.expand ('%(strip_command)s'),
                               self.no_binary_strip,
                               self.no_binary_strip_extensions)
@@ -385,6 +386,6 @@
     }
 
     ctor = installer_class[settings.platform]
-    print ctor
-    installer = ctor(settings, name)
+    print 'Installer:', ctor
+    installer = ctor (settings, name)
     return installer
--- a/gub/misc.py	Mon Sep 10 10:38:52 2007 +0200
+++ b/gub/misc.py	Mon Sep 10 10:39:52 2007 +0200
@@ -221,7 +221,9 @@
     import stat
     return os.stat (path)[stat.ST_MTIME]
 
-def map_command_dir (dir, command, filter_out=[], extension_filter_out=[]):
+# Move to Os_commands?
+def map_command_dir (os_commands, dir, command,
+                     filter_out=[], extension_filter_out=[]):
     import os
     if not os.path.isdir (dir):
         raise ('warning: no such dir: %(dir)s' % locals ())
@@ -229,8 +231,8 @@
     for file in files:
         if (os.path.basename (file) not in filter_out
           and (os.path.splitext (file)[1] not in extension_filter_out)):
-            system ('%(command)s %(root)s/%(file)s' % locals (),
-                    ignore_errors=True)
+            os_commands.system ('%(command)s %(root)s/%(file)s' % locals (),
+                                ignore_errors=True)
 
 def map_dir (func, dir):
     if not os.path.isdir (dir):