From 3f8a9ca11c4c3ef6cb3282f9b2c9b9a3905f9cf3 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 26 Sep 2015 21:38:58 +0100 Subject: [PATCH] Added initialisation and version getting function --- details.json | 11 +++++++++++ printr/__init__.py | 17 ++++++++++++++++- setup.py | 24 ++++++++++++++---------- 3 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 details.json diff --git a/details.json b/details.json new file mode 100644 index 0000000..da0c39f --- /dev/null +++ b/details.json @@ -0,0 +1,11 @@ +{ + 'name' : 'Python-Printr', + 'packages' : ['printr'], + 'version' : '0.0.1', + 'description' : 'Python module to allow a print line to be updated after printing', + 'author' : 'Jake Howard', + 'author_email' : 'me@theorangeone.net ', + 'url' : 'https://github.com/RealOrangeOne/Printr', + 'license':'MIT', + 'platforms':['any'] +} \ No newline at end of file diff --git a/printr/__init__.py b/printr/__init__.py index 026e0b3..dbc1e59 100644 --- a/printr/__init__.py +++ b/printr/__init__.py @@ -1,3 +1,18 @@ +# Import python modules +import os +from json import loads as json_loads + +# Import Printr Modules from .simplePrintr import SimplePrintr from .itterPrintr import ItterPrintr -from .ellipsisPrintr import EllipsisPrintr \ No newline at end of file +from .ellipsisPrintr import EllipsisPrintr + +# Initialise +PRINTR_PATH = os.path.dirname(os.path.abspath(__file__)) + +with open(PRINTR_PATH + '/details.json') as file: + PRINTR_DETAILS = json_loads(file) + + +def get_version(): + return PRINTR_DETAILS.version diff --git a/setup.py b/setup.py index 79d0add..8bbee43 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,24 @@ from distutils.core import setup - +from json import loads as json_loads LONG_DESCRIPTION = None try: LONG_DESCRIPTION = open('README.md').read() except: pass +DETAILS = None +with open('details.json') as file: + DETAILS = json_loads(file) + setup( - name = 'Python-Printr', - packages = ['printr'], - version = '0.0.1', - description = 'Python module to allow a print line to be updated after printing', + name = DETAILS.name, + packages = DETAILS.packages, + version = DETAILS.version, + description = DETAILS.description, long_description = LONG_DESCRIPTION, - author = 'Jake Howard', - author_email = 'me@theorangeone.net ', - url = 'https://github.com/RealOrangeOne/Printr', - license='MIT', - platforms=['any'] + author = DETAILS.author, + author_email = DETAILS.author_email, + url = DETAILS.url, + license = DETAILS.license, + platforms = DETAILS.platform ) \ No newline at end of file