当前位置: 首页>>代码示例>>Python>>正文


Python errors.fatal函数代码示例

本文整理汇总了Python中mozpack.errors.errors.fatal函数的典型用法代码示例。如果您正苦于以下问题:Python fatal函数的具体用法?Python fatal怎么用?Python fatal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fatal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _add_manifest_file

 def _add_manifest_file(self, path, file):
     '''
     Add the given BaseFile with manifest file contents with the given path.
     '''
     self._manifests.add(path)
     base = ''
     if hasattr(file, 'path'):
         # Find the directory the given path is relative to.
         b = mozpath.normsep(file.path)
         if b.endswith('/' + path) or b == path:
             base = os.path.normpath(b[:-len(path)])
     for e in parse_manifest(base, path, file.open()):
         # ManifestResources need to be given after ManifestChrome, so just
         # put all ManifestChrome in a separate queue to make them first.
         if isinstance(e, ManifestChrome):
             # e.move(e.base) just returns a clone of the entry.
             self._chrome_queue.append(self.formatter.add_manifest,
                                       e.move(e.base))
         elif not isinstance(e, (Manifest, ManifestInterfaces)):
             self._queue.append(self.formatter.add_manifest, e.move(e.base))
         # If a binary component is added to an addon, prevent the addon
         # from being packed.
         if isinstance(e, ManifestBinaryComponent):
             addon = mozpath.basedir(e.base, self._addons)
             if addon:
                 self._addons[addon] = 'unpacked'
         if isinstance(e, Manifest):
             if e.flags:
                 errors.fatal('Flags are not supported on ' +
                              '"manifest" entries')
             self._included_manifests[e.path] = path
开发者ID:MekliCZ,项目名称:positron,代码行数:31,代码来源:__init__.py

示例2: add_manifest

    def add_manifest(self, entry):
        # Store manifest entries in a single manifest per directory, named
        # after their parent directory, except for root manifests, all named
        # chrome.manifest.
        if entry.base:
            name = mozpath.basename(entry.base)
        else:
            name = 'chrome'
        path = mozpath.normpath(mozpath.join(entry.base, '%s.manifest' % name))
        if not self.copier.contains(path):
            # Add a reference to the manifest file in the parent manifest, if
            # the manifest file is not a root manifest.
            if entry.base:
                parent = mozpath.dirname(entry.base)
                relbase = mozpath.basename(entry.base)
                relpath = mozpath.join(relbase,
                                            mozpath.basename(path))
                self.add_manifest(Manifest(parent, relpath))
            self.copier.add(path, ManifestFile(entry.base))

        if isinstance(entry, ManifestChrome):
            data = self._chrome_db.setdefault(entry.name, {})
            entries = data.setdefault(entry.type, [])
            for e in entries:
                # Ideally, we'd actually check whether entry.flags are more
                # specific than e.flags, but in practice the following test
                # is enough for now.
                if not entry.flags or e.flags and entry.flags == e.flags:
                    errors.fatal('"%s" overrides "%s"' % (entry, e))
            entries.append(entry)

        self.copier[path].add(entry)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:32,代码来源:formats.py

示例3: elfhack

def elfhack(path):
    '''
    Execute the elfhack command on the given path.
    '''
    cmd = [os.path.join(topobjdir, 'build/unix/elfhack/elfhack'), path]
    if 'ELF_HACK_FLAGS' in os.environ:
        cmd[1:0] = os.environ['ELF_HACK_FLAGS'].split()
    if subprocess.call(cmd) != 0:
        errors.fatal('Error executing ' + ' '.join(cmd))
开发者ID:Web5design,项目名称:mozilla-central,代码行数:9,代码来源:executables.py

示例4: elfhack

def elfhack(path):
    """
    Execute the elfhack command on the given path.
    """
    cmd = [os.path.join(topobjdir, "build/unix/elfhack/elfhack"), path]
    if "ELF_HACK_FLAGS" in os.environ:
        cmd[1:0] = os.environ["ELF_HACK_FLAGS"].split()
    if subprocess.call(cmd) != 0:
        errors.fatal("Error executing " + " ".join(cmd))
开发者ID:RickEyre,项目名称:mozilla-central,代码行数:9,代码来源:executables.py

示例5: copy

    def copy(self, dest, skip_if_older=True):
        if isinstance(dest, basestring):
            dest = Dest(dest)
        else:
            assert isinstance(dest, Dest)

        if not dest.exists():
            errors.fatal("Required existing file doesn't exist: %s" %
                dest.path)
