77
88"""A hermes harvest plugin that harvests the .toml file of the project"""
99
10- from contextlib import chdir
10+ from os import chdir , getcwd
1111from email .utils import getaddresses
1212
1313import toml
@@ -28,7 +28,7 @@ class TomlHarvestPlugin(HermesHarvestPlugin):
2828 "project" : [
2929 ("name" , "name" ), ("version" , "version" ), ("description" , "description" ),
3030 ("runtimePlatform" , "requires-python" ), ("author" , "authors" ),
31- ("maintainer" , "maintainers" ), ("keywords" , "keywords" )
31+ ("maintainer" , "maintainers" ), ("keywords" , "keywords" ), ( "license" , "license" )
3232 ],
3333 "poetry" : [
3434 ("name" , "name" ), ("version" , "version" ), ("description" , "description" ),
@@ -42,9 +42,13 @@ def __call__(self, command: HermesHarvestCommand):
4242 """start of the process of harvesting the .toml file"""
4343
4444 #set the working directory temporary to the correct location
45- with chdir (command .args .path ):
46- #harvesting the data from the .toml file specified in the Settings class
47- data = self .read_from_toml (command .settings .toml .filename )
45+ old_dir = getcwd ()
46+ chdir (command .args .path )
47+
48+ #harvesting the data from the .toml file specified in the Settings class
49+ data = self .read_from_toml (command .settings .toml .filename )
50+
51+ chdir (old_dir )
4852
4953 #returning the harvested data and some metadata
5054 return data , {"filename" : command .settings .toml .filename }
@@ -107,6 +111,8 @@ def read_from_one_table(cls, table, mapping):
107111 if not persons is None :
108112 ret_data [field1 ] = persons
109113
114+ elif field1 == "license" :
115+ ret_data [field1 ] = table [field2 ].get ("text" , None )
110116 else :
111117 #add the data of a field that needs no processing
112118 ret_data [field1 ] = table [field2 ]
0 commit comments