commit: bb1475714fd961943c83d57a54531a6fdab5b7fc
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 16 19:16:58 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Oct 16 19:17:01 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=bb147571
config.py: Improves package version checking
With the previous method of setting the package version you were
unable to pass the package version to webapp-config if it had more
than one decimal point (ex: 1.0.1 wouldn't work), this commit attempts
to fix that issue.
---
WebappConfig/config.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 10a6f26..5eb4584 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -990,11 +990,18 @@ class Config:
else:
OUT.die('Invalid package name')
- try:
- self.config.set('USER', 'pvr', str(float(args[1])))
- except ValueError:
+ argsvr = args[1].split('.')
+ if len(argsvr) == 1:
OUT.die('Invalid package version: %(pvr)s' % {'pvr': args[1]})
+ pvr = ''
+ for i in range(0, len(argsvr)):
+ if not i == len(argsvr) - 1:
+ pvr += argsvr[i] + '.'
+ else:
+ pvr += argsvr[i]
+ self.config.set('USER', 'pvr', pvr)
+
# --------------------------------------------------------------------
# Helper functions