Пример #1
0
 def matcher(package: Package, package_context: PackageContext,
             match_context: MatchContext) -> bool:
     match = namepat_re.fullmatch(package.effname)
     if match is not None:
         match_context.name_match = match
         return True
     return False
Пример #2
0
 def matcher(package: Package, package_context: PackageContext,
             match_context: MatchContext) -> bool:
     match = verpat.fullmatch(package.version.lower())
     if match is not None:
         match_context.ver_match = match
         return True
     return False
Пример #3
0
    def match(self, package: Package,
              package_context: PackageContext) -> MatchContext | None:
        match_context = MatchContext()

        for matcher in self._matchers:
            if not matcher(package, package_context, match_context):
                return None

        package_context.add_matched_rule(self.number)

        return match_context
Пример #4
0
    def action(package: Package, package_context: PackageContext,
               match_context: MatchContext) -> None:
        flavors: list[str] = want_flavors if want_flavors else [
            package.effname
        ]

        flavors = [
            match_context.sub_name_dollars(flavor, package.effname)
            for flavor in flavors
        ]

        flavors = [flavor.strip('-') for flavor in flavors]

        package.flavors += [flavor for flavor in flavors if flavor]
Пример #5
0
 def action(package: Package, package_context: PackageContext,
            match_context: MatchContext) -> None:
     package.subrepo = match_context.sub_name_dollars(
         setsubrepo, package.effname)
Пример #6
0
 def action(package: Package, package_context: PackageContext,
            match_context: MatchContext) -> None:
     package.version = match_context.sub_ver_dollars(
         setver, package.version)
Пример #7
0
 def action(package: Package, package_context: PackageContext,
            match_context: MatchContext) -> None:
     match_context.last = True