コード例 #1
0
ファイル: unify.py プロジェクト: Andrel322/gecko-dev
 def unify_file(self, path, file1, file2):
     '''
     Unify buildconfig.html contents, or defer to UnifiedFinder.unify_file.
     '''
     if mozpack.path.basename(path) == 'buildconfig.html':
         content1 = file1.open().readlines()
         content2 = file2.open().readlines()
         # Copy everything from the first file up to the end of its <body>,
         # insert a <hr> between the two files and copy the second file's
         # content beginning after its leading <h1>.
         return GeneratedFile(''.join(
             content1[:content1.index('</body>\n')] +
             ['<hr> </hr>\n'] +
             content2[content2.index('<h1>about:buildconfig</h1>\n') + 1:]
         ))
     if path.endswith('.xpi'):
         finder1 = JarFinder(os.path.join(self._finder1.base, path),
                             JarReader(fileobj=file1.open()))
         finder2 = JarFinder(os.path.join(self._finder2.base, path),
                             JarReader(fileobj=file2.open()))
         unifier = UnifiedFinder(finder1, finder2, sorted=self._sorted)
         err = errors.count
         all(unifier.find(''))
         if err == errors.count:
             return file1
         return None
     return UnifiedFinder.unify_file(self, path, file1, file2)
コード例 #2
0
    def _minify_file(self, path, file):
        '''
        Return an appropriate MinifiedSomething wrapper for the given BaseFile
        instance (file), according to the file type (determined by the given
        path), if the FileFinder was created with minification enabled.
        Otherwise, just return the given BaseFile instance.
        '''
        if not self._minify or isinstance(file, ExecutableFile):
            return file

        if path.endswith('.properties'):
            return MinifiedProperties(file)

        if self._minify_js and path.endswith(('.js', '.jsm')):
            return MinifiedJavaScript(file, self._minify_js_verify_command)

        return file
コード例 #3
0
ファイル: files.py プロジェクト: mmatyas/mozjs
    def _minify_file(self, path, file):
        '''
        Return an appropriate MinifiedSomething wrapper for the given BaseFile
        instance (file), according to the file type (determined by the given
        path), if the FileFinder was created with minification enabled.
        Otherwise, just return the given BaseFile instance.
        '''
        if not self._minify or isinstance(file, ExecutableFile):
            return file

        if path.endswith('.properties'):
            return MinifiedProperties(file)

        if self._minify_js and path.endswith(('.js', '.jsm')):
            return MinifiedJavaScript(file, self._minify_js_verify_command)

        return file
コード例 #4
0
ファイル: __init__.py プロジェクト: memorais/TC2_impl
 def add(self, path, file):
     '''
     Add the given BaseFile instance with the given path.
     '''
     assert not self._closed
     if is_manifest(path):
         self._add_manifest_file(path, file)
     elif path.endswith('.xpt'):
         self._queue.append(self.formatter.add_interfaces, path, file)
     else:
         self._file_queue.append(self.formatter.add, path, file)
コード例 #5
0
ファイル: __init__.py プロジェクト: RickEyre/mozilla-central
 def add(self, path, file):
     '''
     Add the given BaseFile instance with the given path.
     '''
     assert not self._closed
     if is_manifest(path):
         self._add_manifest_file(path, file)
     elif path.endswith('.xpt'):
         self._queue.append(self.formatter.add_interfaces, path, file)
     else:
         self._file_queue.append(self.formatter.add, path, file)
コード例 #6
0
ファイル: files.py プロジェクト: abhishekvp/gecko-dev
 def _minify_file(self, path, file):
     '''
     Return an appropriate MinifiedSomething wrapper for the given BaseFile
     instance (file), according to the file type (determined by the given
     path), if the FileFinder was created with minification enabled.
     Otherwise, just return the given BaseFile instance.
     Currently, only "*.properties" files are handled.
     '''
     if self._minify and not isinstance(file, ExecutableFile):
         if path.endswith('.properties'):
             return MinifiedProperties(file)
     return file
コード例 #7
0
ファイル: files.py プロジェクト: lxq2537664558/firefox-1
 def _minify_file(self, path, file):
     '''
     Return an appropriate MinifiedSomething wrapper for the given BaseFile
     instance (file), according to the file type (determined by the given
     path), if the FileFinder was created with minification enabled.
     Otherwise, just return the given BaseFile instance.
     Currently, only "*.properties" files are handled.
     '''
     if self._minify and not isinstance(file, ExecutableFile):
         if path.endswith('.properties'):
             return MinifiedProperties(file)
     return file
コード例 #8
0
ファイル: __init__.py プロジェクト: sjack1017/gecko-dev
 def add(self, path, file):
     '''
     Add the given BaseFile instance with the given path.
     '''
     assert not self._closed
     if is_manifest(path):
         self._add_manifest_file(path, file)
     elif path.endswith('.xpt'):
         self._queue.append(self.formatter.add_interfaces, path, file)
     else:
         self._file_queue.append(self.formatter.add, path, file)
         if mozpack.path.basename(path) == 'install.rdf':
             self._addons.add(mozpack.path.dirname(path))
コード例 #9
0
ファイル: manifest.py プロジェクト: vvuk/mozilla-central
def is_manifest(path):
    '''
    Return whether the given path is that of a manifest file.
    '''
    return path.endswith('.manifest') and not path.endswith('.CRT.manifest') \
        and not path.endswith('.exe.manifest')
コード例 #10
0
ファイル: manifest.py プロジェクト: JuannyWang/gecko-dev
def is_manifest(path):
    '''
    Return whether the given path is that of a manifest file.
    '''
    return path.endswith('.manifest') and not path.endswith('.CRT.manifest') \
        and not path.endswith('.exe.manifest')
コード例 #11
0
ファイル: manifest.py プロジェクト: stspyder/mozjs
def is_manifest(path):
    """
    Return whether the given path is that of a manifest file.
    """
    return path.endswith(".manifest") and not path.endswith(".CRT.manifest") and not path.endswith(".exe.manifest")