From 6fb4a0425d52b0f58194d5b1e96322bde18cee82 Mon Sep 17 00:00:00 2001 From: Authapon Kongkaew Date: Fri, 30 Aug 2019 00:16:41 +0700 Subject: [PATCH] Fix bug can't read version --- .travis.yml | 4 ++-- GrafanaSnapshot/version.py | 3 +++ VERSION | 1 - setup.py | 20 ++++++++++++++------ 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 GrafanaSnapshot/version.py delete mode 100644 VERSION diff --git a/.travis.yml b/.travis.yml index 39e90fc..168115d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ deploy: provider: pypi user: ohmrefresh password: - secure: YiB17hLi0ZgGXnV07/8PKhgo5UgyKKLIXYSSMwhoDJnc4GaFB3bynxfDpFevMQgzkmecLYh/opAQtLn8GNYErmQruEWhU50Zw12rQQIi6SLdC+9iLYtZKNlVdiOkxV6M3Xc0k6so3oUa7BmEHsSXa4crZfwzY7iOI08Ak3hj4H33skbuW7ojw72GllvRq2AFIf7ld4fXYvyBmMaWNBISRazD9EEFC6L6eh55+Zw4Z9XUHm4Ud6nQ4eVvSTiZG12runf7pUpm8lUIIrksdFyqpF2wwIXOOC+mAzhW8cqPgPJ7eNCiasr09oMmTWVi8Aj6i3AAIM+tcE9m75tMi/lTOJ7Dl7cbEjTJPR/Nfl5dUnsASHLk/izjTJkIOT8g1ev7N3dO3zEkgGL6LfeRNUaekKg1T9q0nBJsxjxPqp8ZfPo/2hJsI57BZsze2W1wYSowjr6X+RvsDx+GgSm6J/mJjlXxamHNTK5B8HF9yHRLvpst/gRSKE0NGOtzAkucMdng7dAypi2vf3aycNVix/xNTEmUUF53uAn3AkYayqYE4fqPGRgl+oqZaNSbDkQN5qILaFkcrIJUH/CIenErP2Ojx1/TegsL0XLQihlpRiCFYYjcryjLYs7DXdR5En3Xq/8yCUs/KTID18l6k+Tql28UcxhiT8X4MTM0MwQ2QPNbbEM= + secure: IfYpQNthr+P+GvCXxb77CQ3CVd+1puT/7g1mB+48DXt3oCnRQBNzGikkEktBxvLpQkoApuotsMOmoTJaqhF6sNRO4HAHnpx5xQ2bRqS2iV1areO1jHJjRqcAf/33bI4DQiM2zLEoqLqN6DW50QmkkVF/OJ2bIH9E13Ku+IePK0PFVo9ywPozyFZJqVCaXZqDm01WP3D0gzq3fB2ugUfaeHrz3ZBbv3KfyQXpTyOdKV3npCPt0RQydpOJSD7OCBHRkFN1vuJXUOf2DVcQ5/bljH5gXKG/ut/03Tyn7KCX1gvrYo0VKRWKPuBVJf9TaPkeAerebrJRNXOZXXk1WsjdgglanE+m4L+idjjZYOSSJwaS05FN8mVSRmzUELjxYkj5kY4nq8DbK/v/+unSu469F3X/dKeAAflIZz9sPtRQh+l2MAs9pEY0KK6kYAmuJhsdgzUeokLunx74g7JZyTMlmzEH4mHFP5jrC1XaZRwX98BUBopyjDv+ID8v7w2nNGSQeOUHFdteSc/egUGpcwbDO/Epif3CL/nb+Jiga+770UmrhHSR7Es+iGZxR/2OeykDh0haSu7ivU8oyMdk6gyYaqDmp5jl1XCuUDm9SjJb8tqFXawT6glo58XFPCEUZM5oy+63AaYQNqH8nbEY4FbrNB4ysV9N3i0bCUpEMjfuq2g= on: tags: true distributions: sdist bdist_wheel - repo: ascendcorp/grafana-snapshot + repo: ohmrefresh/GrafanaSnapshot \ No newline at end of file diff --git a/GrafanaSnapshot/version.py b/GrafanaSnapshot/version.py new file mode 100644 index 0000000..9f0e2d7 --- /dev/null +++ b/GrafanaSnapshot/version.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +VERSION = "0.2" diff --git a/VERSION b/VERSION deleted file mode 100644 index 7dff5b8..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.2.1 \ No newline at end of file diff --git a/setup.py b/setup.py index 2e72a88..d081031 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,28 @@ from setuptools import setup, find_packages -import os +import re +# Read version from file without loading the module +with open('GrafanaSnapshot/version.py', 'r') as version_file: + version_match = re.search(r"^VERSION ?= ?['\"]([^'\"]*)['\"]", + version_file.read(), re.M) -def read(filename): - return open(os.path.join(os.path.dirname(__file__), filename)).read() +with open("README.md", "r") as fh: + long_description = fh.read() +if version_match: + VERSION = version_match.group(1) +else: + VERSION = '0.1' # setup( name="grafana-snapshot", - version=read('VERSION'), + version=VERSION, author="Authapon Kongkaew, Nitipat Phiphatprathuang, Panchorn Lertvipada", author_email="ohmrefresh@gmail.com, banknitipat@gmail.com, nonpcn@gmail.com", description="Task a grafana snapshot", - long_description=read('README.md'), + long_description=long_description, long_description_content_type="text/markdown", - url="https://github.com/ascendcorp/GrafanaSnapshot.git", + url="https://github.com/ohmrefresh/GrafanaSnapshot.git", license="MIT", packages=find_packages(), install_requires=['requests', 'grafana_api'],