From 6374680e7286636bb282302d04b0afc4ab88d67b Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Mon, 21 May 2018 17:14:28 +1000 Subject: [PATCH] Consolidated httpbin version string into a single location in file VERSION. Also added the new VERSION file to the manifest. Signed-off-by: Brett Randall --- MANIFEST.in | 2 +- httpbin/VERSION | 1 + httpbin/core.py | 5 ++++- setup.py | 5 ++++- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 httpbin/VERSION diff --git a/MANIFEST.in b/MANIFEST.in index 9375654..a2b13cf 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -include README.rst LICENSE AUTHORS requirements.txt test_httpbin.py +include httpbin/VERSION README.rst LICENSE AUTHORS requirements.txt test_httpbin.py recursive-include httpbin/templates * recursive-include httpbin/static * diff --git a/httpbin/VERSION b/httpbin/VERSION new file mode 100644 index 0000000..ac39a10 --- /dev/null +++ b/httpbin/VERSION @@ -0,0 +1 @@ +0.9.0 diff --git a/httpbin/core.py b/httpbin/core.py index 0a00a82..d1b3ead 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -30,6 +30,9 @@ from .helpers import get_headers, status_code, get_dict, get_request_range, chec from .utils import weighted_choice from .structures import CaseInsensitiveDict +with open(os.path.join(os.path.realpath(os.path.dirname(__file__)), 'VERSION')) as version_file: + version = version_file.read().strip() + ENV_COOKIES = ( '_gauges_unique', '_gauges_unique_year', @@ -78,7 +81,7 @@ template = { "url": "https://kennethreitz.org", }, # "termsOfService": "http://me.com/terms", - "version": "0.9.0" + "version": version }, "host": "httpbin.org", # overrides localhost:5000 "basePath": "/", # base bash for blueprint registration diff --git a/setup.py b/setup.py index 7e973ae..8f9ebc5 100644 --- a/setup.py +++ b/setup.py @@ -5,9 +5,12 @@ import io # long_description = io.open( # os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8').read() +with open(os.path.join(os.path.realpath(os.path.dirname(__file__)), 'httpbin', 'VERSION')) as version_file: + version = version_file.read().strip() + setup( name="httpbin", - version="0.9.0", + version=version, description="HTTP Request and Response Service", # long_description=long_description,