Commit 7a29880b authored by Kevin Lyda's avatar Kevin Lyda 💬
Browse files

Add version info.

parent ce2732ec
......@@ -31,23 +31,31 @@ import chkcrontab_lib as check
from optparse import OptionParser
from argparse import ArgumentParser
try:
from _version import __version__
except ImportError:
__version__ = 'unknown'
def main(argv):
"""main program."""
parser = ArgumentParser(
description="Parse crontab files and check each type of line for potential syntax errors.")
description='Parse crontab files; check for potential syntax errors.',
version=__version__)
parser.add_argument('crontab', help='the crontab file to parse')
parser.add_argument('-w', '--whitelist', action='append',
dest='whitelisted_users',
help='A user to ignore when warning of unrecognized users This argument may be passed multiple times.',
help='user to ignore when warning of unrecognized users; may be passed multiple times',
default=['postgres', 'buildbot'])
parser.add_argument('-n', '--no-check-passwd', action='store_false',
dest='check_passwd', help='Disable user lookup')
dest='check_passwd', help='disable user lookup')
parser.add_argument('-q', '--quiet', action='store_true',
dest='quiet', help="Be quiet")
dest='quiet', help='be quiet')
args = parser.parse_args()
log = check.LogCounter()
if args.version:
print('Version %s\n' % __version__)
return 0
if not args.quiet:
print('Checking correctness of %s' % args.crontab)
return check.check_crontab(args, log)
......
......@@ -26,9 +26,9 @@ from distutils.command.install import install
from distutils.core import setup
from distutils.core import Command
BASE_DIR = os.path.dirname(globals().get('__file__', os.getcwd()))
VERSION = os.popen2('git describe --dirty="*" --always')[1].readline().strip()
open('_version.py', 'w').write('__version__ = "%s"\n' % VERSION)
class TestCmd(Command):
description = 'Runs all available tests.'
......@@ -171,13 +171,13 @@ if 'setuptools' not in dir():
setup(
cmdclass=cmdclass,
name='chkcrontab',
version='1.7',
version=VERSION,
url='http://code.google.com/p/chkcrontab',
author='Kevin Lyda',
author_email='lyda@google.com',
description='A tool to detect crontab errors',
long_description=open('README.rst').read(),
py_modules=['chkcrontab_lib'],
py_modules=['chkcrontab_lib', '.version'],
scripts=['chkcrontab'],
keywords='check lint crontab',
# See http://pypi.python.org/pypi?%3Aaction=list_classifiers
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment