Commit 534b8bad authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the file VERSION. Modify, get_versions.

parent f2dd7f16
\ No newline at end of file
......@@ -11,8 +11,8 @@
The version identifier should contains alphanumeric characters
including ".", "-" and "_".
Push version identifier in the javascript library.
Push version number in the CHANGELOG.
Push release identifier in the javascript library, CHANGELOG and
VERSION files.
Build debug and minified version of the javascript library.
Build the web2py plugin files.
Build the documentations.
......@@ -24,7 +24,7 @@
R. Le Gac,
Copyright (c) 2012-2015 R. Le Gac
Copyright (c) 2012-2016 R. Le Gac
import argparse
......@@ -38,7 +38,7 @@ import urllib
from os.path import join as opj
from subprocess import call
from subprocess import call, check_output
from numexpr.version import release
# constants
......@@ -63,6 +63,7 @@ PDFDOC = opj(DOCS, PDF)
PLUGIN_W2P = 'web2py.plugin.%s.%s.w2p'
REFERENCE = 'reference'
USER = 'user'
W2P = "web2py.plugin.%s.%s.min.w2p"
# basic commands
......@@ -196,7 +197,8 @@ def build_plugin(plugin_name, release, files):
"""Helper function to build a web2py plugin.
It is inspired by the function: ``web2py/gluon/fileutils/w2p_pack_plugin``.
The binary file is moved to the ``plugin_dbui_build`` directory if it exists.
The binary file is moved to the ``plugin_dbui_build`` directory
if it exists.
plugin_name (str): the name of the plugin, *e.g.* extjs
......@@ -458,9 +460,8 @@ def get_version():
"""Get the current version identifier.
txt = open(JSBASE, 'rb').read()
match = re.match(r"(.+ version: ')([\w._-]*)('.+)", txt, re.DOTALL)
with open(VERSION, "rb") as fi:
def git(*args, **kwargs):
......@@ -530,9 +531,9 @@ def jsduck():
# run JsDuck
cmd = ["jsduck", EXTJSSRC, JSLIBSRC, \
"--output", JSDOC, \
"--title", "plugin_dbui %s" % get_version(), \
cmd = ["jsduck", EXTJSSRC, JSLIBSRC,
"--output", JSDOC,
"--title", "plugin_dbui %s" % get_version(),
"--warnings=-all:" + EXTJSSRC]
......@@ -550,16 +551,13 @@ def set_version(version):
print "Update CHANGELOG and App.js files with the release", version, "..."
# check tag in git
fi = tempfile.TemporaryFile()
git("tag", stdout=fi)
if version in
if version in check_output(["git", "tag"]).split("\n"):
print "\n\tRelease %s already exit in git" % version
print 'Set release', version, 'in', JSBASE
txt = open(JSBASE, 'rb').read()
with open(JSBASE) as fi:
txt =
# look for a pattern App.version = '0.8.3'; in appbase.js
# split the the string in 3 parts (pre, version, post)
......@@ -567,25 +565,25 @@ def set_version(version):
if == version:
msg = '\n\tVersion "%s" already exists in the appbase.js file !'
print msg % version
print msg % version
rep = raw_input('\tDo you want to continue [n]?')
if rep not in ('y', 'yes'):
# update the version and write a new file
txt = + version +
fi = open(JSBASE, 'wb')
with open(JSBASE, 'w') as fi:
# look for a pattern HEAD in the CHANGELOG
# split the the string in 2 parts (pre HEAD, post HEAD)
print 'Set release', version, 'in', CHANGELOG
txt = open(CHANGELOG, 'rb').read()
with open(CHANGELOG) as fi:
txt =
match = re.match("(.+HEAD\n)(.*)", txt, re.DOTALL)
if match == None:
if match is None:
print '\n\tNo HEAD tag in the CHANGELOG!\n'
rep = raw_input('\tDo you want to continue [n]?')
if rep not in ('y', 'yes'):
......@@ -594,11 +592,17 @@ def set_version(version):
# update the version and edit the CHANGELOG
tpl = (, version, NOW.strftime('%b %Y'),
txt = '%s\n%s (%s)\n%s' % tpl
fi = open(CHANGELOG, 'wb')
with open(CHANGELOG, 'w') as fi:
call(["vim", CHANGELOG])
# update VERSION
print 'Set release', version, 'in', VERSION
with open(VERSION, 'w') as fi:
# cleaning
fn = "%s~" % CHANGELOG
if os.path.exists(fn):
......@@ -4,7 +4,6 @@
import os
import re
import subprocess
import tempfile
from constant import INLINE_ALERT
......@@ -22,8 +21,9 @@ from gluon.validators import (IS_DATE_IN_RANGE,
GIT = '/usr/bin/git'
STOREID = '%sStore'
GIT = "/usr/bin/git"
STOREID = "%sStore"
def as_list(val):
......@@ -654,15 +654,16 @@ def get_versions():
# version of the application
myapp = current.T("unknown")
if os.path.exists(GIT):
if os.path.exists(VERSION):
with open(os.path.join(server_path, VERSION)) as fi:
myapp =
elif os.path.exists(GIT):
ref_path = os.getcwd()
fi = tempfile.TemporaryFile()["git", "describe", "--tags"], stdout=fi)
myapp ='\n')
myapp = subprocess.check_output(["git", "describe", "--tags"])
myapp = myapp.strip('\n')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment