From c180af8ea9c16a57530ef56e26e408fa5e49da28 Mon Sep 17 00:00:00 2001 From: Wade Barnes Date: Tue, 24 Jan 2023 10:26:59 -0800 Subject: [PATCH] Fix metadata.json file not found error during install. - The code was looking one `/sovrin` level too deep. Signed-off-by: Wade Barnes --- setup.py | 24 ++++++++++++------------ sovrin/__metadata__.py | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 820291e5..60fa5e94 100644 --- a/setup.py +++ b/setup.py @@ -7,30 +7,30 @@ try: - SETUP_DIRNAME = os.path.dirname(__file__) + SETUP_DIRNAME = os.path.abspath(os.path.dirname(__file__)) except NameError: # We're probably being frozen, and __file__ triggered this NameError # Work around this - SETUP_DIRNAME = os.path.dirname(sys.argv[0]) + SETUP_DIRNAME = os.path.abspath(os.path.dirname(sys.argv[0])) -if SETUP_DIRNAME != '': - os.chdir(SETUP_DIRNAME) +# if SETUP_DIRNAME != '': +# os.chdir(SETUP_DIRNAME) -SETUP_DIRNAME = os.path.abspath(SETUP_DIRNAME) +# SETUP_DIRNAME = os.path.abspath(SETUP_DIRNAME) -METADATA = os.path.join(SETUP_DIRNAME, 'sovrin', '__metadata__.py') -# Load the metadata using exec() -# so we don't trigger an import of ioflo.__init__ -exec(compile(open(METADATA).read(), METADATA, 'exec')) +METADATA = {'__file__': os.path.join(SETUP_DIRNAME, 'sovrin', '__metadata__.py')} + +with open(METADATA['__file__'], 'r') as f: + exec(f.read(), METADATA) setup( name='sovrin', - version=__version__, + version=METADATA['__version__'], description='Sovrin node', url='https://github.com/sovrin-foundation/sovrin', - author=__author__, + author=METADATA['__author__'], author_email='support@sovrin.org', - license=__license__, + license=METADATA['__license__'], keywords='Sovrin Genesis Transactions', packages=find_packages(exclude=['docs', 'docs*']), package_data={ diff --git a/sovrin/__metadata__.py b/sovrin/__metadata__.py index cc6af345..64183ad4 100644 --- a/sovrin/__metadata__.py +++ b/sovrin/__metadata__.py @@ -5,7 +5,7 @@ import os import json -METADATA_FILENAME = 'sovrin/metadata.json' +METADATA_FILENAME = 'metadata.json' METADATA_FILE = os.path.join( os.path.abspath(os.path.dirname(__file__)), METADATA_FILENAME)