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
w2pext
plugin_dbui
Commits
36314324
Commit
36314324
authored
Dec 03, 2016
by
LE GAC Renaud
Browse files
Update helper.get_versions in order to handle all plugins.
parent
d17c105c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
27 deletions
+46
-27
modules/plugin_dbui/helper.py
modules/plugin_dbui/helper.py
+46
-27
No files found.
modules/plugin_dbui/helper.py
View file @
36314324
...
...
@@ -573,40 +573,43 @@ def get_versions():
and its version identifier. The keys are ``code`` and ``version``
"""
ope
=
os
.
path
.
exists
opj
=
os
.
path
.
join
server_path
,
client_path
=
get_reference_paths
()
T
=
current
.
T
# matplotlib library
try
:
import
matplotlib
mpl
=
matplotlib
.
__version__
except
ImportError
:
mpl
=
current
.
T
(
'not install'
)
mpl
=
T
(
'not install'
)
# pandas library
try
:
import
pandas
pnd
=
pandas
.
__version__
except
ImportError
:
pnd
=
current
.
T
(
'not install'
)
pnd
=
T
(
'not install'
)
# plugin ace
ace
=
current
.
T
(
'plugin
not install'
)
path
=
o
s
.
path
.
join
(
server_path
,
'static'
,
'plugin_ace'
)
if
o
s
.
path
.
exists
(
path
):
ace
=
current
.
T
(
'install'
)
ace
=
T
(
'
not install'
)
path
=
o
pj
(
server_path
,
'static'
,
'plugin_ace'
)
if
o
pe
(
path
):
ace
=
T
(
'install'
)
# plugin dbui
fn
=
o
s
.
path
.
join
(
server_path
,
'static'
,
'plugin_dbui'
,
'src'
,
'Dbui.js'
)
fn
=
o
pj
(
server_path
,
'static'
,
'plugin_dbui'
,
'src'
,
'Dbui.js'
)
with
open
(
fn
,
'rb'
)
as
fi
:
s
=
fi
.
read
()
m
=
re
.
match
(
"(.+ version: ')([\w._-]*)('.+)"
,
s
,
re
.
DOTALL
)
dbui
=
m
.
group
(
2
)
# plugin Ext JS
extjs
=
current
.
T
(
'plugin
not install'
)
path
=
o
s
.
path
.
join
(
server_path
,
'static'
,
'plugin_extjs'
)
if
o
s
.
path
.
exists
(
path
):
fn
=
o
s
.
path
.
join
(
path
,
'version.properties'
)
extjs
=
T
(
'
not install'
)
path
=
o
pj
(
server_path
,
'static'
,
'plugin_extjs'
)
if
o
pe
(
path
):
fn
=
o
pj
(
path
,
'version.properties'
)
with
open
(
fn
,
'rb'
)
as
fi
:
s
=
fi
.
read
()
...
...
@@ -615,13 +618,13 @@ def get_versions():
extjs
=
m
.
group
(
1
)
# plugin mathjax
mathjax
=
current
.
T
(
'plugin
not install'
)
path
=
o
s
.
path
.
join
(
server_path
,
'static'
,
'plugin_mathjax'
)
if
o
s
.
path
.
exists
(
path
):
fn
=
o
s
.
path
.
join
(
server_path
,
'static'
,
'plugin_mathjax'
,
'MathJax.js'
)
mathjax
=
T
(
'
not install'
)
path
=
o
pj
(
server_path
,
'static'
,
'plugin_mathjax'
)
if
o
pe
(
path
):
fn
=
o
pj
(
server_path
,
'static'
,
'plugin_mathjax'
,
'MathJax.js'
)
with
open
(
fn
,
'rb'
)
as
fi
:
s
=
fi
.
read
()
...
...
@@ -629,6 +632,19 @@ def get_versions():
if
m
:
mathjax
=
m
.
group
(
1
)
# other plugins
plugins
=
[]
stdplgs
=
(
"plugin_ace"
,
"plugin_dbui"
,
"plugin_extjs"
,
"plugin_mathjax"
)
for
plg
in
os
.
listdir
(
opj
(
server_path
,
"static"
)):
if
plg
.
startswith
(
"plugin"
)
and
plg
not
in
stdplgs
:
path
=
opj
(
server_path
,
"static"
,
plg
,
"VERSION"
)
if
opj
(
path
):
with
open
(
opj
(
path
))
as
fi
:
plugins
.
append
(
dict
(
code
=
plg
,
version
=
fi
.
read
()))
else
:
plugins
.
append
(
dict
(
code
=
plg
,
version
=
T
(
'install'
)))
# web2py
web2py
=
''
val
=
current
.
request
.
env
.
web2py_version
...
...
@@ -638,17 +654,17 @@ def get_versions():
web2py
=
m
.
group
()
elif
isinstance
(
val
,
(
tuple
,
list
)):
li
=
[
str
(
el
)
for
el
in
val
if
isinstance
(
el
,
int
)]
li
=
[
str
(
plg
)
for
plg
in
val
if
isinstance
(
plg
,
int
)]
web2py
=
'.'
.
join
(
li
)
# version of the application
myapp
=
current
.
T
(
"unknown"
)
myapp
=
T
(
"unknown"
)
if
o
s
.
path
.
exists
(
VERSION
):
with
open
(
o
s
.
path
.
join
(
server_path
,
VERSION
))
as
fi
:
if
o
pe
(
VERSION
):
with
open
(
o
pj
(
server_path
,
VERSION
))
as
fi
:
myapp
=
fi
.
read
()
elif
o
s
.
path
.
exists
(
GIT
):
elif
o
pe
(
GIT
):
ref_path
=
os
.
getcwd
()
os
.
chdir
(
server_path
)
...
...
@@ -659,14 +675,17 @@ def get_versions():
# prepare the output
li
=
[
dict
(
code
=
"web2py"
,
version
=
web2py
),
dict
(
code
=
"dbui"
,
version
=
dbui
),
dict
(
code
=
"extjs"
,
version
=
extjs
),
dict
(
code
=
"mathjax"
,
version
=
mathjax
),
dict
(
code
=
"ace"
,
version
=
ace
),
dict
(
code
=
"
plugin_
dbui"
,
version
=
dbui
),
dict
(
code
=
"
plugin_
extjs"
,
version
=
extjs
),
dict
(
code
=
"
plugin_
mathjax"
,
version
=
mathjax
),
dict
(
code
=
"
plugin_
ace"
,
version
=
ace
),
dict
(
code
=
"matplotlib"
,
version
=
mpl
),
dict
(
code
=
"pandas"
,
version
=
pnd
),
dict
(
code
=
current
.
request
.
application
,
version
=
myapp
)]
li
.
extend
(
plugins
)
li
.
sort
()
return
li
...
...
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