[Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.28,1.29

jvr@users.sourceforge.net jvr@users.sourceforge.net
Fri, 20 Jun 2003 14:18:24 -0700


Update of /cvsroot/python/python/dist/src/Lib/plat-mac
In directory sc8-pr-cvs1:/tmp/cvs-serv4278

Modified Files:
	bundlebuilder.py 
Log Message:
Reworked --strip option: it will now look at _any_ file that's marked
executable in the bundle. Therefore got rid of the "binaries" attribute.


Index: bundlebuilder.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** bundlebuilder.py	20 Jun 2003 20:05:40 -0000	1.28
--- bundlebuilder.py	20 Jun 2003 21:18:22 -0000	1.29
***************
*** 364,368 ****
      includePackages = []
  
!     # Strip binaries.
      strip = 0
  
--- 364,368 ----
      includePackages = []
  
!     # Strip binaries from debug info.
      strip = 0
  
***************
*** 374,380 ****
      maybeMissingModules = []
  
-     # List of all binaries (executables or shared libs), for stripping purposes
-     binaries = []
- 
      def setup(self):
          if self.standalone and self.mainprogram is None:
--- 374,377 ----
***************
*** 426,430 ****
              if not self.symlink_exec:
                  self.files.append((self.executable, execpath))
-                 self.binaries.append(execpath)
              self.execpath = execpath
  
--- 423,426 ----
***************
*** 503,508 ****
              src = pathjoin(frameworkpath, item)
              dst = pathjoin(destbase, item)
-             if item == "Python":
-                 self.binaries.append(dst)
              self.files.append((src, dst))
  
--- 499,502 ----
***************
*** 547,556 ****
                  "%s" % STRIP_EXEC, 0)
          else:
              self.message("Stripping binaries", 1)
!             for relpath in self.binaries:
!                 self.message("Stripping %s" % relpath, 2)
!                 abspath = pathjoin(self.bundlepath, relpath)
!                 if not os.path.islink(abspath):
!                     rv = os.system("%s -S \"%s\"" % (STRIP_EXEC, abspath))
  
      def findDependencies(self):
--- 541,568 ----
                  "%s" % STRIP_EXEC, 0)
          else:
+             import stat
              self.message("Stripping binaries", 1)
!             def walk(top):
!                 for name in os.listdir(top):
!                     path = pathjoin(top, name)
!                     if os.path.islink(path):
!                         continue
!                     if os.path.isdir(path):
!                         walk(path)
!                     else:
!                         mod = os.stat(path)[stat.ST_MODE]
!                         if not (mod & 0100):
!                             continue
!                         relpath = path[len(self.bundlepath):]
!                         self.message("Stripping %s" % relpath, 2)
!                         inf, outf = os.popen4("%s -S \"%s\"" %
!                                               (STRIP_EXEC, path))
!                         output = outf.read().strip()
!                         if output:
!                             # usually not a real problem, like when we're
!                             # trying to strip a script
!                             self.message("Problem stripping %s:" % relpath, 3)
!                             self.message(output, 3)
!             walk(self.bundlepath)
  
      def findDependencies(self):
***************
*** 599,603 ****
                      dstpath = pathjoin("Contents", "Resources", *dstpath)
                  self.files.append((path, dstpath))
-                 self.binaries.append(dstpath)
              if mod.__code__ is not None:
                  ispkg = mod.__path__ is not None
--- 611,614 ----