From 76ad8258f5f2d1bc3100da80d1b8861688bfab17 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 20 Dec 2012 15:47:46 -0600 Subject: [PATCH] semantic version support in admin --- Makefile | 2 +- VERSION | 2 +- applications/admin/views/default/site.html | 2 +- gluon/fileutils.py | 9 ++++----- gluon/main.py | 7 ++++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 9261e129..ef3aadc1 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ update: echo "remember that pymysql was tweaked" src: ### Use semantic versioning - echo 'Version 2.3.2-alpha.1+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION + echo 'Version 2.4.1-alpha.1+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION ### rm -f all junk files make clean ### clean up baisc apps diff --git a/VERSION b/VERSION index 9832a9a0..65ba0428 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.3.2-alpha.1+timestamp.2012.12.20.15.39.20 +Version 2.4.1-alpha.1+timestamp.2012.12.20.15.47.02 diff --git a/applications/admin/views/default/site.html b/applications/admin/views/default/site.html index d3d85785..8c8caa9e 100644 --- a/applications/admin/views/default/site.html +++ b/applications/admin/views/default/site.html @@ -62,7 +62,7 @@ {{if is_manager():}}
-

{{=T("Version %s.%s.%s (%s) %s", myversion)}}

+

{{=T("Version %s.%s.%s %s (%s)", myversion)}}

{{if session.check_version:}}

{{=T('Checking for upgrades...')}} diff --git a/gluon/fileutils.py b/gluon/fileutils.py index 9728ed7b..c67a6e11 100644 --- a/gluon/fileutils.py +++ b/gluon/fileutils.py @@ -67,11 +67,10 @@ def parse_legacy(version="Version 1.99.0 (2011-09-19 08:23:26)"): return (a, b, c, pre_release, build) def parse_version(version): - items = parse_semantic(version) - if not items: - items = parse_legacy(version) - (a, b, c, pre_release, build) = items - return (a, b, c, build, pre_release) # build, pre_releas intentionally reversed + version_tuple = parse_semantic(version) + if not version_tuple: + version_tuple = parse_legacy(version) + return version_tuple def read_file(filename, mode='r'): "returns content from filename, making sure to close the file explicitly on exit." diff --git a/gluon/main.py b/gluon/main.py index baa82ff5..3aee0956 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -101,13 +101,14 @@ requests = 0 # gc timer # pattern used to validate client address regex_client = re.compile('[\w\-:]+(\.[\w\-]+)*\.?') # ## to account for IPV6 -try: +#try: +if 1: version_info = open(pjoin(global_settings.gluon_parent, 'VERSION'), 'r') raw_version_string = version_info.read().strip() version_info.close() global_settings.web2py_version = parse_version(raw_version_string) -except: - raise RuntimeError("Cannot determine web2py version") +#except: +# raise RuntimeError("Cannot determine web2py version") web2py_version = global_settings.web2py_version