开发者ID:bcharbonnier,项目名称:mozilla-central,代码行数:9,代码来源:files.py

示例6: strip

def strip(path):
    '''
    Execute the STRIP command with STRIP_FLAGS on the given path.
    '''
    strip = substs['STRIP']
    flags = substs['STRIP_FLAGS'].split() if 'STRIP_FLAGS' in substs else []
    cmd = [strip] + flags + [path]
    if subprocess.call(cmd) != 0:
        errors.fatal('Error executing ' + ' '.join(cmd))
开发者ID:Web5design,项目名称:mozilla-central,代码行数:9,代码来源:executables.py

示例7: strip

def strip(path):
    """
    Execute the STRIP command with STRIP_FLAGS on the given path.
    """
    strip = substs["STRIP"]
    flags = substs["STRIP_FLAGS"].split() if "STRIP_FLAGS" in substs else []
    cmd = [strip] + flags + [path]
    if subprocess.call(cmd) != 0:
        errors.fatal("Error executing " + " ".join(cmd))
开发者ID:RickEyre,项目名称:mozilla-central,代码行数:9,代码来源:executables.py

示例8: precompile_cache

def precompile_cache(formatter, source_path, gre_path, app_path):
    '''
    Create startup cache for the given application directory, using the
    given GRE path.
    - formatter is a Formatter instance where to add the startup cache.
    - source_path is the base path of the package.
    - gre_path is the GRE path, relative to source_path.
    - app_path is the application path, relative to source_path.
    Startup cache for all resources under resource://app/ are generated,
    except when gre_path == app_path, in which case it's under
    resource://gre/.
    '''
    from tempfile import mkstemp
    source_path = os.path.abspath(source_path)
    if app_path != gre_path:
        resource = 'app'
    else:
        resource = 'gre'
    app_path = os.path.join(source_path, app_path)
    gre_path = os.path.join(source_path, gre_path)

    fd, cache = mkstemp('.zip')
    os.close(fd)
    os.remove(cache)

    # For VC12, make sure we can find the right bitness of pgort120.dll
    env = os.environ.copy()
    if 'VS120COMNTOOLS' in env and not buildconfig.substs['HAVE_64BIT_OS']:
      vc12dir = os.path.abspath(os.path.join(env['VS120COMNTOOLS'],
                                             '../../VC/bin'))
      if os.path.exists(vc12dir):
        env['PATH'] = vc12dir + ';' + env['PATH']

    try:
        if launcher.launch(['xpcshell', '-g', gre_path, '-a', app_path,
                            '-f', os.path.join(os.path.dirname(__file__),
                            'precompile_cache.js'),
                            '-e', 'precompile_startupcache("resource://%s/");'
                                  % resource],
                           extra_linker_path=gre_path,
                           extra_env={'MOZ_STARTUP_CACHE': cache,
                                      'PATH': env['PATH']}):
            errors.fatal('Error while running startup cache precompilation')
            return
        from mozpack.mozjar import JarReader
        jar = JarReader(cache)
        resource = '/resource/%s/' % resource
        for f in jar:
            if resource in f.filename:
                path = f.filename[f.filename.index(resource) + len(resource):]
                if formatter.contains(path):
                    formatter.add(f.filename, GeneratedFile(f.read()))
        jar.close()
    finally:
        if os.path.exists(cache):
            os.remove(cache)
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:56,代码来源:packager.py

示例9: __init__

 def __init__(self, base, *flags):
     '''
     Initialize a manifest entry with the given base path and flags.
     '''
     self.base = base
     self.flags = Flags(*flags)
     if not all(f in self.allowed_flags for f in self.flags):
         errors.fatal('%s unsupported for %s manifest entries' %
                      (','.join(f for f in self.flags
                       if not f in self.allowed_flags), self.type))
开发者ID:MekliCZ,项目名称:positron,代码行数:10,代码来源:manifest.py

示例10: copy

 def copy(self, dest, skip_if_older=True):
     assert isinstance(dest, basestring)
     # os.path.getmtime returns a result in seconds with precision up to the
     # microsecond. But microsecond is too precise because shutil.copystat
     # only copies milliseconds, and seconds is not enough precision.
     if os.path.exists(dest) and skip_if_older and \
             int(os.path.getmtime(self.path) * 1000) <= \
             int(os.path.getmtime(dest) * 1000):
         return False
     if launcher.launch(['shlibsign', '-v', '-o', dest, '-i', self.path]):
         errors.fatal('Error while signing %s' % self.path)
