From c2de4988979ac32e7adf0893f5ee3829539a0805 Mon Sep 17 00:00:00 2001 From: Matyas Selmeci Date: Mon, 25 Jun 2018 16:09:12 -0500 Subject: [PATCH] Get version from version.py instead of grepping the osg-configure script --- osg_configure/version.py | 1 + scripts/osg-configure | 4 ++-- setup.py | 13 +++---------- 3 files changed, 6 insertions(+), 12 deletions(-) create mode 100644 osg_configure/version.py diff --git a/osg_configure/version.py b/osg_configure/version.py new file mode 100644 index 00000000..3a5935a2 --- /dev/null +++ b/osg_configure/version.py @@ -0,0 +1 @@ +__version__ = "2.3.1" diff --git a/scripts/osg-configure b/scripts/osg-configure index e4c40c92..fb632196 100755 --- a/scripts/osg-configure +++ b/scripts/osg-configure @@ -7,6 +7,7 @@ import ConfigParser import logging import traceback +from osg_configure.version import __version__ from osg_configure.modules import exceptions from osg_configure.modules import utilities from osg_configure.modules import configfile @@ -15,7 +16,6 @@ from osg_configure.modules import validation ############################# Constant Definitions ############################ -VERSION = '2.3.1' CONFIGURE = 1 VERIFY = 2 LIST = 4 @@ -465,7 +465,7 @@ def main(): normal_exit_message = "Configuration completed, exiting..." error_exit_message = "Critical error occurred, exiting..." - parser = optparse.OptionParser(usage='Usage: %prog [options] arg1 arg2', version='%prog ' + VERSION) + parser = optparse.OptionParser(usage='Usage: %prog [options] arg1 arg2', version='%prog ' + __version__) parser.add_option('-d', '--debug', action='store_true', diff --git a/setup.py b/setup.py index ee4c33a2..85de41c2 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,7 @@ from distutils.core import setup -import glob, re, os +import glob, os - -def get_version(): - """ - Gets version from osg-configure script file - """ - buffer = open('scripts/osg-configure').read() - match = re.search("VERSION\s+=\s+'(.*)'", buffer) - return match.group(1) +from osg_configure.version import __version__ def get_data_files(): @@ -44,7 +37,7 @@ def get_data_files(): setup(name='osg-configure', - version=get_version(), + version=__version__, description='Package for osg-configure and associated scripts', author='Suchandra Thapa', author_email='sthapa@ci.uchicago.edu',