diff --git a/Coco/__init__.py b/Coco/__init__.py new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/Coco/__init__.py @@ -0,0 +1 @@ + diff --git a/Coco/__main__.py b/Coco/__main__.py index 6e969f7..d60c22d 100644 --- a/Coco/__main__.py +++ b/Coco/__main__.py @@ -68,7 +68,10 @@ import plumbum.cli class CocoCli(CocoArgs): - DESCRIPTION = 'Coco/R v%s for Python (May 16, 2007) - Translated by %s (%s)\n' % ( MetaData[ 'version' ], MetaData[ 'author' ], MetaData[ 'author_email' ] ) + if 'version' in MetaData and 'author' in MetaData and 'author_email' in MetaData: + DESCRIPTION = 'Coco/R v%s for Python (May 16, 2007) - Translated by %s (%s)\n' % ( MetaData[ 'version' ], MetaData[ 'author' ], MetaData[ 'author_email' ] ) + else: + DESCRIPTION = 'Coco/R v??? for Python (May 16, 2007) - Translated by ??? (??)\nWE CANNOT RETRIEVE THE METADATA correctly, SOMETHING GONE WRONG, FIX IT: ' + repr(MetaData) def main(self, ATGName:plumbum.cli.ExistingFile): Tab.SetDDT( self ) dirName, fileName = os.path.split(ATGName) diff --git a/Coco/frames/__init__.py b/Coco/frames/__init__.py new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/Coco/frames/__init__.py @@ -0,0 +1 @@ + diff --git a/Coco/setupInfo.py b/Coco/setupInfo.py index 480ef77..eca3729 100644 --- a/Coco/setupInfo.py +++ b/Coco/setupInfo.py @@ -6,8 +6,16 @@ if os.path.isfile(setupCfgPath): MetaData = read_configuration(setupCfgPath)["metadata"] else: - from pkg_resources import get_distribution - MetaData = get_distribution('Coco').__dict__ + try: + from importlib import metadata + MetaData = metadata.metadata('CocoPy') + except ImportError: + from pkg_resources import get_distribution, DistributionNotFound + try: + d = get_distribution('CocoPy') + except DistributionNotFound: + d = get_distribution('Coco') + MetaData = d.__dict__ VersionInfo = { '1.1.0rc': { diff --git a/setup.cfg b/setup.cfg index 9290434..ef49f93 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,8 @@ classifiers = [options] zip_safe = True -packages = Coco +packages = Coco, Coco.frames +include_package_data = True setup_requires = setuptools_scm; test_suite = testSuite.__main__ diff --git a/setup.py b/setup.py index 82d941f..cf98b59 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,4 @@ #!/usr/bin/env python3 -import os from setuptools import setup -from setuptools.config import read_configuration - -curDir = os.path.dirname(__file__) -setupCfgPath=os.path.join(curDir, "setup.cfg") -cfg = read_configuration(setupCfgPath) - -#print(cfg) -cfg["options"].update(cfg["metadata"]) -cfg=cfg["options"] -setup(use_scm_version = True, **cfg) - - - - - +if __name__ == "__main__": + setup(use_scm_version = True) diff --git a/testSuite/__main__.py b/testSuite/__main__.py index f91a9a8..9dd1597 100644 --- a/testSuite/__main__.py +++ b/testSuite/__main__.py @@ -4,9 +4,16 @@ import shutil import unittest import subprocess +import platform from .util import * +interpreter = "python" + +if platform.system() != "win32": + interpreter += "3" + + TARGET = '' NEEDS = [ ] @@ -39,7 +46,7 @@ def setUpClass(): print('Running test: '+name) with subprocess.Popen( [ - "python", + interpreter, "-m", self._compiler, "-i", '-O', tmpDir, testFileName ], shell=True, @@ -104,4 +111,4 @@ def __call__(self): ] tester = CocoTester( 'Coco', 'py', suite ) -tester() \ No newline at end of file +tester()