From 0913c58d875b10f5c798788e22d0bc6a88468b33 Mon Sep 17 00:00:00 2001 From: Sertan Senturk Date: Wed, 22 Jan 2020 01:38:38 +0000 Subject: [PATCH 1/4] incremented dev version --- setup.py | 12 +++++++++++- src/tomato/__init__.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 5e0e596..3799afb 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import configparser import os +import re import subprocess import zipfile from io import BytesIO @@ -11,7 +12,16 @@ # Get version with open(os.path.join(TOMATO_DIR, "tomato", "__init__.py")) as version_file: - __version__ = version_file.read().strip() + init_contents = version_file.read().strip() + + exp = r"^__version__ = ['\"]([^'\"]*)['\"]" + mo = re.search(exp, init_contents, re.M) + if mo: + __version__ = mo.group(1) + else: + raise RuntimeError("Unable to find version string in %s." + % (version_file,)) + # Get the long description from the README file here = os.path.abspath(os.path.dirname(__file__)) diff --git a/src/tomato/__init__.py b/src/tomato/__init__.py index ef91994..9a29f13 100644 --- a/src/tomato/__init__.py +++ b/src/tomato/__init__.py @@ -1 +1 @@ -__version__ = '0.14.0' +__version__ = "tomato-0.15.0.dev0" \ No newline at end of file From 1d4c81604b6550ec8ceb5c6749d3e6cf8e990929 Mon Sep 17 00:00:00 2001 From: Sertan Senturk Date: Thu, 23 Jan 2020 00:33:34 +0000 Subject: [PATCH 2/4] created get_version and get_long_description methods in setup.py --- setup.py | 56 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/setup.py b/setup.py index 3799afb..8b55751 100644 --- a/setup.py +++ b/setup.py @@ -8,28 +8,42 @@ from setuptools import find_packages, setup +HERE = os.path.abspath(os.path.dirname(__file__)) TOMATO_DIR = "src" -# Get version -with open(os.path.join(TOMATO_DIR, "tomato", "__init__.py")) as version_file: - init_contents = version_file.read().strip() - exp = r"^__version__ = ['\"]([^'\"]*)['\"]" - mo = re.search(exp, init_contents, re.M) - if mo: - __version__ = mo.group(1) - else: - raise RuntimeError("Unable to find version string in %s." - % (version_file,)) +def get_version(): + """ Read version from __init__.py + Raises: + ValueError: if __init__ is not read, or __version__ is not in __init__ -# Get the long description from the README file -here = os.path.abspath(os.path.dirname(__file__)) -try: - with open(os.path.join(here, "README.md"), encoding="utf-8") as f: - long_description = f.read() -except FileNotFoundError: # not necessary, e.g. in Docker - long_description = "" + Returns: + str -- value of __version__ as defined in __init__.py + """ + version_file2 = os.path.join(HERE, TOMATO_DIR, "tomato", "__init__.py") + with open(version_file2) as f: + init_contents = f.read().strip() + + exp = r"^__version__ = ['\"]([^'\"]*)['\"]" + mo = re.search(exp, init_contents, re.M) + if mo: + return mo.group(1) + else: + raise ValueError("Unable to find version string in %s." % (f,)) + + +def get_long_description(): + """Get the long description from the README file + + Returns: + str -- the README content in the markdown format + """ + try: + with open(os.path.join(HERE, "README.md"), encoding="utf-8") as f: + return f.read() + except FileNotFoundError: # not necessary, e.g. in Docker + return "" class BinarySetup: @@ -109,20 +123,20 @@ def _download_binary(fpath, bin_url, sys_os): setup( name="tomato", - version=__version__, + version=get_version(), author="Sertan Senturk", author_email="contact AT sertansenturk DOT com", maintainer="Sertan Senturk", maintainer_email="contact AT sertansenturk DOT com", url="https://github.com/sertansenturk/tomato", description="Turkish-Ottoman Makam (M)usic Analysis TOolbox", - long_description=long_description, + long_description=get_long_description(), long_description_content_type="text/markdown", download_url=( "https://github.com/sertansenturk/tomato.git" - if "dev" in __version__ + if "dev" in get_version() else "https://github.com/sertansenturk/tomato/releases/tag/" - "v{0:s}".format(__version__) + "v{0:s}".format(get_version()) ), classifiers=[ "Development Status :: 4 - Beta", From 2230318469d56310a3efc409dbf7d5bc48e7b25c Mon Sep 17 00:00:00 2001 From: Sertan Senturk Date: Thu, 23 Jan 2020 00:38:14 +0000 Subject: [PATCH 3/4] Temporarily downgraded version to fix master version --- src/tomato/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tomato/__init__.py b/src/tomato/__init__.py index 9a29f13..75200ba 100644 --- a/src/tomato/__init__.py +++ b/src/tomato/__init__.py @@ -1 +1 @@ -__version__ = "tomato-0.15.0.dev0" \ No newline at end of file +__version__ = "tomato-0.14.0" \ No newline at end of file From 5b281aa71ad4f4967284f274e59ba8902f71975f Mon Sep 17 00:00:00 2001 From: Sertan Senturk Date: Thu, 23 Jan 2020 00:39:48 +0000 Subject: [PATCH 4/4] Fixed version to major.minor.fix format --- src/tomato/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tomato/__init__.py b/src/tomato/__init__.py index 75200ba..9e78220 100644 --- a/src/tomato/__init__.py +++ b/src/tomato/__init__.py @@ -1 +1 @@ -__version__ = "tomato-0.14.0" \ No newline at end of file +__version__ = "0.14.0"