@@ -87,10 +87,26 @@ def build(
8787 icon_path = copy_icon (context , output_dir )
8888 if icon_path is None :
8989 _log ("Could not copy icon" , context = context )
90+ licese_path = copy_license (context , output_dir )
91+ if licese_path is None :
92+ _log ("Could not copy LICENSE file" , context = context )
9093 compile_resources (context , output_dir )
9194 generate_metadata (context , output_dir )
9295 return output_dir
9396
97+ @app .command ()
98+ def copy_license (context : typer .Context ,
99+ output_dir : typing .Optional [Path ] = LOCAL_ROOT_DIR / "build/temp" ,
100+ ) -> Path :
101+ license_path = LOCAL_ROOT_DIR / "LICENSE"
102+ if license_path .is_file ():
103+ target_path = output_dir / license_path .name
104+ target_path .parent .mkdir (parents = True , exist_ok = True )
105+ shutil .copy (license_path , target_path )
106+ result = target_path
107+ else :
108+ result = None
109+ return result
94110
95111@app .command ()
96112def copy_icon (
@@ -288,19 +304,22 @@ def _get_virtualenv_site_packages_dir() -> Path:
288304 raise RuntimeError (f"{ site_packages_dir } does not exist" )
289305 return result
290306
307+ def _get_author_names (authors ):
308+ return [author .split ("<" )[0 ].strip () for author in authors ]
309+
310+ def _get_author_emails (authors ):
311+ return [author .split ("<" )[1 ].strip (">" ) for author in authors ]
291312
292313@lru_cache ()
293314def _get_metadata () -> typing .Dict :
294315 conf = _parse_pyproject ()
295316 poetry_conf = conf ["tool" ]["poetry" ]
296- raw_author_list = poetry_conf ["authors" ][0 ].split ("<" )
297- author = raw_author_list [0 ].strip ()
298- email = raw_author_list [- 1 ].replace (">" , "" )
317+
299318 metadata = conf ["tool" ]["qgis-plugin" ]["metadata" ].copy ()
300319 metadata .update (
301320 {
302- "author" : author ,
303- "email" : email ,
321+ "author" : ", " . join ( _get_author_names ( poetry_conf [ "authors" ])) ,
322+ "email" : ", " . join ( _get_author_emails ( poetry_conf [ "authors" ])) ,
304323 "description" : poetry_conf ["description" ],
305324 "version" : poetry_conf ["version" ],
306325 "tags" : ", " .join (metadata .get ("tags" , [])),
@@ -377,7 +396,7 @@ def _get_existing_releases(
377396 """Query the github API and retrieve existing releases"""
378397 # TODO: add support for pagination
379398 base_url = "https://api.github.com/repos/kartoza/qgis_geonode/releases"
380- response = httpx .get (base_url )
399+ response = httpx .get (base_url , follow_redirects = True )
381400 result = []
382401 if response .status_code == 200 :
383402 payload = response .json ()
0 commit comments