#6 Support onboarding Python packages and skipping Anitya
Merged 2 years ago by dcavalca. Opened 2 years ago by salimma.
salimma/fedora-sig-onboard add-pypi-support  into  main

file modified
+14 -4
@@ -58,9 +58,17 @@ 

      is_flag=True,

      default=True,

  )

+ @click.option(

+     "-R",

+     "--no-set-relmon",

+     "set_relmon",

+     help="Don't add to release monitoring.",

+     is_flag=True,

+     default=True,

+ )

  @click.argument("package", required=False, nargs=-1)

  @pass_onboarder

- def onboard(onboarder, group, acl, set_bz, package):

+ def onboard(onboarder, group, acl, set_bz, set_relmon, package):

      if not package:

          package = [Path(os.getcwd()).name]

  
@@ -72,6 +80,8 @@ 

          if not group:

              if p.startswith("golang-"):

                  group = "go-sig"

+             elif p.startswith("python-"):

+                 group = "python-packagers-sig"

              elif p.startswith("rust-"):

                  group = "rust-sig"

              else:
@@ -79,11 +89,11 @@ 

  

          click.echo(f"[{p}] updating ACL")

          onboarder.add_package_acl(p, group, acl)

-         if set_bz:

+         if group in ["go-sig", "rust-sig"] and set_bz:

              click.echo(f"[{p}] updating bugzilla assignees")

              onboarder.set_bugzilla_assignee(p, group)

-         if group == "rust-sig":

-             click.echo(f"[{p}] adding to anitya")

+         if group in ["python-packagers-sig", "rust-sig"] and set_relmon:

+             click.echo(f"[{p}] adding to release monitoring")

              onboarder.add_package_to_anitya(p)

  

  

@@ -67,7 +67,10 @@ 

      def get_anitya_project(self, package, ecosystem=None):

          project = package

          if not ecosystem:

-             if package.startswith("rust-"):

+             if package.startswith("python-"):

+                 project = package.split("-", 1)[1]

+                 ecosystem = "pypi"

+             elif package.startswith("rust-"):

                  project = package.split("-", 1)[1]

                  ecosystem = "crates.io"

              else:
@@ -104,7 +107,12 @@ 

      def add_anitya_project(self, package, ecosystem=None, homepage=None):

          project = package

          if not ecosystem:

-             if package.startswith("rust-"):

+             if package.startswith("python-"):

+                 project = package.split("-", 1)[1]

+                 ecosystem = "pypi"

+                 if not homepage:

+                     homepage = f"https://pypi.org/project/{project}"

+             elif package.startswith("rust-"):

                  project = package.split("-", 1)[1]

                  ecosystem = "crates.io"

                  if not homepage:
@@ -139,7 +147,10 @@ 

          self, package, project, ecosystem=None, distribution="Fedora"

      ):

          if not ecosystem:

-             if package.startswith("rust-"):

+             if package.startswith("python-"):

+                 project = package.split("-", 1)[1]

+                 ecosystem = "pypi"

+             elif package.startswith("rust-"):

                  project = package.split("-", 1)[1]

                  ecosystem = "crates.io"

          url = requests.compat.urljoin(ANITYA_URL, "packages/")

Signed-off-by: Michel Alexandre Salim salimma@fedoraproject.org

rebased onto cd80bea

2 years ago

rebased onto effa6e1

2 years ago

Pull-Request has been merged by dcavalca

2 years ago