diff --git a/bin/publish b/bin/publish new file mode 100755 index 0000000..17b13e7 --- /dev/null +++ b/bin/publish @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import pathlib +import sys + +rootdir = pathlib.Path(__file__).parent.parent +sys.path.append(str(rootdir)) + +import odp.catalog.main + +if __name__ == '__main__': + odp.catalog.main.publish() diff --git a/odp/catalog/main.py b/odp/catalog/main.py index cade862..7160e68 100644 --- a/odp/catalog/main.py +++ b/odp/catalog/main.py @@ -1,14 +1,7 @@ -#!/usr/bin/env python - import logging -import pathlib -import sys from sqlalchemy import select -rootdir = pathlib.Path(__file__).parent.parent.parent.parent -sys.path.append(str(rootdir)) - from odp.catalog.datacite import DataCitePublisher from odp.catalog.saeon import SAEONPublisher from odp.const import ODPCatalog @@ -26,7 +19,7 @@ } -def main(): +def publish(): logger.info('PUBLISHING STARTED') try: for catalog_id in Session.execute(select(Catalog.id)).scalars(): @@ -37,7 +30,3 @@ def main(): except Exception as e: logger.critical(f'PUBLISHING ABORTED: {str(e)}') - - -if __name__ == '__main__': - main()