开发者ID:npark-mozilla,项目名称:gecko-dev,代码行数:11,代码来源:packager.py

示例11: from_string

 def from_string(string):
     '''
     Create a component from a string.
     '''
     try:
         name, options = Component._split_component_and_options(string)
     except ValueError as e:
         errors.fatal('Malformed manifest: %s' % e)
         return
     destdir = options.pop('destdir', '')
     if options:
         errors.fatal('Malformed manifest: options %s not recognized'
                      % options.keys())
     return Component(name, destdir=destdir)
开发者ID:MekliCZ,项目名称:positron,代码行数:14,代码来源:__init__.py

示例12: add_definition

 def add_definition(self, definition):
     '''
     Add a flag value definition. Replaces any previously set value.
     '''
     if definition == self.name:
         self.value = True
         return
     assert(definition.startswith(self.name))
     if definition[len(self.name)] != '=':
         return errors.fatal('Malformed flag: %s' % definition)
     value = definition[len(self.name) + 1:]
     if value in ('yes', 'true', '1', 'no', 'false', '0'):
         self.value = value
     else:
         return errors.fatal('Unknown value in: %s' % definition)
开发者ID:MekliCZ,项目名称:positron,代码行数:15,代码来源:flags.py

示例13: __init__

 def __init__(self, *flags):
     '''
     Initialize a set of flags given in string form.
        flags = Flags('contentaccessible=yes', 'appversion>=3.5')
     '''
     OrderedDict.__init__(self)
     for f in flags:
         name = self.RE.split(f)
         name = name[0]
         if not name in self.FLAGS:
             errors.fatal('Unknown flag: %s' % name)
             continue
         if not name in self:
             self[name] = self.FLAGS[name](name)
         self[name].add_definition(f)
开发者ID:MekliCZ,项目名称:positron,代码行数:15,代码来源:flags.py

示例14: precompile_cache

def precompile_cache(formatter, source_path, gre_path, app_path):
    '''
    Create startup cache for the given application directory, using the
    given GRE path.
    - formatter is a Formatter instance where to add the startup cache.
    - source_path is the base path of the package.
    - gre_path is the GRE path, relative to source_path.
    - app_path is the application path, relative to source_path.
    Startup cache for all resources under resource://app/ are generated,
    except when gre_path == app_path, in which case it's under
    resource://gre/.
    '''
    from tempfile import mkstemp
    source_path = os.path.abspath(source_path)
    if app_path != gre_path:
        resource = 'app'
    else:
        resource = 'gre'
    app_path = os.path.join(source_path, app_path)
    gre_path = os.path.join(source_path, gre_path)

    fd, cache = mkstemp('.zip')
    os.close(fd)
    os.remove(cache)

    try:
        if launcher.launch(['xpcshell', '-g', gre_path, '-a', app_path,
                            '-f', os.path.join(os.path.dirname(__file__),
                            'precompile_cache.js'),
                            '-e', 'precompile_startupcache("resource://%s/");'
                                  % resource],
                           extra_linker_path=gre_path,
                           extra_env={'MOZ_STARTUP_CACHE': cache}):
            errors.fatal('Error while running startup cache precompilation')
            return
        from mozpack.mozjar import JarReader
        jar = JarReader(cache)
        resource = '/resource/%s/' % resource
        for f in jar:
            if resource in f.filename:
                path = f.filename[f.filename.index(resource) + len(resource):]
                if formatter.contains(path):
                    formatter.add(f.filename, GeneratedFile(f.read()))
        jar.close()
    finally:
        if os.path.exists(cache):
            os.remove(cache)
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:47,代码来源:packager.py

示例15: handle_line

 def handle_line(self, str):
     '''
     Handle a line of input and push the parsed information to the sink
     object.
     '''
     # Remove comments.
     str = str.strip()
     if not str or str.startswith(';'):
         return
     if str.startswith('[') and str.endswith(']'):
         self._component = Component.from_string(str[1:-1])
     elif str.startswith('-'):
         str = str[1:]
         self._sink.remove(self._component, str)
     elif ',' in str:
         errors.fatal('Incompatible syntax')
     else:
         self._sink.add(self._component, str)
开发者ID:MekliCZ,项目名称:positron,代码行数:18,代码来源:__init__.py


注:本文中的mozpack.errors.errors.fatal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。