[geneagrapher] 137/226: Get version from setup.py.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Jul 11 17:10:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository geneagrapher.

commit b5e37d6237145b266056244a5d1372eba572220e
Author: David Alber <alber.david at gmail.com>
Date:   Fri Sep 2 23:05:12 2011 -0700

    Get version from setup.py.
---
 .gitignore                   |  1 +
 geneagrapher/geneagrapher.py | 11 ++++-------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d20b64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.pyc
diff --git a/geneagrapher/geneagrapher.py b/geneagrapher/geneagrapher.py
index 5f4fc73..688e696 100644
--- a/geneagrapher/geneagrapher.py
+++ b/geneagrapher/geneagrapher.py
@@ -1,4 +1,5 @@
 from optparse import OptionParser
+import pkg_resources
 import GGraph
 import grab
 
@@ -19,7 +20,9 @@ class Geneagrapher:
 		"""
 		Parse command-line information.
 		"""
-		self.parser = OptionParser()
+		pkg_env = pkg_resources.Environment()
+		self.parser = OptionParser(version="{}".format(
+			pkg_env[self.__module__.split('.')[0]][0].version))
 
 		self.parser.set_usage("%prog [options] ID ...")
 		self.parser.set_description('Create a Graphviz "dot" file for a mathematics genealogy, where ID is a record identifier from the Mathematics Genealogy Project. Multiple IDs may be passed.')
@@ -32,15 +35,9 @@ class Geneagrapher:
 				       default=False, help="retrieve descendants of IDs and include in graph")
 		self.parser.add_option("--verbose", "-v", action="store_true", dest="verbose", default=False,
 				       help="list nodes being retrieved")
-		self.parser.add_option("--version", "-V", action="store_true", dest="print_version", default=False,
-				       help="print version and exit")
 
 		(options, args) = self.parser.parse_args()
 		
-		if options.print_version:
-			print "Geneagrapher Version 0.2.1-r2"
-			self.parser.exit()
-		
 		if len(args) == 0:
 			raise SyntaxError("%s: error: no record IDs passed" % (self.parser.get_prog_name()))
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/geneagrapher.git



More information about the debian-science-commits mailing list