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

Commit 08370113 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update build_version.py to search git and pdflatex only on the localhost.

parent 35110733
......@@ -24,7 +24,7 @@
> ./build_version -h
AUTHOR
R. Le Gac, renaud.legac@cppm.in2p3.fr
R. Le Gac, legac@cppm.in2p3.fr
Copyright (c) 2012-2016 R. Le Gac
......@@ -83,7 +83,7 @@ JSLIBSRC_CNT = opj(APP_STATIC_CNT, APP, "src")
def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin):
"""Build javascript libraries when the sencha command is located
on hte local host or run behind a docker container.
on the local host or run behind a docker container.
Args:
sencha (list): sencha command
......@@ -101,7 +101,7 @@ def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin):
"exclude", "--namespace", "Ext,App",
"and", "concat", jslibdebug])
call(cmd)
check_output(cmd)
cmd = list(sencha)
cmd.extend([
......@@ -110,7 +110,7 @@ def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin):
"exclude", "--namespace", "Ext,App",
"and", "concat", "--yui", jslibmin])
call(cmd)
check_output(cmd)
def build():
......@@ -121,10 +121,7 @@ def build():
build_html()
for doc in (USER,):
docsrc = opj(DOCSRC, doc)
if os.path.exists(docsrc):
build_pdf(doc)
build_pdf(doc)
def build_html():
......@@ -154,7 +151,7 @@ def build_pdf(doc):
"""
print "\n\tBuild the PDF documentations..."
if not which("pdflatex"):
if not which("pdflatex", localhost=True):
print '\n\tThe application pdflatex is missing !'
print '\tSkip this step.\n'
return
......@@ -214,7 +211,7 @@ def change_log():
"""
print "\n\tCommit CHANGELOG..."
if not which("git"):
if not which("git", localhost=True):
print '\n\tThe application git is missing !'
print '\tSkip this step.\n'
return
......@@ -345,7 +342,7 @@ def git(*args, **kwargs):
git("commit", stdout=fi)
"""
if not which("git"):
if not which("git", localhost=True):
print '\n\tThe application git is missing !'
print '\tSkip this step.\n'
return
......@@ -670,12 +667,14 @@ def start_release():
build()
def which(cmd):
def which(cmd, localhost=False):
"""Test if the command exists on the localhost or on a docker container.
Return the sequence to execute it. Priority is given to the localhost.
Args:
cmd (str): name of the command
localhost (bool): force the command to be on localhost even if
the option force_container is true.
Returns:
list: command to be executed. The list is empty when the command is
......@@ -683,13 +682,15 @@ def which(cmd):
"""
# local host
if not ARGS.force_container:
if not ARGS.force_container or localhost:
try:
out = check_output(["which", cmd])
print "\n\tCommand", cmd, "found on the localhost"
return [out.strip("\n")]
except CalledProcessError:
print "\n\tCommand", cmd, "not found on the localhost"
if localhost:
return []
# docker container is running ?
container = ARGS.docker_container
......@@ -711,10 +712,12 @@ def which(cmd):
try:
out = check_output(["docker", "exec", container, "which", cmd])
path = out.strip("\n")
print "\n\tCommand", cmd, "found on the container", container
return ["docker", "exec", container, path]
except CalledProcessError:
print "\n\tCommand", cmd, "not found on the %s container" % container
print "\n\tCommand", cmd, \
"not found on the localhost nor in the container %s" % container
return []
......
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