Skip to content

Commit

Permalink
Some fixes.
Browse files Browse the repository at this point in the history
1. Tests fix for non-Windows OSes
2. removed obsolete stuff from setup.py
3. metadata retrieval fixes.
  • Loading branch information
KOLANICH committed Jan 27, 2020
1 parent 45714b5 commit 6a1dbd8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
1 change: 1 addition & 0 deletions Coco/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

5 changes: 4 additions & 1 deletion Coco/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Coco/frames/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 10 additions & 2 deletions Coco/setupInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down
18 changes: 2 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 9 additions & 2 deletions testSuite/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [ ]

Expand Down Expand Up @@ -39,7 +46,7 @@ def setUpClass():
print('Running test: '+name)
with subprocess.Popen(
[
"python",
interpreter,
"-m", self._compiler, "-i", '-O', tmpDir, testFileName
],
shell=True,
Expand Down Expand Up @@ -104,4 +111,4 @@ def __call__(self):
]

tester = CocoTester( 'Coco', 'py', suite )
tester()
tester()

0 comments on commit 6a1dbd8

Please sign in to comment.