From 8cd892b6778e3e7483219268d457f098c2fcf858 Mon Sep 17 00:00:00 2001 From: Jannis Vajen Date: Sat, 29 Feb 2020 02:45:09 +0100 Subject: [PATCH] Fix version display in `flake8 --help` --- flake8_isort.py | 5 ++++- setup.py | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/flake8_isort.py b/flake8_isort.py index 4dccdb2..7b83099 100644 --- a/flake8_isort.py +++ b/flake8_isort.py @@ -13,9 +13,12 @@ from ConfigParser import SafeConfigParser +__version__ = '2.8.1.dev0' + + class Flake8Isort(object): name = 'flake8_isort' - version = '2.3' + version = __version__ isort_unsorted = ( 'I001 isort found an import in the wrong position' ) diff --git a/setup.py b/setup.py index b7e90be..69500e8 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,16 @@ # -*- coding: utf-8 -*- from setuptools import setup +import re + + +def get_version(file="flake8_isort.py"): + with open(file) as f: + for line in f: + m = re.match(r"^__version__ = '(?P.*?)'$", line) + if m: + return m.group('version') + short_description = 'flake8 plugin that integrates isort .' @@ -12,7 +22,7 @@ setup( name='flake8-isort', - version='2.8.1.dev0', + version=get_version(), description=short_description, long_description=long_description, # Get more from http://pypi.python.org/pypi?%3Aaction=list_classifiers