Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
d0fd6f0b
Commit
d0fd6f0b
authored
Mar 12, 2016
by
LE GAC Renaud
Browse files
Modify build_version to run sencha via a docker container.
parent
916453e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
34 deletions
+87
-34
build_version.py
build_version.py
+87
-34
No files found.
build_version.py
View file @
d0fd6f0b
...
@@ -65,8 +65,12 @@ PDFDOC = opj(APP_STATIC, "docs", PDF)
...
@@ -65,8 +65,12 @@ PDFDOC = opj(APP_STATIC, "docs", PDF)
W2P_DIR_CNT
=
"/opt/web2py"
W2P_DIR_CNT
=
"/opt/web2py"
APP_DIR_CNT
=
opj
(
W2P_DIR_CNT
,
"applications"
,
APP
)
APP_DIR_CNT
=
opj
(
W2P_DIR_CNT
,
"applications"
,
APP
)
APP_STATIC_CNT
=
opj
(
APP_DIR_CNT
,
"static"
)
APP_STATIC_CNT
=
opj
(
APP_DIR_CNT
,
"static"
)
DBUISRC_CNT
=
opj
(
APP_STATIC_CNT
,
"plugin_dbui"
,
"src"
)
EXTJSSRC_CNT
=
opj
(
APP_STATIC_CNT
,
"plugin_extjs"
,
"src"
)
EXTJSSRC_CNT
=
opj
(
APP_STATIC_CNT
,
"plugin_extjs"
,
"src"
)
JSDOC_CNT
=
opj
(
APP_STATIC_CNT
,
"docs"
,
"jsduck"
)
JSDOC_CNT
=
opj
(
APP_STATIC_CNT
,
"docs"
,
"jsduck"
)
JSLIBDEBUG_CNT
=
opj
(
APP_STATIC_CNT
,
"%s-debug.js"
%
APP
)
JSLIBSRC_CNT
=
opj
(
APP_STATIC_CNT
,
APP
,
"src"
)
JSLIBMIN_CNT
=
opj
(
APP_STATIC_CNT
,
"%s-min.js"
%
APP
)
JSLIBSRC_CNT
=
opj
(
APP_STATIC_CNT
,
APP
,
"src"
)
JSLIBSRC_CNT
=
opj
(
APP_STATIC_CNT
,
APP
,
"src"
)
...
@@ -178,12 +182,12 @@ def change_log():
...
@@ -178,12 +182,12 @@ def change_log():
def
compile_js
():
def
compile_js
():
"""compile_js the javascript code and generate the debug version
"""compile_js the javascript code and generate the debug version
as well as the mini
fi
ed version.
as well as the mini
mis
ed version.
The compiler verify that the code complied with the class model
The compiler verify that the code complied with the class model
and order the file in the proper way.
and order the file in the proper way.
The mini
fi
ed library can be build in several ways, including
The mini
mis
ed library can be build in several ways, including
the Ext JS class required by the applications. In the
the Ext JS class required by the applications. In the
current version, the library contains only the dbui classes and
current version, the library contains only the dbui classes and
the Ext JS ones have to be loaded separately. In that sense
the Ext JS ones have to be loaded separately. In that sense
...
@@ -200,41 +204,92 @@ def compile_js():
...
@@ -200,41 +204,92 @@ def compile_js():
"""
"""
print
"Compile the javascript code ..."
print
"Compile the javascript code ..."
if
not
which
(
"sencha"
):
print
'
\n\t
The application sencha is missing !'
sencha
=
which
(
"sencha"
)
print
'
\t
See: http://www.sencha.com/products/sencha-cmd/download'
if
len
(
sencha
)
==
0
:
print
'
\t
Skip this step.
\n
'
print
"
\n\t
The application sencha is missing !"
print
"
\t
See: http://www.sencha.com/products/sencha-cmd/download"
print
"
\t
Skip this step.
\n
"
return
return
if
not
os
.
path
.
exists
(
JSLIBSRC
):
if
not
os
.
path
.
exists
(
JSLIBSRC
):
print
'
No javascript library. Exit.
'
print
"
\n\t
No javascript library. Exit.
\n
"
return
return
# clean previous version
# clean previous version
for
item
in
(
JSLIBDEBUG
,
JSLIBMIN
):
print
"
\n\t
Remove old javascript library..
\n
"
if
os
.
path
.
exists
(
item
):
call
([
"rm"
,
"-f"
,
JSLIBDEBUG
,
JSLIBMIN
])
os
.
remove
(
item
)
print
'Remove old javascript library'
,
item
# debug version of the javascript library
# NOTE
cmd
=
[
"sencha"
,
"-sdk"
,
EXTJSSRC
,
# the processing depend on the localisation of sencha
"compile"
,
"-classpath"
,
"%s,%s"
%
(
JSLIBSRC
,
DBUISRC
),
# either on the localhost or behind a docker container
"exclude"
,
"--namespace"
,
"Ext,App"
,
# the length of the cmd list allows to separate the two cases
"and"
,
"concat"
,
JSLIBDEBUG
]
call
(
cmd
)
# NOTE
# container is running as root
# permissions have to be changed for the current user
print
'Debug version of the javascript library'
,
JSLIBDEBUG
,
'is ready'
# localhost
if
len
(
sencha
)
==
1
:
# Minified version of the javascript library
cmd
=
list
(
sencha
)
cmd
=
[
"sencha"
,
"-sdk"
,
EXTJSSRC
,
cmd
.
extend
([
"compile"
,
"-classpath"
,
"%s,%s"
%
(
JSLIBSRC
,
DBUISRC
),
"-sdk"
,
EXTJSSRC
,
"exclude"
,
"--namespace"
,
"Ext,App"
,
"compile"
,
"-classpath"
,
"%s,%s"
%
(
JSLIBSRC
,
DBUISRC
),
"and"
,
"concat"
,
"--yui"
,
JSLIBMIN
]
"exclude"
,
"--namespace"
,
"Ext,App"
,
"and"
,
"concat"
,
JSLIBDEBUG
])
call
(
cmd
)
call
(
cmd
)
print
'Minified version of the javascript library'
,
JSLIBMIN
,
'is ready'
cmd
=
list
(
sencha
)
cmd
.
extend
([
"-sdk"
,
EXTJSSRC
,
"compile"
,
"-classpath"
,
"%s,%s"
%
(
JSLIBSRC
,
DBUISRC
),
"exclude"
,
"--namespace"
,
"Ext,App"
,
"and"
,
"concat"
,
"--yui"
,
JSLIBMIN
])
call
(
cmd
)
else
:
cmd
=
list
(
sencha
)
cmd
.
extend
([
"-sdk"
,
EXTJSSRC_CNT
,
"compile"
,
"-classpath"
,
"%s,%s"
%
(
JSLIBSRC_CNT
,
DBUISRC_CNT
),
"exclude"
,
"--namespace"
,
"Ext,App"
,
"and"
,
"concat"
,
JSLIBDEBUG_CNT
])
call
(
cmd
)
cmd
=
list
(
sencha
)
cmd
.
extend
([
"-sdk"
,
EXTJSSRC_CNT
,
"compile"
,
"-classpath"
,
"%s,%s"
%
(
JSLIBSRC_CNT
,
DBUISRC_CNT
),
"exclude"
,
"--namespace"
,
"Ext,App"
,
"and"
,
"concat"
,
"--yui"
,
JSLIBMIN_CNT
])
call
(
cmd
)
cmd
=
[
"docker"
,
"exec"
,
ARGS
.
docker_container
,
"chown"
,
get_perm
(),
JSLIBDEBUG_CNT
,
JSLIBMIN_CNT
]
call
(
cmd
)
print
'
\n\t
Debug version of the js library'
,
JSLIBDEBUG
,
'is ready'
print
'
\t
Minimised version of the js library'
,
JSLIBMIN
,
'is ready
\n
'
def
get_perm
():
""""Return the permission of the current user.
Returns:
str: permission encoded as uid:gid
"""
uid
=
check_output
([
"id"
,
"-u"
]).
strip
(
"
\n
"
)
gid
=
check_output
([
"id"
,
"-g"
]).
strip
(
"
\n
"
)
return
"%s:%s"
%
(
uid
,
gid
)
def
get_version
():
def
get_version
():
...
@@ -414,14 +469,18 @@ def jsduck():
...
@@ -414,14 +469,18 @@ def jsduck():
return
return
# clean
# clean
print
"
\n\t
Remove old javascript documentation..."
call
([
"rm"
,
"-rf"
,
JSDOC
])
call
([
"rm"
,
"-rf"
,
JSDOC
])
# NOTE
# NOTE
# the processing depend on the localisation of jsduck
# the processing depend on the localisation of jsduck
# either on the localhost or behind a d
c
oker container
# either on the localhost or behind a do
c
ker container
# the length of the cmd list allows to separate the two cases
# the length of the cmd list allows to separate the two cases
# localhost
# NOTE
# container is running as root
# permissions have to be changed for the current user
if
len
(
cmd
)
==
1
:
if
len
(
cmd
)
==
1
:
cmd
.
extend
([
EXTJSSRC
,
JSLIBSRC
,
cmd
.
extend
([
EXTJSSRC
,
JSLIBSRC
,
...
@@ -441,14 +500,8 @@ def jsduck():
...
@@ -441,14 +500,8 @@ def jsduck():
call
(
cmd
)
call
(
cmd
)
# container is running as root
# change permission for the current user
uid
=
check_output
([
"id"
,
"-u"
]).
strip
(
"
\n
"
)
gid
=
check_output
([
"id"
,
"-g"
]).
strip
(
"
\n
"
)
perm
=
"%s:%s"
%
(
uid
,
gid
)
cnt
=
ARGS
.
docker_container
cnt
=
ARGS
.
docker_container
call
([
"docker"
,
"exec"
,
cnt
,
"chown"
,
"-R"
,
perm
,
JSDOC_CNT
])
call
([
"docker"
,
"exec"
,
cnt
,
"chown"
,
"-R"
,
get_
perm
()
,
JSDOC_CNT
])
print
"
\n\t
JavaScript documentation in"
,
JSDOC
print
"
\n\t
JavaScript documentation in"
,
JSDOC
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment