Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/plat-mac/bundlebuilder.py

    r2 r391  
    246246"""
    247247
    248 if USE_ZIPIMPORT:
    249     ZIP_ARCHIVE = "Modules.zip"
    250     SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE
    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)
     248ZIP_ARCHIVE = "Modules.zip"
     249SITE_PY_ZIP = SITE_PY + ("sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE)
     250
     251def 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)
    256256
    257257#
     
    274274"""
    275275
    276 MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath',
     276MAYMISS_MODULES = ['os2', 'nt', 'ntpath', 'dos', 'dospath',
    277277    'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize',
    278278    'org.python.core', 'riscos', 'riscosenviron', 'riscospath'
     
    302302mainprogram = os.path.join(resdir, "%(mainprogram)s")
    303303
     304if %(optimize)s:
     305    sys.argv.insert(1, '-O')
     306
    304307sys.argv.insert(1, mainprogram)
    305308if %(standalone)s or %(semi_standalone)s:
     
    312315        pypath = ":" + pypath
    313316    os.environ["PYTHONPATH"] = resdir + pypath
     317
    314318os.environ["PYTHONEXECUTABLE"] = executable
    315319os.environ["DYLD_LIBRARY_PATH"] = libdir
     
    349353
    350354class AppBuilder(BundleBuilder):
     355
     356    use_zipimport = USE_ZIPIMPORT
    351357
    352358    # Override type of the bundle.
     
    484490                    self.includeModules.append("argvemulator")
    485491                    self.includeModules.append("os")
    486                 if not self.plist.has_key("CFBundleDocumentTypes"):
     492                if "CFBundleDocumentTypes" not in self.plist:
    487493                    self.plist["CFBundleDocumentTypes"] = [
    488494                        { "CFBundleTypeOSTypes" : [
     
    506512            standalone = self.standalone
    507513            semi_standalone = self.semi_standalone
     514            optimize = sys.flags.optimize
    508515            open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals())
    509516            os.chmod(bootstrappath, 0775)
     
    552559
    553560    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},
    555563                     "<-bundlebuilder.py->", "exec")
    556564
     
    558566        self.message("Adding Python modules", 1)
    559567
    560         if USE_ZIPIMPORT:
     568        if self.use_zipimport:
    561569            # Create a zip file containing all modules as pyc.
    562570            import zipfile
     
    624632        import modulefinder
    625633        mf = modulefinder.ModuleFinder(excludes=self.excludeModules)
    626         if USE_ZIPIMPORT:
     634        if self.use_zipimport:
    627635            # zipimport imports zlib, must add it manually
    628636            mf.import_hook("zlib")
     
    658666                pathitems = name.split(".")[:-1] + [filename]
    659667                dstpath = pathjoin(*pathitems)
    660                 if USE_ZIPIMPORT:
     668                if self.use_zipimport:
    661669                    if name != "zlib":
    662670                        # neatly pack all extension modules in a subdirectory,
     
    672680            if mod.__code__ is not None:
    673681                ispkg = mod.__path__ is not None
    674                 if not USE_ZIPIMPORT or name != "site":
     682                if not self.use_zipimport or name != "site":
    675683                    # Our site.py is doing the bootstrapping, so we must
    676                     # include a real .pyc file if USE_ZIPIMPORT is True.
     684                    # include a real .pyc file if self.use_zipimport is True.
    677685                    self.pymodules.append((name, mod.__code__, ispkg))
    678686
     
    820828                         an installed Python, yet includes all third-party
    821829                         modules.
     830      --no-zipimport     Do not copy code into a zip file
    822831      --python=FILE      Python to use in #! line in stead of current Python
    823832      --lib=FILE         shared library or framework to be copied into
     
    847856        "link-exec", "help", "verbose", "quiet", "argv", "standalone",
    848857        "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        )
    850861
    851862    try:
     
    911922        elif opt == '--destroot':
    912923            builder.destroot = arg
     924        elif opt == '--no-zipimport':
     925            builder.use_zipimport = False
    913926
    914927    if len(args) != 1:
Note: See TracChangeset for help on using the changeset viewer.