diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2019-07-03 15:47:18 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2019-07-03 16:12:43 +0530 |
commit | 097982d3484f30e32dc03113944186f471f36505 (patch) | |
tree | 07abb95c7988745ef546c9c2bb7307aefc984df8 | |
parent | 166ba97e36d7b53e7fa53d7853a8b9f5a509503c (diff) | |
download | configshell-fb-097982d3484f30e32dc03113944186f471f36505.tar.gz |
configshell: export __version__ variable
$ python -c "import configshell_fb; print(configshell_fb.__version__)"
1.1.25
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
-rw-r--r-- | configshell/__init__.py | 7 | ||||
-rwxr-xr-x | setup.py | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/configshell/__init__.py b/configshell/__init__.py index 8580669..70af749 100644 --- a/configshell/__init__.py +++ b/configshell/__init__.py @@ -15,7 +15,7 @@ License for the specific language governing permissions and limitations under the License. ''' -if __name__ == "configshell": +if __name__ == 'configshell-fb': from warnings import warn warn("'configshell' package name for configshell-fb is deprecated, please" + " instead import 'configshell_fb'", UserWarning, stacklevel=2) @@ -25,3 +25,8 @@ from .log import Log from .node import ConfigNode, ExecutionError from .prefs import Prefs from .shell import ConfigShell + +__version__ = '1.1.25' +__url__ = 'http://github.com/open-iscsi/configshell-fb' +__description__ = 'A framework to implement simple but nice CLIs.' +__license__ = 'Apache 2.0' @@ -16,8 +16,22 @@ License for the specific language governing permissions and limitations under the License. ''' +import os +import re from setuptools import setup +# Get version without importing. +init_file_path = os.path.join(os.path.dirname(__file__), 'configshell/__init__.py') + +with open(init_file_path) as f: + for line in f: + match = re.match(r"__version__.*'([0-9.]+)'", line) + if match: + version = match.group(1) + break + else: + raise Exception("Couldn't find version in setup.py") + setup( name = 'configshell-fb', version = '1.1.25', |