public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/
Date: Thu, 26 Feb 2015 20:12:43 +0000 (UTC)	[thread overview]
Message-ID: <1420091887.89beddf2ccfb320bac1f8d5b2e5964bf4890ac78.dolsen@gentoo> (raw)
Message-ID: <20150226201243.rA5pg_iAOHv2TRyXzWtyaXcJocdx345Os6WJJAAsgmI@z> (raw)

commit:     89beddf2ccfb320bac1f8d5b2e5964bf4890ac78
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu May 30 19:34:06 2013 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan  1 05:58:07 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=89beddf2

Migrate version to use snakeoil's format_version() to append git commit info.

This will make tagging releases easy as well as providing better debug info while running live versions of the software.

---
 catalyst/main.py    | 11 +++++++----
 catalyst/version.py | 23 +++++++++++++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/catalyst/main.py b/catalyst/main.py
index 7fea4e7..ae0abae 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -14,7 +14,6 @@ import os.path
 __selfpath__ = os.path.abspath(os.path.dirname(__file__))
 
 
-from . import __version__
 import catalyst.config
 import catalyst.util
 from catalyst.contents import ContentsMap, CONTENTS_DEFINITIONS
@@ -22,6 +21,7 @@ from catalyst.defaults import confdefaults, option_messages
 from catalyst.hash_utils import HashMap, HASH_DEFINITIONS
 from catalyst.lock import LockInUse
 from catalyst.support import CatalystError, find_binary
+from catalyst.version import get_version
 
 
 conf_values={}
@@ -57,7 +57,7 @@ catalyst -f stage1-specfile.spec
 
 
 def version():
-	print "Catalyst, version "+__version__
+	print get_version()
 	print "Copyright 2003-2008 Gentoo Foundation"
 	print "Copyright 2008-2012 various authors"
 	print "Distributed under the GNU General Public License version 2.1\n"
@@ -169,8 +169,8 @@ def build_target(addlargs):
 
 def main():
 
-	version()
 	if os.getuid() != 0:
+		version()
 		# catalyst cannot be run as a normal user due to chroots, mounts, etc
 		print "!!! catalyst: This script requires root privileges to operate"
 		sys.exit(2)
@@ -204,11 +204,12 @@ def main():
 	run = False
 	for o, a in opts:
 		if o in ("-h", "--help"):
+			version()
 			usage()
 			sys.exit(1)
 
 		if o in ("-V", "--version"):
-			print "Catalyst version "+__version__
+			print get_version()
 			sys.exit(1)
 
 		if o in ("-d", "--debug"):
@@ -264,6 +265,8 @@ def main():
 		usage()
 		sys.exit(2)
 
+	# made it this far so start by outputting our version info
+	version()
 	# import configuration file and import our main module using those settings
 	parse_config(myconfig)
 

