From 6d61e07340a8136b71dc356b5d5531813d0294a6 Mon Sep 17 00:00:00 2001 From: Justin Mahlik Date: Wed, 18 Oct 2023 20:54:25 -0500 Subject: [PATCH] Admin: update setup.py to get version --- setup.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9ebc5d6..0cd9279 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,17 @@ from setuptools import setup, find_packages +import os + + +def get_version(rel_path): + here = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(here, rel_path), 'r') as f: + for line in f.readlines(): + if line.startswith('__version__'): + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + else: + raise RuntimeError('Unable to find version string.') -from flake8_use_fstring import __version__ extra_test = [ 'coverage==4.*', @@ -25,7 +36,7 @@ setup( name='flake8-use-fstring', - version=__version__, + version=get_version('flake8_use_fstring/__init__.py'), description='Flake8 plugin for string formatting style.', url='https://github.com/MichaelKim0407/flake8-use-fstring',