#5 Add support for pagure.io as a forge.
Merged 9 months ago by eclipseo. Opened 9 months ago by qulogic.
GoSIG/ qulogic/go2rpm pagure  into  master

file modified
+16 -3

@@ -221,6 +221,16 @@ 

                      return None

                  else:

                      return normalize_description(jsonresp['description'])

+     elif 'pagure.io' in forge:

+         repo = '/'.join(forge.split('/')[3:])

+         async with aiohttp.ClientSession() as session:

+             url = f'https://pagure.io/api/0/{repo}'

+             async with session.get(url) as resp:

+                 jsonresp = await resp.json()

+                 if 'error' in jsonresp:

+                     return None

+                 else:

+                     return normalize_description(jsonresp['description'])

      else:

          return None

  

@@ -422,10 +432,13 @@ 

          goipath = re.sub(r"^http(s?)://", r"", args.goipath)

          goipath = goipath.strip('/')

  

-     if (not re.search(r"^(github.com|gitlab.com|bitbucket.org)", goipath)

-             and args.forge is None):

+     known_forge = ('github.com', 'gitlab.com', 'bitbucket.org', 'pagure.io')

+     known_forge_re = (r'^(' +

+                       r'|'.join(re.escape(url) for url in known_forge) +

+                       r')')

+     if not re.search(known_forge_re, goipath) and args.forge is None:

          parser.error(

-             "forge URL is required for import path other than github, gitlab and bitbucket"

+             f"forge URL is required for import path other than {known_forge}"

          )

  

      if args.forge is None:

no initial comment

Though note, it doesn't appear that there's a released version of the forge macros that support pagure yet.

Pull-Request has been merged by eclipseo

9 months ago
Metadata