diff --git a/catalyst/version.py b/catalyst/version.py
new file mode 100644
index 0000000..03c77e4
--- /dev/null
+++ b/catalyst/version.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python -OO
+
+# Maintained in full by:
+# Catalyst Team <catalyst@gentoo.org>
+# Release Engineering Team <releng@gentoo.org>
+# Copyright: 2011 Brian Harring <ferringb@gmail.com>
+# License: BSD/GPL2
+# Copied & edited by: Brian Dolbec <dolsen@gentoo.org>
+
+'''Version information and/or git version information
+'''
+
+from snakeoil.version import format_version
+
+__version__="rewrite-git"
+_ver = None
+
+def get_version():
+	"""Return: a string describing our version."""
+	global _ver
+	if _ver is None:
+		_ver = format_version('catalyst',__file__, __version__)
+	return _ver


             reply	other threads:[~2015-02-26 20:12 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01  5:59 Brian Dolbec [this message]
2015-02-26 20:12 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2017-11-22 15:52 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2017-03-16 22:57 Brian Dolbec
2017-03-16 22:57 Brian Dolbec
2017-03-11  9:35 Brian Dolbec
2017-03-11  7:07 Brian Dolbec
2017-03-10 18:38 Brian Dolbec
2017-03-09 10:02 Brian Dolbec
2017-03-09  9:39 Brian Dolbec
2015-11-21  1:33 Brian Dolbec
2015-11-21  1:33 Brian Dolbec
2015-11-21  1:33 Brian Dolbec
2015-11-21  1:33 Brian Dolbec
2015-11-21  1:33 Brian Dolbec
2015-11-21  1:33 Brian Dolbec
2015-09-08 14:14 Brian Dolbec
2015-09-06 21:21 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-09-06 21:18 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-09-06 21:18 Brian Dolbec
2015-09-06 20:33 Brian Dolbec
2015-09-05 16:24 Brian Dolbec
2015-09-04 15:20 Brian Dolbec
2015-09-03 15:14 Brian Dolbec
2015-09-01  5:58 Brian Dolbec
2015-09-01  5:58 Brian Dolbec
2015-09-01  5:58 Brian Dolbec
2015-09-01  5:58 Brian Dolbec
2015-09-01  4:50 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-09-01  5:58 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-08-30 20:58 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-09-01  5:58 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-06-15 20:25 Brian Dolbec
2015-05-24  0:08 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-05-21 23:53 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26 20:44 Brian Dolbec
2015-02-26 20:44 Brian Dolbec
2015-02-26 19:25 Brian Dolbec
2015-02-26  4:12 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-01-01  5:59 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-01-01  5:59 Brian Dolbec
2015-01-01  5:59 Brian Dolbec
2015-01-01  5:59 Brian Dolbec
2015-01-01  5:59 Brian Dolbec
2014-09-11  3:26 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2014-06-14  5:58 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-09-11  3:26 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2014-06-14  5:58 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-09-11  3:08 Brian Dolbec
2014-09-11  3:08 Brian Dolbec
2014-09-11  3:08 Brian Dolbec
2014-09-11  3:08 Brian Dolbec
2014-09-11  3:08 Brian Dolbec
2014-09-02 23:10 Brian Dolbec
2014-09-02 23:10 Brian Dolbec
2014-09-02 23:10 Brian Dolbec
2014-09-02 23:10 Brian Dolbec
2014-09-02 23:10 Brian Dolbec
2014-09-02  7:12 Brian Dolbec
2014-09-02  7:12 Brian Dolbec
2014-09-02  7:12 Brian Dolbec
2014-09-02  7:12 Brian Dolbec
2014-09-02  5:54 Brian Dolbec
2014-09-02  5:54 Brian Dolbec
2014-09-02  5:54 Brian Dolbec
2014-09-02  5:54 Brian Dolbec
2014-09-02  5:54 Brian Dolbec
2014-09-02  2:43 Brian Dolbec
2014-09-02  2:43 Brian Dolbec
2014-09-02  2:43 Brian Dolbec
2014-09-02  2:43 Brian Dolbec
2014-09-02  2:43 Brian Dolbec
2014-06-15 14:56 Brian Dolbec
2014-06-15 14:56 Brian Dolbec
2014-06-15 14:56 Brian Dolbec
2014-06-15 14:56 Brian Dolbec
2014-06-15 14:56 Brian Dolbec
2014-06-14  5:58 Brian Dolbec
2014-06-14  5:58 Brian Dolbec
2014-06-14  5:58 Brian Dolbec
2014-06-14  5:58 Brian Dolbec
2014-06-14  5:58 Brian Dolbec
2014-06-14  5:58 Brian Dolbec
2014-05-05 19:17 [gentoo-commits] proj/catalyst:master " Brian Dolbec
2014-04-02 20:09 ` [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-04-02 20:09 Brian Dolbec
2014-04-02 20:09 Brian Dolbec
2014-04-02 20:09 Brian Dolbec
2014-03-22 22:25 Brian Dolbec
2014-03-22 22:25 Brian Dolbec
2014-03-22 22:25 Brian Dolbec
2014-03-22 22:25 Brian Dolbec
2014-03-22 22:25 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420091887.89beddf2ccfb320bac1f8d5b2e5964bf4890ac78.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox