• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python errors.fatal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: close

    def close(self):
        '''
        Push all instructions to the formatter.
        '''
        self._closed = True

        bases = self.get_bases()
        broken_bases = sorted(
            m for m, includer in self._included_manifests.iteritems()
            if mozpath.basedir(m, bases) != mozpath.basedir(includer, bases))
        for m in broken_bases:
            errors.fatal('"%s" is included from "%s", which is outside "%s"' %
                         (m, self._included_manifests[m],
                          mozpath.basedir(m, bases)))
        for base in sorted(bases):
            self.formatter.add_base(base, self._addons.get(base, False))
        self._chrome_queue.execute()
        self._queue.execute()
        self._file_queue.execute()
开发者ID:MekliCZ,项目名称:positron,代码行数:19,代码来源:__init__.py


示例17: 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(']'):
         if str == '[]' or re.search(r'[\[\]\s]', str[1:-1]):
             errors.fatal('Malformed manifest')
         else:
             self._component = 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:RickEyre,项目名称:mozilla-central,代码行数:21,代码来源:__init__.py


示例18: parse_manifest_line

def parse_manifest_line(base, line):
    '''
    Parse a line from a manifest file with the given base directory and
    return the corresponding ManifestEntry instance.
    '''
    # Remove comments
    cmd = MANIFEST_RE.sub('', line).strip().split()
    if not cmd:
        return None
    if not cmd[0] in MANIFESTS_TYPES:
        return errors.fatal('Unknown manifest directive: %s' % cmd[0])
    return MANIFESTS_TYPES[cmd[0]](base, *cmd[1:])
开发者ID:MekliCZ,项目名称:positron,代码行数:12,代码来源:manifest.py


示例19: main

def main():
    parser = ArgumentParser()
    parser.add_argument('-D', dest='defines', action='append',
                        metavar="VAR[=VAL]", help='Define a variable')
    parser.add_argument('--format', default='omni',
                        help='Choose the chrome format for packaging ' +
                        '(omni, jar or flat ; default: %(default)s)')
    parser.add_argument('--removals', default=None,
                        help='removed-files source file')
    parser.add_argument('--ignore-errors', action='store_true', default=False,
                        help='Transform errors into warnings.')
    parser.add_argument('--minify', action='store_true', default=False,
                        help='Make some files more compact while packaging')
    parser.add_argument('--minify-js', action='store_true',
                        help='Minify JavaScript files while packaging.')
    parser.add_argument('--js-binary',
                        help='Path to js binary. This is used to verify '
                        'minified JavaScript. If this is not defined, '
                        'minification verification will not be performed.')
    parser.add_argument('--jarlog', default='', help='File containing jar ' +
                        'access logs')
    parser.add_argument('--optimizejars', action='store_true', default=False,
                        help='Enable jar optimizations')
    parser.add_argument('--unify', default='',
                        help='Base directory of another build to unify with')
    parser.add_argument('manifest', default=None, nargs='?',
                        help='Manifest file name')
    parser.add_argument('source', help='Source directory')
    parser.add_argument('destination', help='Destination directory')
    parser.add_argument('--non-resource', nargs='+', metavar='PATTERN',
                        default=[],
                        help='Extra files not to be considered as resources')
    args = parser.parse_args()

    defines = dict(buildconfig.defines)
    if args.ignore_errors:
        errors.ignore_errors()

    if args.defines:
        for name, value in [split_define(d) for d in args.defines]:
            defines[name] = value

    copier = FileCopier()
    if args.format == 'flat':
        formatter = FlatFormatter(copier)
    elif args.format == 'jar':
        formatter = JarFormatter(copier, optimize=args.optimizejars)
    elif args.format == 'omni':
        formatter = OmniJarFormatter(copier,
                                     buildconfig.substs['OMNIJAR_NAME'],
                                     optimize=args.optimizejars,
                                     non_resources=args.non_resource)
    else:
        errors.fatal('Unknown format: %s' % args.format)

    # Adjust defines according to the requested format.
    if isinstance(formatter, OmniJarFormatter):
        defines['MOZ_OMNIJAR'] = 1
    elif 'MOZ_OMNIJAR' in defines:
        del defines['MOZ_OMNIJAR']

    respath = ''
    if 'RESPATH' in defines:
        respath = SimpleManifestSink.normalize_path(defines['RESPATH'])
    while respath.startswith('/'):
        respath = respath[1:]

    if args.unify:
        def is_native(path):
            path = os.path.abspath(path)
            return platform.machine() in mozpath.split(path)

        # Invert args.unify and args.source if args.unify points to the
        # native architecture.
        args.source, args.unify = sorted([args.source, args.unify],
                                         key=is_native, reverse=True)
        if is_native(args.source):
            launcher.tooldir = args.source
    elif not buildconfig.substs['CROSS_COMPILE']:
        launcher.tooldir = buildconfig.substs['LIBXUL_DIST']

    with errors.accumulate():
        finder_args = dict(
            minify=args.minify,
            minify_js=args.minify_js,
        )
        if args.js_binary:
            finder_args['minify_js_verify_command'] = [
                args.js_binary,
                os.path.join(os.path.abspath(os.path.dirname(__file__)),
                    'js-compare-ast.js')
            ]
        if args.unify:
            finder = UnifiedBuildFinder(FileFinder(args.source),
                                        FileFinder(args.unify),
                                        **finder_args)
        else:
            finder = FileFinder(args.source, **finder_args)
        if 'NO_PKG_FILES' in os.environ:
            sinkformatter = NoPkgFilesRemover(formatter,
#.........这里部分代码省略.........
开发者ID:npark-mozilla,项目名称:gecko-dev,代码行数:101,代码来源:packager.py


示例20: remove

 def remove(self, section, pattern):
     assert not self._closed
     errors.fatal('Removal is unsupported')
开发者ID:RickEyre,项目名称:mozilla-central,代码行数:3,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python files.File类代码示例发布时间:2022-05-27
下一篇:
Python errors.error函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap