(self, registry, defines_override={},
                          link_policy='symlink')
Populate a mozpack.copier.FileRegistry instance with data from us.

        The caller supplied a FileRegistry instance (or at least something that
        conforms to its interface) and that instance is populated with data
        from this manifest.

        Defines can be given to override the ones in the manifest for
        preprocessing.

        The caller can set a link policy. This determines whether symlinks,
        hardlinks, or copies are used for LINK and PATTERN_LINK.
Populate a mozpack.copier.FileRegistry instance with data from us.
Populate a mozpack . copier . FileRegistry instance with data from us .
def populate_registry(self, registry, defines_override={},
                          link_policy='symlink'):
        """Populate a mozpack.copier.FileRegistry instance with data from us.

        The caller supplied a FileRegistry instance (or at least something that
        conforms to its interface) and that instance is populated with data
        from this manifest.

        Defines can be given to override the ones in the manifest for
        preprocessing.

        The caller can set a link policy. This determines whether symlinks,
        hardlinks, or copies are used for LINK and PATTERN_LINK.
        """
        assert link_policy in ("symlink", "hardlink", "copy")
        for dest in sorted(self._dests):
            entry = self._dests[dest]
            install_type = entry[0]

            if install_type == self.LINK:
                if link_policy == "symlink":
                    cls = AbsoluteSymlinkFile
                elif link_policy == "hardlink":
                    cls = HardlinkFile
                else:
                    cls = File
                registry.add(dest, cls(entry[1]))
                continue

            if install_type == self.COPY:
                registry.add(dest, File(entry[1]))
                continue

            if install_type == self.REQUIRED_EXISTS:
                registry.add(dest, ExistingFile(required=True))
                continue

            if install_type == self.OPTIONAL_EXISTS:
                registry.add(dest, ExistingFile(required=False))
                continue

            if install_type in (self.PATTERN_LINK, self.PATTERN_COPY):
                _, base, pattern, dest = entry
                finder = FileFinder(base)
                paths = [f[0] for f in finder.find(pattern)]

                if install_type == self.PATTERN_LINK:
                    if link_policy == "symlink":
                        cls = AbsoluteSymlinkFile
                    elif link_policy == "hardlink":
                        cls = HardlinkFile
                    else:
                        cls = File
                else:
                    cls = File

                for path in paths:
                    source = mozpath.join(base, path)
                    registry.add(mozpath.join(dest, path), cls(source))

                continue

            if install_type == self.PREPROCESS:
                defines = self._decode_field_entry(entry[4])
                if defines_override:
                    defines.update(defines_override)
                registry.add(dest, PreprocessedFile(entry[1],
                    depfile_path=entry[2],
                    marker=entry[3],
                    defines=defines,
                    extra_depends=self._source_files,
                    silence_missing_directive_warnings=bool(int(entry[5]))))

                continue

            if install_type == self.CONTENT:
                # GeneratedFile expect the buffer interface, which the unicode
                # type doesn't have, so encode to a str.
                content = self._decode_field_entry(entry[1]).encode('utf-8')
                registry.add(dest, GeneratedFile(content))
                continue

            raise Exception('Unknown install type defined in manifest: %d' %
                install_type)
def populate_registry ( self , registry , defines_override = { } , link_policy = 'symlink' ) : assert link_policy in ( "symlink" , "hardlink" , "copy" ) for dest in sorted ( self . _dests ) : entry = self . _dests [ dest ] install_type = entry [ 0 ] if install_type == self . LINK : if link_policy == "symlink" : cls = AbsoluteSymlinkFile elif link_policy == "hardlink" : cls = HardlinkFile else : cls = File registry . add ( dest , cls ( entry [ 1 ] ) ) continue if install_type == self . COPY : registry . add ( dest , File ( entry [ 1 ] ) ) continue if install_type == self . REQUIRED_EXISTS : registry . add ( dest , ExistingFile ( required = True ) ) continue if install_type == self . OPTIONAL_EXISTS : registry . add ( dest , ExistingFile ( required = False ) ) continue if install_type in ( self . PATTERN_LINK , self . PATTERN_COPY ) : _ , base , pattern , dest = entry finder = FileFinder ( base ) paths = [ f [ 0 ] for f in finder . find ( pattern ) ] if install_type == self . PATTERN_LINK : if link_policy == "symlink" : cls = AbsoluteSymlinkFile elif link_policy == "hardlink" : cls = HardlinkFile else : cls = File else : cls = File for path in paths : source = mozpath . join ( base , path ) registry . add ( mozpath . join ( dest , path ) , cls ( source ) ) continue if install_type == self . PREPROCESS : defines = self . _decode_field_entry ( entry [ 4 ] ) if defines_override : defines . update ( defines_override ) registry . add ( dest , PreprocessedFile ( entry [ 1 ] , depfile_path = entry [ 2 ] , marker = entry [ 3 ] , defines = defines , extra_depends = self . _source_files , silence_missing_directive_warnings = bool ( int ( entry [ 5 ] ) ) ) ) continue if install_type == self . CONTENT : # GeneratedFile expect the buffer interface, which the unicode # type doesn't have, so encode to a str. content = self . _decode_field_entry ( entry [ 1 ] ) . encode ( 'utf-8' ) registry . add ( dest , GeneratedFile ( content ) ) continue raise Exception ( 'Unknown install type defined in manifest: %d' % install_type )