示例#1
0
    def transform(self, original_spec, transformers=[]):
        spec = specfile.Specfile(original_spec)
        import spec2scl.transformers
        self.subtransformers = transformers or map(
            lambda c: c(options=self.options),
            type(self).subtransformers)
        for subtrans in self.subtransformers:
            spec = subtrans._transform(original_spec, spec)

        return spec
示例#2
0
    def transform(self, original_spec, transformers=[]):
        """Initialize spec2scl.transformers and perform conversion
        by each subtransformer.
        Returns:
            converted spec file as a Specfile object
        """
        spec = specfile.Specfile(original_spec)
        import spec2scl.transformers
        self.subtransformers = transformers or map(
            lambda c: c(options=self.options),
            type(self).subtransformers)
        for subtrans in self.subtransformers:
            spec = subtrans._transform(original_spec, spec)

        return spec
 def get_pattern_for_spec(self, handler, spec_text):
     spec = specfile.Specfile(spec_text)
     for s_name, s_text in spec.sections:
         for i, pattern in enumerate(handler.matches):
             if pattern.search(s_text) and s_name in handler.sections[i]:
                 return pattern