Skip to content

Commit 6a1dbd8

Browse files
committed
Some fixes.
1. Tests fix for non-Windows OSes 2. removed obsolete stuff from setup.py 3. metadata retrieval fixes.
1 parent 45714b5 commit 6a1dbd8

7 files changed

Lines changed: 29 additions & 22 deletions

File tree

Coco/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Coco/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@
6868
import plumbum.cli
6969

7070
class CocoCli(CocoArgs):
71-
DESCRIPTION = 'Coco/R v%s for Python (May 16, 2007) - Translated by %s (%s)\n' % ( MetaData[ 'version' ], MetaData[ 'author' ], MetaData[ 'author_email' ] )
71+
if 'version' in MetaData and 'author' in MetaData and 'author_email' in MetaData:
72+
DESCRIPTION = 'Coco/R v%s for Python (May 16, 2007) - Translated by %s (%s)\n' % ( MetaData[ 'version' ], MetaData[ 'author' ], MetaData[ 'author_email' ] )
73+
else:
74+
DESCRIPTION = 'Coco/R v??? for Python (May 16, 2007) - Translated by ??? (??)\nWE CANNOT RETRIEVE THE METADATA correctly, SOMETHING GONE WRONG, FIX IT: ' + repr(MetaData)
7275
def main(self, ATGName:plumbum.cli.ExistingFile):
7376
Tab.SetDDT( self )
7477
dirName, fileName = os.path.split(ATGName)

Coco/frames/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Coco/setupInfo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@
66
if os.path.isfile(setupCfgPath):
77
MetaData = read_configuration(setupCfgPath)["metadata"]
88
else:
9-
from pkg_resources import get_distribution
10-
MetaData = get_distribution('Coco').__dict__
9+
try:
10+
from importlib import metadata
11+
MetaData = metadata.metadata('CocoPy')
12+
except ImportError:
13+
from pkg_resources import get_distribution, DistributionNotFound
14+
try:
15+
d = get_distribution('CocoPy')
16+
except DistributionNotFound:
17+
d = get_distribution('Coco')
18+
MetaData = d.__dict__
1119

1220
VersionInfo = {
1321
'1.1.0rc': {

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ classifiers =
3232

3333
[options]
3434
zip_safe = True
35-
packages = Coco
35+
packages = Coco, Coco.frames
36+
include_package_data = True
3637
setup_requires = setuptools_scm;
3738
test_suite = testSuite.__main__
3839

setup.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
#!/usr/bin/env python3
2-
import os
32
from setuptools import setup
4-
from setuptools.config import read_configuration
5-
6-
curDir = os.path.dirname(__file__)
7-
setupCfgPath=os.path.join(curDir, "setup.cfg")
8-
cfg = read_configuration(setupCfgPath)
9-
10-
#print(cfg)
11-
cfg["options"].update(cfg["metadata"])
12-
cfg=cfg["options"]
13-
setup(use_scm_version = True, **cfg)
14-
15-
16-
17-
18-
3+
if __name__ == "__main__":
4+
setup(use_scm_version = True)

testSuite/__main__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
import shutil
55
import unittest
66
import subprocess
7+
import platform
78

89
from .util import *
910

11+
interpreter = "python"
12+
13+
if platform.system() != "win32":
14+
interpreter += "3"
15+
16+
1017
TARGET = ''
1118
NEEDS = [ ]
1219

@@ -39,7 +46,7 @@ def setUpClass():
3946
print('Running test: '+name)
4047
with subprocess.Popen(
4148
[
42-
"python",
49+
interpreter,
4350
"-m", self._compiler, "-i", '-O', tmpDir, testFileName
4451
],
4552
shell=True,
@@ -104,4 +111,4 @@ def __call__(self):
104111
]
105112

106113
tester = CocoTester( 'Coco', 'py', suite )
107-
tester()
114+
tester()

0 commit comments

Comments
 (0)