Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 3807949c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch 'master' into 'production'

Release 0.8.2



See merge request !20
parents 111accf0 7b920122
0.8.2
\ 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 @@
AUTHOR
R. Le Gac, renaud.legac@free.fr
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, CalledProcessError
from numexpr.version import release
# constants
......@@ -56,6 +56,7 @@ JSLIBMIN = 'static/plugin_dbui/dbui-min.js'
JSLIBSRC = 'static/plugin_dbui/src'
LATEX = 'latex'
LATEXDOC = opj(DOCS, LATEX)
MSG_RELEASE = 'Enter the new release: '
NOW = datetime.datetime.now()
PACK_PLUGIN_URL = 'http://localhost:8000/%s/default/pack_plugin' % APP
PDF = "pdf"
......@@ -63,19 +64,16 @@ PDFDOC = opj(DOCS, PDF)
PLUGIN_W2P = 'web2py.plugin.%s.%s.w2p'
REFERENCE = 'reference'
USER = 'user'
VERSION = "VERSION"
W2P = "web2py.plugin.%s.%s.min.w2p"
# basic commands
GIT = '/usr/bin/git'
JSDUCK = os.path.expandvars("$HOME/bin/jsduck")
PDFLATEX = '/usr/bin/pdflatex'
SENCHA = os.path.expandvars("$HOME/bin/sencha")
SPHINX = '/usr/bin/sphinx-build'
MSG_RELEASE = 'Enter the new release: '
# files for plugins
ACE_FILES = ['static/plugin_ace/src-min-noconflict/ace.js']
# files for minimal version of plugins
ACE_FILES = ['static/plugin_ace/src-min-noconflict/ace.js',
'static/plugin_ace/src-min-noconflict/mode-json.js',
'static/plugin_ace/src-min-noconflict/theme-crimson_editor.js',
'static/plugin_ace/src-min-noconflict/worker-json.js']
DBUI_FILES = [
'modules/plugin_dbui',
......@@ -155,6 +153,11 @@ def build_doc_pdf(doc):
"""
print "Build the PDF documentations..."
if not which("pdflatex"):
print '\n\tThe application pdflatex is missing !'
print '\tSkip this step.\n'
return
# generate the latex
sphinx("-b latex", opj(DOCSRC, doc), LATEXDOC)
......@@ -171,8 +174,8 @@ def build_doc_pdf(doc):
return
# process the latex file twice
call([PDFLATEX, fn])
call([PDFLATEX, fn])
call(["pdflatex", fn])
call(["pdflatex", fn])
# move the pdf file
os.chdir(cwd)
......@@ -193,7 +196,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.
Args:
plugin_name (str): the name of the plugin, *e.g.* extjs
......@@ -296,7 +300,7 @@ def commit_change_log():
"""
print "Commit CHANGELOG and App.js..."
if not os.path.exists(GIT):
if not which("git"):
print '\n\tThe application git is missing !'
print '\tSkip this step.\n'
return
......@@ -305,8 +309,8 @@ def commit_change_log():
git("checkout master")
# Commit modified files
print 'git add', JSBASE, CHANGELOG
git("add", JSBASE, CHANGELOG)
print 'git add', JSBASE, CHANGELOG, VERSION
git("add", JSBASE, CHANGELOG, VERSION)
print 'git commit'
msg = "Start release candidate %s" % get_version()
......@@ -337,7 +341,7 @@ def compile_js():
"""
print "Compile the javascript code ..."
if not os.path.exists(SENCHA):
if not which("sencha"):
print '\n\tThe application sencha is missing !'
print '\tSee: http://www.sencha.com/products/sencha-cmd/download'
print '\tSkip this step.\n'
......@@ -455,9 +459,8 @@ def get_version():
"""Get the current version identifier.
"""
txt = open(JSBASE, 'rb').read()
match = re.match(r"(.+ version: ')([\w._-]*)('.+)", txt, re.DOTALL)
return match.group(2)
with open(VERSION, "rb") as fi:
return fi.read()
def git(*args, **kwargs):
......@@ -475,12 +478,12 @@ def git(*args, **kwargs):
git("commit", stdout=fi)
"""
if not os.path.exists(GIT):
if not which("git"):
print '\n\tThe application git is missing !'
print '\tSkip this step.\n'
return
cmd = [GIT]
cmd = ["git"]
cmd.extend(args[0].split())
if len(args) > 1:
......@@ -513,7 +516,7 @@ def jsduck():
"""
print "Build the javascript documentation..."
if not os.path.exists(JSDUCK):
if not which("jsduck"):
print '\n\tThe application jsduck is missing !'
print '\tSkip this step.\n'
return
......@@ -527,9 +530,9 @@ def jsduck():
call(cmd)
# 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]
call(cmd)
......@@ -547,16 +550,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)
fi.seek(0)
if version in fi.read():
if version in check_output(["git", "tag"]).split("\n"):
print "\n\tRelease %s already exit in git" % version
sys.exit(1)
print 'Set release', version, 'in', JSBASE
txt = open(JSBASE, 'rb').read()
with open(JSBASE) as fi:
txt = fi.read()
# look for a pattern App.version = '0.8.3'; in appbase.js
# split the the string in 3 parts (pre, version, post)
......@@ -564,25 +564,25 @@ def set_version(version):
if match.group(2) == 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'):
sys.exit(1)
# update the version and write a new file
txt = match.group(1) + version + match.group(3)
fi = open(JSBASE, 'wb')
fi.write(txt)
fi.close()
with open(JSBASE, 'w') as fi:
fi.write(txt)
# 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 = fi.read()
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'):
......@@ -591,11 +591,17 @@ def set_version(version):
# update the version and edit the CHANGELOG
tpl = (match.group(1), version, NOW.strftime('%b %Y'), match.group(2))
txt = '%s\n%s (%s)\n%s' % tpl
fi = open(CHANGELOG, 'wb')
fi.write(txt)
fi.close()
with open(CHANGELOG, 'w') as fi:
fi.write(txt)
call(["vim", CHANGELOG])
# update VERSION
print 'Set release', version, 'in', VERSION
with open(VERSION, 'w') as fi:
fi.write(version)
# cleaning
fn = "%s~" % CHANGELOG
if os.path.exists(fn):
......@@ -616,12 +622,12 @@ def sphinx(*args, **kwargs):
sphinx("-b html", sourcedir, outdir)
"""
if not os.path.exists(SPHINX):
if not which("sphinx-build"):
print '\n\tThe application sphinx is missing !'
print '\tSkip this step.\n'
return
cmd = [SPHINX]
cmd = ["sphinx-build"]
cmd.extend(args[0].split())
if len(args) > 1:
......@@ -646,8 +652,7 @@ def start_release():
if not new_release:
sys.exit(0)
branch = "release-%s" % new_release
git("checkout", "-b", branch, "develop")
git("checkout", "master")
set_version(new_release)
commit_change_log()
......@@ -714,6 +719,24 @@ def web2py(plugin):
print 'Binary file', fn, 'is created in ', BUILDDIR
def which(cmd):
"""Test if the command exists on the system.
Args:
name (str): name of the command
Returns:
bool:
"""
try:
check_output(["which", cmd])
return True
except CalledProcessError:
return False
if __name__ == '__main__':
# define script options
......
......@@ -29,7 +29,15 @@ def get_plugin_dbui_release():
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../../modules'))
sys.path.insert(0, os.path.abspath('../../../web2py'))
# docker image
if os.path.exists("/opt/web2py"):
sys.path.insert(0, os.path.abspath('/opt/web2py'))
# older running environment
else:
sys.path.insert(0, os.path.abspath('../../../web2py'))
# -- General configuration -----------------------------------------------------
......
......@@ -2,7 +2,6 @@
""" Common settings
"""
import locale
import plugin_dbui as dbui
from callbacks import country_delete, country_insert, country_update
......@@ -33,8 +32,6 @@ T.set_current_languages('en', 'en-gb', 'en-us') # mother tongue
T.force('fr-fr') # user language
T.lazy = False # immediate translation
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
#-------------------------------------------------------------------------------
#
# CONSTANTS
......
......@@ -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,
IS_MATCH,
IS_LENGTH)
GIT = '/usr/bin/git'
STOREID = '%sStore'
GIT = "/usr/bin/git"
STOREID = "%sStore"
VERSION = "VERSION"
def as_list(val):
......@@ -114,7 +114,7 @@ def dummy_row(table, val=''):
if is_foreign_field(field):
k_tablename, k_fieldname, k_id = get_foreign_field(field)
if k_tablename not in row:
for k, v in dummy_row(db[k_tablename], value=val).iteritems():
for k, v in dummy_row(db[k_tablename], val=val).iteritems():
if k not in row:
row[k] = v
......@@ -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 = fi.read()
elif os.path.exists(GIT):
ref_path = os.getcwd()
os.chdir(server_path)
fi = tempfile.TemporaryFile()
subprocess.call(["git", "describe", "--tags"], stdout=fi)
fi.seek(0)
myapp = fi.read().strip('\n')
fi.close()
myapp = subprocess.check_output(["git", "describe", "--tags"])
myapp = myapp.strip('\n')
os.chdir(ref_path)
......
......@@ -2,6 +2,11 @@
HEAD
0.8.2 (Feb 2016)
- Add missing files in the compressed version of the ace plugin.
- Minor modification to run the application via a docker image.
- Few bug fixed.
0.8.1 (Dec 2015)
- Compliant with the navigator firefox and chrome
- Relase non backward compatible. Signatures of methods have changed:
......
......@@ -15,7 +15,7 @@ Ext.define('App', {
* The version of the plugin
* @property {String}
*/
version: '0.8.1',
version: '0.8.2',
/**
* The name of the application
......
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