diff --git a/.github/workflows/check_metadata.yaml b/.github/workflows/check_metadata.yaml index 4d0446bcf..fe616d11d 100644 --- a/.github/workflows/check_metadata.yaml +++ b/.github/workflows/check_metadata.yaml @@ -9,13 +9,11 @@ on: paths: - AUTHORS - CONTRIBUTORS - - codemeta.json - .zenodo.json pull_request: paths: - AUTHORS - CONTRIBUTORS - - codemeta.json - .zenodo.json jobs: diff --git a/.zenodo.json b/.zenodo.json index 91995b29f..17b7b3a6d 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,157 +1,218 @@ { + "description": "The R3BRoot software is based on the FairRoot framework and can be used to perform Monte Carlo simulations and experimental data analysis of the R3B (Reactions with Relativistic Radioactive Beams) nuclear physics experiments at the GSI-FAIR research center (Facility for Antiproton and Ion Research). The user can create simulated data and/or perform analysis with the same framework. Geant3 and Geant4 transport engines are supported, however, the implemented tasks that create simulated data do not depend on a particular Monte Carlo engine. The framework delivers base classes which enable the users to construct their detectors and/or analysis tasks in a simple way, it also delivers some general functionality like track visualization. Moreover, an interface for reading experimental and/or simulated magnetic field maps is also implemented.", + "maintainers": [ + { + "name": "Rodriguez-Sánchez, Jose Luis", + "orcid": "0000-0002-4702-5294", + "email": "j.l.rodriguez.sanchez@udc.es", + "affiliation": "CITENI, Industrial Campus of Ferrol, University of Coruña, 15403 Ferrol, Spain" + } + ], + "related_identifiers": [ + { + "identifier": "https://github.com/R3BRootGroup/R3BRoot/", + "relation": "isSupplementTo", + "resource_type": "software", + "scheme": "url" + } + ], + "title": "R3BRoot Software", + "upload_type": "software", + "license": "LGPL-3.0-only", + "keywords": [ + "Geant4", + "c-plus-plus", + "cmake", + "vmc", + "modular", + "Event reconstruction", + "Simulation", + "Data analysis", + "Structure and dynamics of nuclei", + "Nuclear reactions", + "Equation of state", + "Nuclear fission", + "Hypernuclei" + ], "creators": [ { - "name": "Al-Turany, Mohammad", - "orcid": "0000-0002-8071-4497" + "name": "Rodríguez-Sánchez, Jose Luis", + "orcid": "0000-0002-4702-5294", + "email": "j.l.rodriguez.sanchez@udc.es", + "affiliation": "CITENI, Industrial Campus of Ferrol, University of Coruña, 15403 Ferrol, Spain" }, { - "name": "Chatillon, Audrey" + "name": "Alvarez Pol, Hector", + "orcid": "0000-0001-9643-6252", + "affiliation": "IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain" }, { - "name": "Garcia-Jimenez, Gabriel" + "name": "Chatillon, Audrey", + "affiliation": "CEA, DAM, DIF, 91297 Arpajon, France" }, { - "name": "Alvarez Pol, Hector", - "orcid": "0000-0001-9643-6252" + "name": "Feijoo-Fontán, Martina", + "affiliation": "IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain" }, { - "name": "Kelic-Heil, Aleksandra" + "name": "García-Jiménez, Gabriel", + "affiliation": "IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain" }, { - "name": "Heil, Michael" + "name": "Gasparic, Igor", + "affiliation": "RBI Zagreb, HR10000 Zagreb, Croatia" }, { - "name": "Loeher, Bastian" + "name": "Graña-González, Antia", + "orcid": "0000-0002-0842-4110", + "affiliation": "CITENI, Industrial Campus of Ferrol, University of Coruña, 15403 Ferrol, Spain" }, { - "name": "Kresan, Dmytro", - "orcid": "0000-0002-7537-2875" + "name": "Heil, Michael", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { - "name": "Mozumdar, Nikhil" + "name": "Horvat, Andrea", + "affiliation": "RBI Zagreb, HR10000 Zagreb, Croatia" }, { - "name": "Mayer, Jan" + "name": "Jedele, Andrea", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { - "name": "Panin, Valerii" + "name": "Johansson, Håkan", + "affiliation": "Institutionen för Fysik, Chalmers Tekniska Högskola, 412 96 Göteborg, Sweden" }, { - "name": "Rodriguez Sanchez, Jose Luis", - "orcid": "0000-0002-4702-5294" + "name": "Kelic-Heil, Aleksandra", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { - "name": "Taniuchi, Ryo" + "name": "Klenze, Philipp", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { - "name": "Wang, Yanzhao", - "orcid": "0000-0002-7006-7986" + "name": "Kresan, Dmytro", + "orcid": "0000-0002-7537-2875", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { - "name": "Xarepe, Manuel" - } - ], - "contributors": [ - { - "type": "Other", - "name": "Al-Turany, Mohammad", - "orcid": "0000-0002-8071-4497" + "name": "Kudaibergenova, Eleonora", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { - "type": "Other", - "name": "Boretzky, Konstanze" + "name": "Lagni, Andrea", + "affiliation": "IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain" }, { - "type": "Other", - "name": "Cabanelas, Pablo" + "name": "Lihtar, Ivana", + "affiliation": "RBI Zagreb, HR10000 Zagreb, Croatia" }, { - "type": "Other", - "name": "Chatillon, Audrey" + "name": "Milhomens da Fonseca, Leandro", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { - "type": "Other", - "name": "Douma, Christiaan" + "name": "Morfouace, Pierre", + "orcid": "0000-0002-2131-2199", + "affiliation": "CEA, DAM, DIF, 91297 Arpajon, France" }, { - "type": "Other", - "name": "Feijoo-Fontan, Martina" + "name": "Loeher, Bastian", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { - "type": "Other", - "name": "Falduto, Ashton" + "name": "Mayer, Jan", + "affiliation": "Technical University of Berlin, 10587 Berlin, Germany" }, { - "type": "Other", - "name": "Gra\u00f1a-Gonzalez, Antia" + "name": "Mozumdar, Nikhil", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { - "type": "Other", - "name": "Galiana, Elisabet" + "name": "Panin, Valerii", + "orcid": "0000-0003-3551-5058", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { - "type": "Other", - "name": "Jedele, Andrea" + "name": "Taniuchi, Ryo", + "orcid": "0000-0002-8057-7074", + "affiliation": "School of Physics, Engineering and Technology, University of York, YO10 5DD York, UK" }, { - "type": "Other", - "name": "Gasparic, Igor" + "name": "Wagner, Vadim", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { - "type": "Other", - "name": "Johansson, H\u00e5kan" + "name": "Wang, Yanzhao", + "orcid": "0000-0002-7006-7986", + "affiliation": "Universität zu Köln, 50923 Köln, Germany" }, { - "type": "Other", - "name": "Heiss, Benjamin" + "name": "Whitehead, Matthew", + "affiliation": "School of Physics, Engineering and Technology, University of York, YO10 5DD York, UK" }, + { + "name": "Xarepe, Manuel", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" + } + ], + "contributors": [ { "type": "Other", - "name": "Horvat, Andrea" + "name": "Al-Turany, Mohammad", + "orcid": "0000-0002-8071-4497", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { "type": "Other", - "name": "Inglessi, Alexander" + "name": "Boretzky, Konstanze", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { "type": "Other", - "name": "Klenze, Philipp" + "name": "Cabanelas, Pablo", + "affiliation": "IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain" }, { "type": "Other", - "name": "Kripko, Aron" + "name": "Douma, Christiaan" }, { "type": "Other", - "name": "Kudaibergenova, Eleonora" + "name": "Falduto, Ashton", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { "type": "Other", - "name": "Labiche, Marc" + "name": "Galiana, Elisabet", + "affiliation": "IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain" }, { "type": "Other", - "name": "Lagni, Andrea" + "name": "Heiss, Benjamin" }, { "type": "Other", - "name": "Lihtar, Ivana" + "name": "Inglessi, Alexander" }, { "type": "Other", - "name": "Milhomens da Fonseca, Leandro" + "name": "Kripko, Aron" }, { "type": "Other", - "name": "Wagner, Vadim" + "name": "Labiche, Marc" }, { "type": "Other", - "name": "Plag, Ralf" + "name": "Plag, Ralf", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" }, { "type": "Other", - "name": "Ponnath, Lukas" + "name": "Ponnath, Lukas", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { "type": "Other", @@ -159,37 +220,26 @@ }, { "type": "Other", - "name": "Storck, Sonja" + "name": "Storck, Sonja", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { "type": "Other", - "name": "Syndikus, Ina" + "name": "Syndikus, Ina", + "affiliation": "Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany" }, { "type": "Other", "name": "Tscheuschner, Joachim" }, - { - "type": "Other", - "name": "Whitehead, Matthew" - }, { "type": "Other", "name": "Wongel, Alicia" }, { "type": "Other", - "name": "Zanetti, Lorenzo" - } - ], - "description": "The R3BRoot software is based on the FairRoot framework and can be used to perform Monte Carlo simulations and experimental data analysis of the R3B (Reactions with Relativistic Radioactive Beams) nuclear physics experiments at the GSI-FAIR research center (Facility for Antiproton and Ion Research). The user can create simulated data and/or perform analysis with the same framework. Geant3 and Geant4 transport engines are supported, however, the implemented tasks that create simulated data do not depend on a particular Monte Carlo engine. The framework delivers base classes which enable the users to construct their detectors and/or analysis tasks in a simple way, it also delivers some general functionality like track visualization. Moreover, an interface for reading experimental and/or simulated magnetic field maps is also implemented.", - "related_identifiers": [ - { - "identifier": "https://github.com/R3BRootGroup/R3BRoot/", - "relation": "isSupplementTo", - "resource_type": "software", - "scheme": "url" + "name": "Zanetti, Lorenzo", + "affiliation": "GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany" } - ], - "title": "R3BRoot" + ] } diff --git a/AUTHORS b/AUTHORS index e802bda01..f753fa988 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,14 +1,28 @@ -Alvarez Pol, Hector [https://orcid.org/0000-0001-9643-6252] -Chatillon, Audrey -Garcia-Jimenez, Gabriel -Heil, Michael -Kelic-Heil, Aleksandra -Kresan, Dmytro [https://orcid.org/0000-0002-7537-2875] -Loeher, Bastian -Mayer, Jan -Mozumdar, Nikhil -Panin, Valerii -Rodriguez Sanchez, Jose Luis [https://orcid.org/0000-0002-4702-5294] -Taniuchi, Ryo -Wang, Yanzhao [https://orcid.org/0000-0002-7006-7986] -Xarepe, Manuel +Rodríguez-Sánchez, Jose Luis [j.l.rodriguez.sanchez@udc.es] [https://orcid.org/0000-0002-4702-5294] [CITENI, Industrial Campus of Ferrol, University of Coruña, 15403 Ferrol, Spain] +Alvarez Pol, Hector [https://orcid.org/0000-0001-9643-6252] [IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain] +Chatillon, Audrey [CEA, DAM, DIF, 91297 Arpajon, France] +Feijoo-Fontán, Martina [IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain] +García-Jiménez, Gabriel [IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain] +Gasparic, Igor [RBI Zagreb, HR10000 Zagreb, Croatia] +Graña-González, Antia [https://orcid.org/0000-0002-0842-4110] [CITENI, Industrial Campus of Ferrol, University of Coruña, 15403 Ferrol, Spain] +Heil, Michael [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Horvat, Andrea [RBI Zagreb, HR10000 Zagreb, Croatia] +Jedele, Andrea [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Johansson, Håkan [Institutionen för Fysik, Chalmers Tekniska Högskola, 412 96 Göteborg, Sweden] +Kelic-Heil, Aleksandra [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Klenze, Philipp [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Kresan, Dmytro [https://orcid.org/0000-0002-7537-2875] [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Kudaibergenova, Eleonora [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] +Lagni, Andrea [IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain] +Lihtar, Ivana [RBI Zagreb, HR10000 Zagreb, Croatia] +Milhomens da Fonseca, Leandro [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] +Morfouace, Pierre [https://orcid.org/0000-0002-2131-2199] [CEA, DAM, DIF, 91297 Arpajon, France] +Loeher, Bastian [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Mayer, Jan [Technical University of Berlin, 10587 Berlin, Germany] +Mozumdar, Nikhil [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] +Panin, Valerii [https://orcid.org/0000-0003-3551-5058] [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Taniuchi, Ryo [https://orcid.org/0000-0002-8057-7074] [School of Physics, Engineering and Technology, University of York, YO10 5DD York, UK] +Wagner, Vadim [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] +Wang, Yanzhao [https://orcid.org/0000-0002-7006-7986] [Universität zu Köln, 50923 Köln, Germany] +Whitehead, Matthew [School of Physics, Engineering and Technology, University of York, YO10 5DD York, UK] +Xarepe, Manuel [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d2d5062a4..4e4212272 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,31 +1,18 @@ -Al-Turany, Mohammad [https://orcid.org/0000-0002-8071-4497] -Boretzky, Konstanze -Cabanelas, Pablo +Al-Turany, Mohammad [https://orcid.org/0000-0002-8071-4497] [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Boretzky, Konstanze [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Cabanelas, Pablo [IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain] Douma, Christiaan -Falduto, Ashton -Feijoo-Fontan, Martina -Galiana, Elisabet -Gasparic, Igor -Graña-Gonzalez, Antia -Jedele, Andrea -Johansson, Håkan +Falduto, Ashton [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] +Galiana, Elisabet [IGFAE, University of Santiago de Compostela, 15782 Santiago de Compostela, Spain] Heiss, Benjamin -Horvat, Andrea Inglessi, Alexander -Klenze, Philipp Kripko, Aron -Kudaibergenova, Eleonora Labiche, Marc -Lagni, Andrea -Lihtar, Ivana -Milhomens da Fonseca, Leandro -Plag, Ralf -Ponnath, Lukas +Plag, Ralf [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] +Ponnath, Lukas [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] Rybalchenko, Alexey -Storck, Sonja -Syndikus, Ina +Storck, Sonja [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] +Syndikus, Ina [Technische Universität Darmstadt, Fachbereich Physik, Institut für Kernphysik, 64289 Darmstadt, Germany] Tscheuschner, Joachim -Wagner, Vadim -Whitehead, Matthew Wongel, Alicia -Zanetti, Lorenzo +Zanetti, Lorenzo [GSI Helmholtzzentrum für Schwerionenforschung, 64291 Darmstadt, Germany] diff --git a/meta_update.py b/meta_update.py index b4a76d96e..b55cd05f8 100755 --- a/meta_update.py +++ b/meta_update.py @@ -3,11 +3,11 @@ # # SPDX-License-Identifier: LGPL-3.0-or-later -from argparse import ArgumentParser -import json import re +import json from collections import OrderedDict - +from argparse import ArgumentParser +import os class Manipulator(object): def __str__(self): @@ -16,15 +16,24 @@ def __str__(self): def load(self, filename=None): if filename is None: filename = self.default_filename - with open(filename, 'rb') as fp: - self.data = json.load(fp, object_pairs_hook=OrderedDict) + try: + with open(filename, 'r', encoding='utf8') as fp: + self.data = json.load(fp, object_pairs_hook=OrderedDict) + except FileNotFoundError as e: + print(f'Error: The file {filename} was not found. {e}') + except json.JSONDecodeError as e: + print(f'Error in JSON file: {e}') + raise # Raise the error and stop execution def save(self, filename=None, indent=2): if filename is None: filename = self.default_filename - with open(filename, 'w', encoding='utf8') as fp: - json.dump(self.data, fp, indent=indent) - fp.write('\n') + try: + with open(filename, 'w', encoding='utf8') as fp: + json.dump(self.data, fp, indent=indent, ensure_ascii=False) + fp.write('\n') + except IOError as e: + print(f'Error saving the file {filename}: {e}') @staticmethod def _dict_entry_cmp(dict1, dict2, field1, field2=None): @@ -32,79 +41,47 @@ def _dict_entry_cmp(dict1, dict2, field1, field2=None): field2 = field1 if (field1 in dict1) and (field2 in dict2): return dict1[field1] == dict2[field2] - else: - return False + return False def _handle_person_list_file(self, filename, field_name, **kwargs): - fp = open(filename, 'r', encoding='utf8') - person_list = self.data.setdefault(field_name, []) - for i, line in enumerate(fp, start=0): - line = line.strip() - m = self.findregex.match(line) - if m is None: - raise RuntimeError("Could not analyze line %r" % line) - found_entry = self._find_person_entry(person_list, m.groupdict()) - entry = self.update_person_entry(found_entry, m.groupdict(), - **kwargs) - if found_entry is None: - person_list.insert(i, entry) - - -class CodeMetaManipulator(Manipulator): - default_filename = 'codemeta.json' - findregex = re.compile(r'^(?P[-\w\s]*[-\w]),\s*' - r'(?P[-\w\s]*[-\w])\s*' - r'(?:<(?P\S+@\S+)>)?\s*' - r'(\[(?P\S+)\])?$') - - @classmethod - def _find_person_entry(cls, person_list, matchdict): - # orcid is unique - for entry in person_list: - if cls._dict_entry_cmp(entry, matchdict, '@id', 'orcid'): - return entry - for entry in person_list: - if cls._dict_entry_cmp(entry, matchdict, 'email'): - return entry - if cls._dict_entry_cmp(entry, matchdict, 'familyName') \ - and cls._dict_entry_cmp(entry, matchdict, 'givenName'): - return entry - return None - - @staticmethod - def update_person_entry(entry, matchdict): - if entry is None: - entry = OrderedDict() - entry['@type'] = 'Person' - for field in ('orcid', 'givenName', 'familyName', 'email'): - val = matchdict.get(field, None) - if val is not None: - if field == 'orcid': - entry['@id'] = val - else: - entry[field] = val - return entry - - def update_authors(self): - self._handle_person_list_file('AUTHORS', 'author') - self._handle_person_list_file('CONTRIBUTORS', 'contributor') - - def version(self, new_version): - self.data['softwareVersion'] = new_version + # Check if the file exists before trying to open it + if not os.path.exists(filename): + print(f'File {filename} not found, skipping.') + return + try: + with open(filename, 'r', encoding='utf8') as fp: + person_list = self.data.setdefault(field_name, []) + for i, line in enumerate(fp, start=0): + line = line.strip() + m = self.findregex.match(line) + if m is None: + print(f"Could not analyze line: {line}") + continue # Skip malformed lines + found_entry = self._find_person_entry(person_list, m.groupdict()) + entry = self.update_person_entry(found_entry, m.groupdict(), **kwargs) + if found_entry is None: + person_list.insert(i, entry) + except FileNotFoundError as e: + print(f'Error: The file {filename} was not found. {e}') + except RuntimeError as e: + print(e) class ZenodoManipulator(Manipulator): default_filename = '.zenodo.json' - findregex = re.compile(r'^(?P[-\w\s,]*[-\w])\s*' - r'(?:<(?P\S+@\S+)>)?\s*' - r'(\[https://orcid\.org/(?P\S+)\])?$') + # Improved regular expression to handle different author formats + findregex = re.compile(r'^(?P[-\w\s,]*[-\w])\s*' # Name + r'(?:\[(?P\S+@\S+)\])?\s*' # Optional email + r'(\[https://orcid\.org/(?P\S+)\])?\s*' # Optional ORCID + r'(\[(?P[^\]]+)\])?$') # Optional affiliation @classmethod def _find_person_entry(cls, person_list, matchdict): - # Match on orcid first + # First attempt to match using ORCID for entry in person_list: if cls._dict_entry_cmp(entry, matchdict, 'orcid'): return entry + # If not, attempt to match by name for entry in person_list: if cls._dict_entry_cmp(entry, matchdict, 'name'): return entry @@ -116,16 +93,16 @@ def update_person_entry(entry, matchdict, contributor_type=None): entry = OrderedDict() if contributor_type: entry['type'] = contributor_type - for field in ('name', 'orcid'): + for field in ('name', 'orcid', 'email', 'affiliation'): val = matchdict.get(field, None) if val is not None: entry[field] = val return entry def update_authors(self): + # Update the authors and contributors if the files exist self._handle_person_list_file('AUTHORS', 'creators') - self._handle_person_list_file('CONTRIBUTORS', 'contributors', - contributor_type='Other') + self._handle_person_list_file('CONTRIBUTORS', 'contributors', contributor_type='Other') def save(self, filename=None): super().save(filename, 4) @@ -135,16 +112,15 @@ def version(self, new_version): def main(): - parser = ArgumentParser(description='Update codemeta.json and ' - '.zenodo.json') + parser = ArgumentParser(description='Update .zenodo.json') parser.add_argument('--set-version', dest='newversion') args = parser.parse_args() - for manipulator in (CodeMetaManipulator(), ZenodoManipulator()): + for manipulator in (ZenodoManipulator(),): try: manipulator.load() - except FileNotFoundError as e: - print('*** Skipping {}: {}'.format(manipulator, e)) + except Exception as e: + print(f'*** Error loading {manipulator}: {e}') continue if args.newversion is not None: manipulator.version(args.newversion)