Changeset 391 for python/trunk/Lib/plat-mac/bundlebuilder.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/plat-mac/bundlebuilder.py
r2 r391 246 246 """ 247 247 248 if USE_ZIPIMPORT: 249 ZIP_ARCHIVE = "Modules.zip" 250 SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE 251 252 253 254 255 248 ZIP_ARCHIVE = "Modules.zip" 249 SITE_PY_ZIP = SITE_PY + ("sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE) 250 251 def getPycData(fullname, code, ispkg): 252 if ispkg: 253 fullname += ".__init__" 254 path = fullname.replace(".", os.sep) + PYC_EXT 255 return path, MAGIC + '\0\0\0\0' + marshal.dumps(code) 256 256 257 257 # … … 274 274 """ 275 275 276 MAYMISS_MODULES = [' mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath',276 MAYMISS_MODULES = ['os2', 'nt', 'ntpath', 'dos', 'dospath', 277 277 'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize', 278 278 'org.python.core', 'riscos', 'riscosenviron', 'riscospath' … … 302 302 mainprogram = os.path.join(resdir, "%(mainprogram)s") 303 303 304 if %(optimize)s: 305 sys.argv.insert(1, '-O') 306 304 307 sys.argv.insert(1, mainprogram) 305 308 if %(standalone)s or %(semi_standalone)s: … … 312 315 pypath = ":" + pypath 313 316 os.environ["PYTHONPATH"] = resdir + pypath 317 314 318 os.environ["PYTHONEXECUTABLE"] = executable 315 319 os.environ["DYLD_LIBRARY_PATH"] = libdir … … 349 353 350 354 class AppBuilder(BundleBuilder): 355 356 use_zipimport = USE_ZIPIMPORT 351 357 352 358 # Override type of the bundle. … … 484 490 self.includeModules.append("argvemulator") 485 491 self.includeModules.append("os") 486 if not self.plist.has_key("CFBundleDocumentTypes"):492 if "CFBundleDocumentTypes" not in self.plist: 487 493 self.plist["CFBundleDocumentTypes"] = [ 488 494 { "CFBundleTypeOSTypes" : [ … … 506 512 standalone = self.standalone 507 513 semi_standalone = self.semi_standalone 514 optimize = sys.flags.optimize 508 515 open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) 509 516 os.chmod(bootstrappath, 0775) … … 552 559 553 560 def _getSiteCode(self): 554 return compile(SITE_PY % {"semi_standalone": self.semi_standalone}, 561 if self.use_zipimport: 562 return compile(SITE_PY % {"semi_standalone": self.semi_standalone}, 555 563 "<-bundlebuilder.py->", "exec") 556 564 … … 558 566 self.message("Adding Python modules", 1) 559 567 560 if USE_ZIPIMPORT:568 if self.use_zipimport: 561 569 # Create a zip file containing all modules as pyc. 562 570 import zipfile … … 624 632 import modulefinder 625 633 mf = modulefinder.ModuleFinder(excludes=self.excludeModules) 626 if USE_ZIPIMPORT:634 if self.use_zipimport: 627 635 # zipimport imports zlib, must add it manually 628 636 mf.import_hook("zlib") … … 658 666 pathitems = name.split(".")[:-1] + [filename] 659 667 dstpath = pathjoin(*pathitems) 660 if USE_ZIPIMPORT:668 if self.use_zipimport: 661 669 if name != "zlib": 662 670 # neatly pack all extension modules in a subdirectory, … … 672 680 if mod.__code__ is not None: 673 681 ispkg = mod.__path__ is not None 674 if not USE_ZIPIMPORTor name != "site":682 if not self.use_zipimport or name != "site": 675 683 # Our site.py is doing the bootstrapping, so we must 676 # include a real .pyc file if USE_ZIPIMPORTis True.684 # include a real .pyc file if self.use_zipimport is True. 677 685 self.pymodules.append((name, mod.__code__, ispkg)) 678 686 … … 820 828 an installed Python, yet includes all third-party 821 829 modules. 830 --no-zipimport Do not copy code into a zip file 822 831 --python=FILE Python to use in #! line in stead of current Python 823 832 --lib=FILE shared library or framework to be copied into … … 847 856 "link-exec", "help", "verbose", "quiet", "argv", "standalone", 848 857 "exclude=", "include=", "package=", "strip", "iconfile=", 849 "lib=", "python=", "semi-standalone", "bundle-id=", "destroot=") 858 "lib=", "python=", "semi-standalone", "bundle-id=", "destroot=" 859 "no-zipimport" 860 ) 850 861 851 862 try: … … 911 922 elif opt == '--destroot': 912 923 builder.destroot = arg 924 elif opt == '--no-zipimport': 925 builder.use_zipimport = False 913 926 914 927 if len(args) != 1:
Note:
See TracChangeset
for help on using the changeset viewer.