Permalink
Browse files

Add proper versioning.

Signed-off-by: Jack Miller <jack@codezen.org>
  • Loading branch information...
1 parent ebe736c commit 9b980162ac6d70c2dd330c46bfb92c7b577b467d @themoken committed Jul 21, 2012
Showing with 45 additions and 4 deletions.
  1. +7 −1 canto_next/canto_backend.py
  2. +6 −0 canto_next/remote.py
  3. +4 −0 man/canto-daemon.1
  4. +4 −0 man/canto-remote.1
  5. +24 −3 setup.py
@@ -13,6 +13,8 @@
# 0.2 - Modified tags to escape the : separator such that tags handed out are
# immediaely read to be used as [ Tag -whatever- ] config headers.
+version = REPLACE_WITH_VERSION
+
CANTO_PROTOCOL_VERSION = 0.3
from .feed import allfeeds
@@ -595,7 +597,7 @@ def run(self):
# This function parses and validates all of the command line arguments.
def args(self):
try:
- optlist = getopt.getopt(sys.argv[1:], 'D:vp:a:n',\
+ optlist = getopt.getopt(sys.argv[1:], 'D:vp:a:nV',\
["dir=", "port=", "address=", "nofetch", "nowb"])[0]
except getopt.GetoptError as e:
log.error("Error: %s" % e.msg)
@@ -631,6 +633,10 @@ def args(self):
elif opt in ["--nowb"]:
self.writeback = False
+ elif opt in ['-V']:
+ print("canto-daemon " + version)
+ return 1
+
return 0
def sig_alrm(self, a, b):
View
@@ -6,6 +6,8 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
+version = REPLACE_WITH_VERSION
+
from .client import CantoClient
from .encoding import encoder
from .format import escsplit
@@ -50,6 +52,10 @@ def access_dict(d, var):
class CantoRemote(CantoClient):
def __init__(self):
+ if "-V" in sys.argv:
+ print("canto-remote " + version)
+ sys.exit(-1)
+
if self.common_args() == -1:
sys.exit(-1)
View
@@ -5,6 +5,10 @@ Canto-daemon \- An extensible RSS aggregation daemon.
.SH COMMAND LINE USAGE
+.TP
+\-V
+Print version info and exit.
+
.TP
\-D/\-\-dir [directory]
Change base directory for canto-daemon (default: ~/.canto-ng)
View
@@ -5,6 +5,10 @@ Canto-remote \- A basic remote for canto-daemon
.SH COMMAND LINE USAGE
+.TP
+\-V
+Print version info and exit.
+
.TP
\-D/--dir [directory]
Change base directory for canto-daemon (default: ~/.canto-ng)
View
@@ -1,12 +1,33 @@
+from distutils.command.install_data import install_data
from distutils.core import setup
+numeric_version = [ 0, 8, 1 ]
+string_version = ".".join([ str(i) for i in numeric_version])
+
+class canto_next_install_data(install_data):
+ def run(self):
+ install_data.run(self)
+
+ install_cmd = self.get_finalized_command('install')
+ libdir = install_cmd.install_lib
+
+ for source in ['canto_backend.py','remote.py']:
+ with open(libdir + '/canto_next/' + source, 'r+') as f:
+ d = f.read().replace("REPLACE_WITH_VERSION", "\"" + string_version + "\"")
+ f.truncate(0)
+ f.seek(0)
+ f.write(d)
+
setup(name='Canto',
- version='0.8.0',
+ version=string_version,
description='Next-gen console RSS/Atom reader',
author='Jack Miller',
author_email='jack@codezen.org',
- url='http://codezen.org/canto',
+ license='GPLv2',
+ url='http://codezen.org/canto-ng',
+ download_url='http://codezen.org/static/canto-daemon-' + string_version + '.tar.gz',
packages=['canto_next'],
scripts=['bin/canto-daemon','bin/canto-remote'],
data_files = [("share/man/man1/", ["man/canto-daemon.1", "man/canto-remote.1"])],
- )
+ cmdclass = { 'install_data' : canto_next_install_data },
+)

0 comments on commit 9b98016

Please sign in to comment.