Merge pull request #371 from FrostyX/version-template

Implement --version parameter
This commit is contained in:
Jakub Kadlčík 2020-04-20 09:59:09 +02:00 committed by GitHub
commit 754c2f72bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,22 @@
# Copyright (c) 2008-2009 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
# WARNING: This file is generated from a tito template, do not edit it directly!
"""
Infrastructure for building Spacewalk and Satellite packages from git tags.
"""
__version__ = '$version'

View file

@ -8,3 +8,7 @@ disttag = el5
[tag2]
disttag = el5
[version_template]
destination_file = src/tito/__init__.py
template_file = .tito/templates/__init__.py.tpl

View file

@ -10,6 +10,13 @@
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
# WARNING: This file is generated from a tito template, do not edit it directly!
"""
Infrastructure for building Spacewalk and Satellite packages from git tags.
"""
__version__ = '0.6.13'

View file

@ -20,6 +20,7 @@ import errno
from optparse import OptionParser, SUPPRESS_HELP
from tito import __version__
from tito.common import find_git_root, error_out, debug, get_class_by_name, \
DEFAULT_BUILDER, BUILDCONFIG_SECTION, DEFAULT_TAGGER, \
create_builder, get_project_name, get_relative_project_dir, \
@ -32,6 +33,7 @@ from tito.exception import TitoException
# before we try to dynamically import them based on a string name.
import tito.tagger # NOQA
PROGNAME = "tito"
TITO_PROPS = "tito.props"
RELEASERS_CONF_FILENAME = "releasers.conf"
ASSUMED_NO_TAR_GZ_PROPS = """
@ -194,6 +196,10 @@ class CLI(object):
"""
def main(self, argv):
if "--version" in sys.argv:
print(" ".join([PROGNAME, __version__]))
sys.exit(0)
if len(argv) < 1 or not argv[0] in CLI_MODULES.keys():
self._usage()
sys.exit(1)