summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-08-05 02:04:52 +0200
committermathieui <mathieui@mathieui.net>2012-08-05 02:04:52 +0200
commitec5bb3b213385405105ef90eccb1b1f093004b22 (patch)
treedcb104a783792e4066c55953cfbde68de7ee434c
parentd723cec5ebac28497c14f24707bcc90d7541a0f1 (diff)
downloadpoezio-ec5bb3b213385405105ef90eccb1b1f093004b22.tar.gz
poezio-ec5bb3b213385405105ef90eccb1b1f093004b22.tar.bz2
poezio-ec5bb3b213385405105ef90eccb1b1f093004b22.tar.xz
poezio-ec5bb3b213385405105ef90eccb1b1f093004b22.zip
Use the revision/date for the poezio version if a .git is found
-rwxr-xr-xlaunch.sh10
-rw-r--r--src/config.py4
-rw-r--r--src/connection.py4
3 files changed, 14 insertions, 4 deletions
diff --git a/launch.sh b/launch.sh
index d3263f79..681e6fcf 100755
--- a/launch.sh
+++ b/launch.sh
@@ -1,4 +1,12 @@
#!/usr/bin/env sh
-exec python3 -OO src/poezio.py "$@"
+if [ -d "$PWD/.git" ]
+then
+ args=$(git show --format='%h %ci' | head -n1)
+else
+ args="0.8-dev"
+fi
+
+
+exec python3 -OO src/poezio.py -v "$args" "$@"
diff --git a/src/config.py b/src/config.py
index 85fa55f6..99a05118 100644
--- a/src/config.py
+++ b/src/config.py
@@ -15,7 +15,7 @@ DEFSECTION = "Poezio"
from configparser import RawConfigParser, NoOptionError, NoSectionError
from os import environ, makedirs, path
from shutil import copy2
-from argparse import ArgumentParser
+from argparse import ArgumentParser, SUPPRESS
class Config(RawConfigParser):
"""
@@ -197,6 +197,8 @@ parser.add_argument("-f", "--file", dest="filename", default=path.join(CONFIG_PA
help="The config file you want to use", metavar="CONFIG_FILE")
parser.add_argument("-d", "--debug", dest="debug",
help="The file where debug will be written", metavar="DEBUG_FILE")
+parser.add_argument("-v", "--version", dest="version",
+ help=SUPPRESS, metavar="VERSION", default="0.8-dev")
options = parser.parse_args()
config = Config(options.filename)
if firstrun:
diff --git a/src/connection.py b/src/connection.py
index 658dc9e2..30e0b552 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -18,7 +18,7 @@ from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
import getpass
import sleekxmpp
-from config import config
+from config import config, options
from logger import logger
import common
@@ -64,7 +64,7 @@ class Connection(sleekxmpp.ClientXMPP):
self.register_plugin('xep_0191')
if config.get('send_poezio_info', 'true') == 'true':
info = {'name':'poezio',
- 'version':'0.8-dev'}
+ 'version': options.version}
if config.get('send_os_info', 'true') == 'true':
info['os'] = common.get_os_info()
self.plugin['xep_0030'].set_identities(identities=set([('client', 'pc', None,'Poezio')]))