rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
msgid = factory('43-not-there', 'this ${that} the other') msgid.mapping["that"] = "THAT" | msgid = factory('43-not-there', 'this ${that} the other', mapping={'that': 'THAT'}) | def testMessageIDTranslate(self): factory = MessageFactory('default') translate = self._domain.translate msgid = factory(u'short_greeting', 'default') self.assertEqual(translate(msgid, target_language='en'), u'Hello!') # MessageID attributes override arguments msgid = factory('43-not-there', 'this ${that} the other') m... |
from zope.component import queryUtility | def _translate(msgid, domain=None, mapping=None, context=None, target_language=None, default=None): if isinstance(msgid, MessageID): domain = msgid.domain default = msgid.default mapping = msgid.mapping # XXX we shouldn't need this import here from zope.component import queryUtility util = queryUtility(ITranslationD... | |
self._data = parseXML(path).firstChild | self._data = parseXML(path).documentElement | def __init__(self, path): """Initialize factory.""" self._path = path self._data = parseXML(path).firstChild |
except AttributeError, KeyError: | except (AttributeError, KeyError): | def getTimeFormatter(self, name): "See ZopeProducts.LocaleProvider.interfaces.ILocale" try: pattern = self.getDefaultCalendar().timePatterns[name] except AttributeError, KeyError: return self._getNextLocale().getTimeFormatter(name) return DateTimeFormat(pattern, self._createFullCalendar()) |
except AttributeError, KeyError: | except (AttributeError, KeyError): | def getNumberFormatter(self, name): "See ZopeProducts.LocaleProvider.interfaces.ILocale" try: pattern = self.getDefaultNumberFormat().patterns[name] except AttributeError, KeyError: return self._getNextLocale().getNumberFormatter(name) symbols = {} for id in ((None, None, None), (self.id.language, None, None), (self.id... |
symbols = {u'decimal': u'.', u'group': u',', u'list': u';', u'percentSign': u'%', u'nativeZeroDigit': u'0', u'patternDigit': u' u'plusSign': u'+', u'minusSign': u'-', u'exponential': u'E', u'perMille': u'\xe2\x88\x9e', u'infinity': u'\xef\xbf\xbd', u'nan': ''} | def format(self, obj, pattern=None): "See zope.i18n.interfaces.IFormat" # Make or get binary form of datetime pattern if pattern is not None: bin_pattern = parseDateTimePattern(pattern) else: bin_pattern = self._bin_pattern | |
except AttributeError, KeyError: | except (AttributeError, KeyError): | def getDateFormatter(self, name): "See ZopeProducts.LocaleProvider.interfaces.ILocale" try: pattern = self.getDefaultCalendar().datePatterns[name] except AttributeError, KeyError: return self._getNextLocale().getDateFormatter(name) return DateTimeFormat(pattern, self._createFullCalendar()) |
except AttributeError, KeyError: | except (AttributeError, KeyError): | def getDateTimeFormatter(self, name): "See ZopeProducts.LocaleProvider.interfaces.ILocale" try: pattern = self.getDefaultCalendar().datetimePattern except AttributeError, KeyError: return self._getNextLocale().getDateTimeFormatter(name) date_pat = self.getDateFormatter(name).getPattern() time_pat = self.getTimeFormatte... |
except AttributeError, KeyError: | except (AttributeError, KeyError): | def getNumberFormatter(self, name): "See ZopeProducts.LocaleProvider.interfaces.ILocale" try: pattern = self.getDefaultNumberFormat().patterns[name] except AttributeError, KeyError: return self._getNextLocale().getNumberFormatter(name) symbols = {} for id in ((None, None, None), (self.id.language, None, None), (self.id... |
if default is None: default = msgid | def _translate(msgid, domain=None, mapping=None, context=None, target_language=None, default=None): if isinstance(msgid, (MessageID, Message)): domain = msgid.domain default = msgid.default if default is None: default = msgid mapping = msgid.mapping util = queryUtility(ITranslationDomain, domain) if util is None: re... | |
templates.add(get_comexe_template()) | templates.add(self.get_comexe_template()) | def find_dependend_dlls(self, dlls, pypath, dll_excludes): import py2exe_util sysdir = py2exe_util.get_sysdir() windir = py2exe_util.get_windir() # This is the tail of the path windows uses when looking for dlls # XXX On Windows NT, the SYSTEM directory is also searched exedir = os.path.dirname(sys.executable) syspath ... |
templates.add(get_comexe_template()) | templates.add(self.get_comdll_template()) | def find_dependend_dlls(self, dlls, pypath, dll_excludes): import py2exe_util sysdir = py2exe_util.get_sysdir() windir = py2exe_util.get_windir() # This is the tail of the path windows uses when looking for dlls # XXX On Windows NT, the SYSTEM directory is also searched exedir = os.path.dirname(sys.executable) syspath ... |
suffix = os.path.splitext(src)[1] | base, ext = os.path.splitext(src) suffix = ext if sys.platform.startswith("win") and ext in [".dll", ".pyd"] \ and base.endswith("_d"): suffix = "_d" + ext | def parse_mf_results(self, mf): for name, imports in self.get_hidden_imports().items(): if name in mf.modules.keys(): for mod in imports: mf.import_hook(mod) |
print "common Boot script" | def fake_getline(filename, lineno): return '' | |
if _logfile: _logfile.write("(IM)_import_top_module(%s)\n" % name) | def _import_top_module(self, name): if _logfile: _logfile.write("(IM)_import_top_module(%s)\n" % name) # scan sys.path looking for a location in the filesystem that contains # the module, or an Importer object that can import the module. for item in sys.importers + sys.path: if isinstance(item, _StringType): module = s... | |
if _logfile: _logfile.write("(IM)_import_top_module -> %s\n\n" % module) | def _import_top_module(self, name): if _logfile: _logfile.write("(IM)_import_top_module(%s)\n" % name) # scan sys.path looking for a location in the filesystem that contains # the module, or an Importer object that can import the module. for item in sys.importers + sys.path: if isinstance(item, _StringType): module = s... | |
if _logfile: _logfile.write("(IM)_import_top_module -> None\n\n") | def _import_top_module(self, name): if _logfile: _logfile.write("(IM)_import_top_module(%s)\n" % name) # scan sys.path looking for a location in the filesystem that contains # the module, or an Importer object that can import the module. for item in sys.importers + sys.path: if isinstance(item, _StringType): module = s... | |
if _logfile: _logfile.write("get_code(%s, %s, %s)\n" % \ (`parent`, `modname`, `fqname`)) | def get_code(self, parent, modname, fqname, get_code=get_code): # Usually 'parent', if not None, defines a context for # importing. In the normal python import mechanism, parent.__path__ # is a list containing the package directory. # Beware: There seem to be some unusual uses of this (See win32com.__init__) # In Greg ... | |
if _logfile: _logfile.write("return 1, imp.load_module(%s, %s, %s)\n\n" % \ (`fqname`, `pathname`, `desc`)) | def get_code(self, parent, modname, fqname, get_code=get_code): # Usually 'parent', if not None, defines a context for # importing. In the normal python import mechanism, parent.__path__ # is a list containing the package directory. # Beware: There seem to be some unusual uses of this (See win32com.__init__) # In Greg ... | |
if _logfile: _logfile.write("return 0, marshal.loads(%s)\n\n" % name) | def get_code(self, parent, modname, fqname, get_code=get_code): # Usually 'parent', if not None, defines a context for # importing. In the normal python import mechanism, parent.__path__ # is a list containing the package directory. # Beware: There seem to be some unusual uses of this (See win32com.__init__) # In Greg ... | |
if _logfile: _logfile.write("FAILED\n\n") | def get_code(self, parent, modname, fqname, get_code=get_code): # Usually 'parent', if not None, defines a context for # importing. In the normal python import mechanism, parent.__path__ # is a list containing the package directory. # Beware: There seem to be some unusual uses of this (See win32com.__init__) # In Greg ... | |
if _logfile: _logfile.write("return 1, marshal.loads(%s)\n\n" % name) | def get_code(self, parent, modname, fqname, get_code=get_code): # Usually 'parent', if not None, defines a context for # importing. In the normal python import mechanism, parent.__path__ # is a list containing the package directory. # Beware: There seem to be some unusual uses of this (See win32com.__init__) # In Greg ... | |
"create and show a module crosss reference") | "create and show a module cross reference"), ("single-file", 's', "create a single-file executable (well, two files at least;-)"), | for target_def in targets: if type(target_def) in types.StringTypes : # Create a default target object, with the string as the attribute target = Target(**{default_attribute: target_def}) else: d = getattr(target_def, "__dict__", target_def) if not d.has_key(default_attribute): raise DistutilsOptionError, \ "This targe... |
boolean_options = ["compressed", "xref"] | boolean_options = ["compressed", "xref", "single-file"] | for target_def in targets: if type(target_def) in types.StringTypes : # Create a default target object, with the string as the attribute target = Target(**{default_attribute: target_def}) else: d = getattr(target_def, "__dict__", target_def) if not d.has_key(default_attribute): raise DistutilsOptionError, \ "This targe... |
dst = os.path.join(self.lib_dir, os.path.basename(item.__file__)) self.copy_file(src, dst) self.lib_files.append(dst) | if not self.single_file: dst = os.path.join(self.lib_dir, os.path.basename(item.__file__)) self.copy_file(src, dst) self.lib_files.append(dst) else: dst = os.path.join(self.collect_dir, os.path.basename(src)) self.copy_file(src, dst) compiled_files.append(os.path.basename(dst)) | def create_binaries(self, py_files, extensions, dlls): dist = self.distribution # byte compile the python modules into the target directory print "*** byte compile python files ***" compiled_files = byte_compile(py_files, target_dir=self.collect_dir, optimize=self.optimize, force=0, verbose=self.verbose, dry_run=self.... |
print "*** copy dlls ***" | self.announce("*** copy dlls ***") | def create_binaries(self, py_files, extensions, dlls): dist = self.distribution # byte compile the python modules into the target directory print "*** byte compile python files ***" compiled_files = byte_compile(py_files, target_dir=self.collect_dir, optimize=self.optimize, force=0, verbose=self.verbose, dry_run=self.... |
loader = self.create_loader(item) if loader: py_files.append(loader) | if not self.single_file: loader = self.create_loader(item) if loader: py_files.append(loader) | def parse_mf_results(self, mf): for name, imports in self.get_hidden_imports().items(): if name in mf.modules.keys(): for mod in imports: mf.import_hook(mod) |
return | return None | def create_loader(self, item): # Hm, how to avoid needless recreation of this file? pathname = os.path.join(self.temp_dir, "%s.py" % item.__name__) # and what about dry_run? if self.verbose: print "creating python loader for extension '%s'" % item.__name__ |
self.packages.append("encodings") self.includes.append("codecs") if self.single_file: self.includes.append("zipextimporter") self.excludes.append("_memimporter") | def plat_prepare(self): self.includes.append("warnings") # needed by Python itself | |
print "\t%s - %s" % (os.path.basename(fnm), fnm) | print " ", os.path.basename(fnm), "-", fnm.strip() | def my_compile(source, filename, *args): try: result = orig_compile(source, filename, *args) except Exception, details: raise DistutilsError, "compiling '%s' failed\n %s: %s" % \ (filename, details.__class__.__name__, details) return result |
from modulefinder import ModuleFinder, ReplacePackage | from modulefinder import ReplacePackage from py2exe.mf import ModuleFinder | def create_modulefinder(self): from modulefinder import ModuleFinder, ReplacePackage ReplacePackage("_xmlplus", "xml") |
from py2exe.mf import ModuleFinder | def create_modulefinder(self): from modulefinder import ModuleFinder, ReplacePackage ReplacePackage("_xmlplus", "xml") | |
package = ".".join(item.__name__.split(".")[:-1]) | package = "\\".join(item.__name__.split(".")[:-1]) | def copy_extensions(self, extensions): print "*** copy extensions ***" # copy the extensions to the target directory for item in extensions: src = item.__file__ if self.bundle_files > 2: # don't bundle pyds and dlls # XXX all dlls are copied into the same directory - a flat name space. # sooner or later that will give ... |
mf = ModuleFinder(excludes=self.excludes) | mf = self.create_modulefinder() | def run(self): self.create_directories() self.plat_prepare() self.fixup_distribution() |
replacePackageMap = {} | from modulefinder import replacePackageMap | def AddPackagePath(packagename, path): paths = packagePathMap.get(packagename, []) paths.append(path) packagePathMap[packagename] = paths |
linker = self.compiler.link_executable else: linker = self.compiler.link_shared_lib linker( objects, exe_filename, libraries=self.get_libraries(inter), library_dirs=inter.library_dirs, runtime_library_dirs=inter.runtime_library_dirs, extra_postargs=extra_args, debug=self.debug) | self.compiler.link_executable( objects, exe_filename, libraries=self.get_libraries(inter), library_dirs=inter.library_dirs, runtime_library_dirs=inter.runtime_library_dirs, extra_postargs=extra_args, debug=self.debug) else: self.compiler.link_shared_lib( objects, exe_filename, libraries=self.get_libraries(inter), libra... | for undef in inter.undef_macros: macros.append((undef,)) |
extra_link_args=["/NOD:LIBC"], define_macros=[("_WINDOWS", None)], | def _removefiles(self, dstdir, srcdir): # Remove all files in dstdir which are present in srcdir assert dstdir != srcdir if not os.path.isdir(srcdir): return for n in os.listdir(srcdir): name = os.path.join(dstdir, n) if os.path.isfile(name): self.announce("removing '%s'" % name) if not self.dry_run: try: os.remove(nam... | |
["source/run_dll.c", "source/start.c", "source/icon.rc"], libraries=["user32"], extra_link_args=["/NOD:LIBC", "/def:source/run_dll.def"], define_macros=[("ZLIB_DLL", None), ("_WINDOWS", None)], target_desc = "shared_library", ) | ["source/run_dll.c", "source/start.c", "source/icon.rc"], libraries=["user32"], export_symbols=["DllCanUnloadNow,PRIVATE", "DllGetClassObject,PRIVATE", "DllRegisterServer,PRIVATE", "DllUnregisterServer,PRIVATE", ], target_desc = "shared_library", ) | def _removefiles(self, dstdir, srcdir): # Remove all files in dstdir which are present in srcdir assert dstdir != srcdir if not os.path.isdir(srcdir): return for n in os.listdir(srcdir): name = os.path.join(dstdir, n) if os.path.isfile(name): self.announce("removing '%s'" % name) if not self.dry_run: try: os.remove(nam... |
download_url="http://sourceforge.net/project/showfiles.php?group_id=15583&release_id=158217", | download_url="http://sourceforge.net/project/showfiles.php?group_id=15583", | def _removefiles(self, dstdir, srcdir): # Remove all files in dstdir which are present in srcdir assert dstdir != srcdir if not os.path.isdir(srcdir): return for n in os.listdir(srcdir): name = os.path.join(dstdir, n) if os.path.isfile(name): self.announce("removing '%s'" % name) if not self.dry_run: try: os.remove(nam... |
if _check_build_dir(ret, "win32", source_root_name, "build/temp.win32-%s" % sys.winver): | if _check_build_dir(ret, "win32", source_root_name, "build/temp.win32-%s/Release" % sys.winver): | def _get_build_dirs(source_root_name): ret = {} if _check_build_dir(ret, "win32", source_root_name, "build/temp.win32-%s" % sys.winver): pass elif _check_build_dir(ret, "win32", source_root_name, "win32/build"): pass # todo: add com etc maybe? return ret |
path = mf.modules[f].__path__[0] | module = mf.modules[f] if module.__path__ is None: paths = [module.__file__] else: paths = module.__path__ | def visit(arg, dirname, names): if '__init__.py' in names: arg.append(dirname) |
path = imp_find_module(f)[1] | paths = [imp_find_module(f)[1]] | def visit(arg, dirname, names): if '__init__.py' in names: arg.append(dirname) |
os.path.walk(path, visit, packages) for p in packages: if p.startswith(path): package = f + '.' + p[len(path)+1:].replace('\\', '.') mf.import_hook(package, None, ["*"]) | for path in paths: os.path.walk(path, visit, packages) for p in packages: if p.startswith(path): package = f + '.' + p[len(path)+1:].replace('\\', '.') mf.import_hook(package, None, ["*"]) | def visit(arg, dirname, names): if '__init__.py' in names: arg.append(dirname) |
"macpath", | "macpath", "grp", | def plat_prepare(self): # update the self.excludes list to exclude platform specific # modules if sys.platform == "win32": self.excludes += ["os2", "posix", "dos", "mac", "macfs", "macfsn", "macpath", "MACFS", "pwd", "MacOS", "macostools", "EasyDialogs", "termios", "TERMIOS", "java.lang", "org.python.core", "riscos", "... |
"os.path" | "os.path", "Carbon.Folder", "Carbon.Folders", | def plat_prepare(self): # update the self.excludes list to exclude platform specific # modules if sys.platform == "win32": self.excludes += ["os2", "posix", "dos", "mac", "macfs", "macfsn", "macpath", "MACFS", "pwd", "MacOS", "macostools", "EasyDialogs", "termios", "TERMIOS", "java.lang", "org.python.core", "riscos", "... |
self.dlls_in_exedir = ["%s.dll" for name in names] | self.dlls_in_exedir = ["%s.dll" % name for name in names] | def plat_prepare(self): # update the self.excludes list to exclude platform specific # modules if sys.platform == "win32": self.excludes += ["os2", "posix", "dos", "mac", "macfs", "macfsn", "macpath", "MACFS", "pwd", "MacOS", "macostools", "EasyDialogs", "termios", "TERMIOS", "java.lang", "org.python.core", "riscos", "... |
build_ext = self.reinitialize_command('build_ext').force build_ext.force = force | build_ext = self.reinitialize_command('build_ext') build_ext.force = self.force | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
missing = filter(lambda m, e=excludes: m not in e, m.badmodules.keys()) if missing: self.warn("*" * 48) self.warn("* The following modules were not found:") for n in missing: self.warn("* " + n) self.warn("*" * 48) | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return | |
self.service = attrs.pop("com_server", []) self.windows = attrs.pop("com_server", []) self.console = attrs.pop("com_server", []) | self.service = attrs.pop("service", []) self.windows = attrs.pop("windows", []) self.console = attrs.pop("console", []) | def __init__(self, attrs): self.ctypes_com_server = attrs.pop("ctypes_com_server", []) self.com_server = attrs.pop("com_server", []) self.service = attrs.pop("com_server", []) self.windows = attrs.pop("com_server", []) self.console = attrs.pop("com_server", []) self.isapi = attrs.pop("isapi", []) self.zipfile = attrs.p... |
makepy.GenerateFromTypeLibSpec(info, bForDemand = True) | makepy.GenerateFromTypeLibSpec(info, bForDemand = False) | def collect_win32com_genpy(path, typelibs): from modulefinder import Module import win32com, pywintypes from win32com.client import gencache, makepy old_gen_path = win32com.__gen_path__ num = 0 try: win32com.__gen_path__ = path win32com.gen_py.__path__ = [path] gencache.__init__() for info in typelibs: makepy.GenerateF... |
self.dll_excludes = fancy_split(self.dll_excludes) | self.dll_excludes = [x.lower() for x in fancy_split(self.dll_excludes)] | def finalize_options (self): self.optimize = int(self.optimize) self.excludes = fancy_split(self.excludes) self.includes = fancy_split(self.includes) self.ignores = fancy_split(self.ignores) # includes is stronger than excludes for m in self.includes: if m in self.excludes: self.excludes.remove(m) self.packages = fancy... |
def _import_top_module(self, name, _stringtype=type(""), sys=sys): | def _import_top_module(self, name, _stringtypes=_stringtypes, sys=sys): | def _import_top_module(self, name, _stringtype=type(""), sys=sys): for item in sys.importers + sys.path: if isinstance(item, _stringtype): module = self.fs_imp.import_from_dir(item, name) else: module = item.import_top(name) if module: return module return None |
if isinstance(item, _stringtype): module = self.fs_imp.import_from_dir(item, name) | for typ in _stringtypes: if isinstance(item, typ): module = self.fs_imp.import_from_dir(item, name) break | def _import_top_module(self, name, _stringtype=type(""), sys=sys): for item in sys.importers + sys.path: if isinstance(item, _stringtype): module = self.fs_imp.import_from_dir(item, name) else: module = item.import_top(name) if module: return module return None |
"java.lang", "org.python.core", | "java.lang", "org.python.core", "riscos", "riscosenviron", "riscospath", "ce", | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
remove_tree(collect_dir, self.verbose, self.dry_run) | force_remove_tree(collect_dir, self.verbose, self.dry_run) | file.write("def _force_imports():\n") |
remove_tree(self.bdist_dir, self.verbose, self.dry_run) | force_remove_tree(self.bdist_dir, self.verbose, self.dry_run) | file.write("def _force_imports():\n") |
self.copy_file(src, os.path.join(final_dir, dst)) | dst = os.path.join(final_dir, dst) self.copy_file(src, dst) dlls.append(src) | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
self.create_exe(exe_name, arcname, script_path) | ext = os.path.splitext(script)[1] use_runw = ((string.lower(ext) == '.pyw') or self.windows) \ and not self.console self.create_exe(exe_name, arcname, use_runw) | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
version = string.split(sys.version[:3], '.') if self.debug: template = "python%s%s_d.dll" else: template = "python%s%s.dll" pythondll = (template % tuple(version)) searchpath = string.split(os.environ["PATH"], ';') try: windir = os.environ['windir'] except KeyError: pass else: searchpath.extend( \ [os.path.join(windir,... | def copy_additional_files(self, final_dir): # Some python versions (1.5) import the 'exceptions' # module BEFORE we can install our importer. file, pathname, desc = imp.find_module("exceptions") if file: # This module is not builtin file.close() module = Module(name="exceptions", file=pathname) byte_compile([module], t... | |
def create_exe (self, exe_name, arcname, script_name): | def create_exe (self, exe_name, arcname, use_runw): | def create_exe (self, exe_name, arcname, script_name): import struct |
ext = os.path.splitext(script_name)[1] use_runw = ((string.lower(ext) == '.pyw') or self.windows) \ and not self.console if use_runw: self.announce("Creating a GUI application") else: self.announce("Creating a CONSOLE application") | def create_exe (self, exe_name, arcname, script_name): import struct | |
def get_exe_bytes(self, use_runw): | def get_exe_stub(self, use_runw): | def get_exe_bytes(self, use_runw): thismod = sys.modules['distutils.command.py2exe'] directory = os.path.dirname(thismod.__file__) if use_runw: basename = "run_w" else: basename = "run" if self.debug: basename = basename + '_d' fname = os.path.join(directory, basename+'.exe') self.announce("Using stub '%s'" % fname) re... |
fname = os.path.join(directory, basename+'.exe') | return os.path.join(directory, basename+'.exe') def get_exe_bytes(self, use_runw): fname = self.get_exe_stub(use_runw) | def get_exe_bytes(self, use_runw): thismod = sys.modules['distutils.command.py2exe'] directory = os.path.dirname(thismod.__file__) if use_runw: basename = "run_w" else: basename = "run" if self.debug: basename = basename + '_d' fname = os.path.join(directory, basename+'.exe') self.announce("Using stub '%s'" % fname) re... |
print "Adding zlib.pyd to %s" % (arcname,) | print "Adding zlib%s.pyd to %s" % (is_debug_build and "_d" or "", arcname) | def create_binaries(self, py_files, extensions, dlls): dist = self.distribution # byte compile the python modules into the target directory print "*** byte compile python files ***" self.compiled_files = byte_compile(py_files, target_dir=self.collect_dir, optimize=self.optimize, force=0, verbose=self.verbose, dry_run=... |
dlls.add(os.path.join(os.path.dirname(sys.executable), "w9xpopen.exe")) | if is_debug_build: dlls.add(os.path.join(os.path.dirname(sys.executable), "w9xpopen_d.exe")) else: dlls.add(os.path.join(os.path.dirname(sys.executable), "w9xpopen.exe")) | def copy_w9xpopen(self, modules, dlls): # Using popen requires (on Win9X) the w9xpopen.exe helper executable. if "os" in modules.keys() or "popen2" in modules.keys(): dlls.add(os.path.join(os.path.dirname(sys.executable), "w9xpopen.exe")) |
build.run() | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return | |
excludes = ["os2", "posix", "dos", "mac"] | excludes = ["os2", "posix", "dos", "mac", "macfs", "macfsn", "MACFS", "pwd"] | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
self.announce("Search path (debug %s):" % self.debug) | self.announce("Search path is:") | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
byte_compile(py_files, target_dir=collect_dir, optimize=self.optimize, force=self.force, verbose=self.verbose, dry_run=self.dry_run) script_base = os.path.splitext(os.path.basename(script))[0] final_dir = os.path.join(self.dist_dir, script_base) self.mkpath(final_dir) | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return | |
src, dst = self.find_extmodule_paths(ext_module) | src, dst = self.get_extension_filenames(ext_module) | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
for x in missing: pass | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return | |
def find_extmodule_paths(self, ext_module): | def fix_extmodules(self, missing, extensions, path): if not self.debug: return missing, extensions fixed_modules = [] for ext_module in extensions: name = ext_module.__name__ try: file = imp.find_module(name + '_d', path)[1] except ImportError: missing.append(name) else: fixed_modules.append(Module(name=name, file=f... | def find_extmodule_paths(self, ext_module): # if we are buildiing a debug version, we have to insert an # '_d' into the filename just before the extension if self.debug: src = imp.find_module(ext_module.__name__ + '_d')[1] dst = ext_module.__name__ + '_d' # module name else: src = ext_module.__file__ # pathname dst = e... |
src = imp.find_module(ext_module.__name__ + '_d')[1] | def find_extmodule_paths(self, ext_module): # if we are buildiing a debug version, we have to insert an # '_d' into the filename just before the extension if self.debug: src = imp.find_module(ext_module.__name__ + '_d')[1] dst = ext_module.__name__ + '_d' # module name else: src = ext_module.__file__ # pathname dst = e... | |
src = ext_module.__file__ | def find_extmodule_paths(self, ext_module): # if we are buildiing a debug version, we have to insert an # '_d' into the filename just before the extension if self.debug: src = imp.find_module(ext_module.__name__ + '_d')[1] dst = ext_module.__name__ + '_d' # module name else: src = ext_module.__file__ # pathname dst = e... | |
version = (sys.hexversion >> 24), (sys.hexversion >> 16) & 0xff | version = string.split(sys.version[:3], '.') | def copy_additional_files(self, final_dir): # Some python versions (1.5) import the 'exceptions' # module BEFORE we can install our importer. file, pathname, desc = imp.find_module("exceptions") if file: file.close() module = Module(name="exceptions", file=pathname) byte_compile([module], target_dir=final_dir, optimize... |
pythondll = (template % version) | pythondll = (template % tuple(version)) | def copy_additional_files(self, final_dir): # Some python versions (1.5) import the 'exceptions' # module BEFORE we can install our importer. file, pathname, desc = imp.find_module("exceptions") if file: file.close() module = Module(name="exceptions", file=pathname) byte_compile([module], target_dir=final_dir, optimize... |
dlls, unfriendly_dlls = self.find_dependend_dlls(0, dlls, | dlls, unfriendly_dlls = self.find_dependend_dlls(dlls, | def find_dlls(self, extensions): dlls = [item.__file__ for item in extensions] |
def find_dependend_dlls(self, use_runw, dlls, pypath, dll_excludes): | def find_dependend_dlls(self, dlls, pypath, dll_excludes): | def find_dependend_dlls(self, use_runw, dlls, pypath, dll_excludes): import py2exe_util sysdir = py2exe_util.get_sysdir() windir = py2exe_util.get_windir() # This is the tail of the path windows uses when looking for dlls # XXX On Windows NT, the SYSTEM directory is also searched exedir = os.path.dirname(sys.executable... |
images = dlls | images = dlls + [sys.executable] | def find_dependend_dlls(self, use_runw, dlls, pypath, dll_excludes): import py2exe_util sysdir = py2exe_util.get_sysdir() windir = py2exe_util.get_windir() # This is the tail of the path windows uses when looking for dlls # XXX On Windows NT, the SYSTEM directory is also searched exedir = os.path.dirname(sys.executable... |
alldlls.remove(sys.executable) | def find_dependend_dlls(self, use_runw, dlls, pypath, dll_excludes): import py2exe_util sysdir = py2exe_util.get_sysdir() windir = py2exe_util.get_windir() # This is the tail of the path windows uses when looking for dlls # XXX On Windows NT, the SYSTEM directory is also searched exedir = os.path.dirname(sys.executable... | |
self.run_command('build') | build_ext = self.reinitialize_command('build_ext').force build_ext.force = force build = self.reinitialize_command('build') build.force = self.force build.run() | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
print "COPYING EXTENSIONS TO", final_dir | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return | |
archive_basename = os.path.join(collect_dir, script_base) | archive_basename = os.path.join(self.bdist_dir, script_base) | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
module = Module(name=name, path=pathname) | module = Module(name="exceptions", file=pathname) | def copy_additional_files(self, final_dir): # Some python versions (1.5) import the 'exceptions' # module BEFORE we can install our importer. file, pathname, desc = imp.find_module("exceptions") if file: file.close() module = Module(name=name, path=pathname) byte_compile([module], target_dir=final_dir, optimize=self.op... |
raise "NOTFOUND", (pythondll, os.environ["PATH"]) | self.warn("Could not find %s, must copy manually into %s" %\ (pythondll, final_dir)) | def copy_additional_files(self, final_dir): # Some python versions (1.5) import the 'exceptions' # module BEFORE we can install our importer. file, pathname, desc = imp.find_module("exceptions") if file: file.close() module = Module(name=name, path=pathname) byte_compile([module], target_dir=final_dir, optimize=self.op... |
return [imp.find_module("imputil")[1]] | try: return [imp.find_module("imputil")[1]] except ImportError: import tools return [imp.find_module("imputil", tools.__path__)[1]] | def support_modules(self): import imp return [imp.find_module("imputil")[1]] |
def strip_syspath(file, extra_path): for p in extra_path + sys.path: if p and string.upper(file[:len(p)]) == string.upper(p): return file[len(p)+1:] if os.path.isfile(file): return file raise RuntimeError, ("%s not found on path??" % file, extra_path + sys.path) | def endswith(str, substr): return str[-len(substr):] == substr | |
raise "Error", "Nothing to do" | raise DistutilsError, "Nothing to do" | def run (self): if not self.distribution.scripts: # nothing to do # should raise an error! raise "Error", "Nothing to do" return |
delete = 0 | def create_exe (self, exe_name, arcname, use_runw): import struct | |
print "Adding zlib%s.pyd to %s" % (is_debug_build and "_d" or "", arcname) arcfile.write("<zlib.pyd>") | def create_binaries(self, py_files, extensions, dlls): dist = self.distribution | |
bytes = zlib_file.read() arcfile.write(struct.pack("i", len(bytes))) arcfile.write(bytes) | if zlib_file: print "Adding zlib%s.pyd to %s" % (is_debug_build and "_d" or "", arcname) arcfile.write("<zlib.pyd>") bytes = zlib_file.read() arcfile.write(struct.pack("i", len(bytes))) arcfile.write(bytes) | def create_binaries(self, py_files, extensions, dlls): dist = self.distribution |
print "Adding zlib.pyd as resource to %s" % exe_path zlib_bytes = imp.find_module("zlib")[0].read() add_resource(unicode(exe_path), zlib_bytes, u"ZLIB.PYD", 1, False) | zlib_file = imp.find_module("zlib")[0] if zlib_file: print "Adding zlib.pyd as resource to %s" % exe_path zlib_bytes = zlib_file.read() add_resource(unicode(exe_path), zlib_bytes, u"ZLIB.PYD", 1, False) | def build_executable(self, target, template, arcname, script, vars={}): # Build an executable for the target # template is the exe-stub to use, and arcname is the zipfile # containing the python modules. from py2exe_util import add_resource, add_icon ext = os.path.splitext(template)[1] exe_base = target.get_dest_base()... |
def __init__(self, path=None, debug=0, excludes = [], replace_paths = []): | def __init__(self, path=None, debug=0, excludes = []): | def __init__(self, path=None, debug=0, excludes = [], replace_paths = []): if path is None: path = sys.path self.path = path self.modules = {} self.badmodules = {} self.debug = debug self.indent = 0 self.excludes = excludes self.replace_paths = replace_paths self.processed_paths = [] # Used in debugging only |
self.replace_paths = replace_paths self.processed_paths = [] | def __init__(self, path=None, debug=0, excludes = [], replace_paths = []): if path is None: path = sys.path self.path = path self.modules = {} self.badmodules = {} self.debug = debug self.indent = 0 self.excludes = excludes self.replace_paths = replace_paths self.processed_paths = [] # Used in debugging only | |
if self.replace_paths: co = self.replace_paths_in_code(co) | def load_module(self, fqname, fp, pathname, (suffix, mode, type)): self.msgin(2, "load_module", fqname, fp and "fp", pathname) if type == imp.PKG_DIRECTORY: m = self.load_package(fqname, pathname) self.msgout(2, "load_module ->", m) return m if type == imp.PY_SOURCE: co = compile(fp.read()+'\n', pathname, 'exec') elif ... | |
if sys.platform=="win32": import _winreg from _winreg import HKEY_LOCAL_MACHINE | if sys.platform=="win32" and win32api is not None: HKEY_LOCAL_MACHINE = 0x80000002 | def find_module(self, name, path): if name in self.excludes: self.msgout(3, "find_module -> Excluded") raise ImportError, name |
pathname = _winreg.QueryValueEx(HKEY_LOCAL_MACHINE, \ "Software\\Python\\PythonCore\\%s\\Modules\\%s" % (sys.winver, name)) | pathname = win32api.RegQueryValue(HKEY_LOCAL_MACHINE, "Software\\Python\\PythonCore\\%s\\Modules\\%s" % (sys.winver, name)) | def find_module(self, name, path): if name in self.excludes: self.msgout(3, "find_module -> Excluded") raise ImportError, name |
except _winreg.error: | except win32api.error: | def find_module(self, name, path): if name in self.excludes: self.msgout(3, "find_module -> Excluded") raise ImportError, name |
def replace_paths_in_code(self, co): new_filename = original_filename = os.path.normpath(co.co_filename) for f,r in self.replace_paths: if original_filename.startswith(f): new_filename = r+original_filename[len(f):] break if self.debug and original_filename not in self.processed_paths: if new_filename!=original_filena... | def report(self): print print " %-25s %s" % ("Name", "File") print " %-25s %s" % ("----", "----") # Print modules found keys = self.modules.keys() keys.sort() for key in keys: m = self.modules[key] if m.__path__: print "P", else: print "m", print "%-25s" % key, m.__file__ or "" | |
if is_debug_build: base_d, ext_d = os.path.splitext(template) template_d = base_d + "_d" + ext_d template = template_d | def build_executable(self, target, template, arcname, script, vars={}): # Build an executable for the target # template is the exe-stub to use, and arcname is the zipfile # containing the python modules. from py2exe_util import add_resource, add_icon if is_debug_build: base_d, ext_d = os.path.splitext(template) templat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.