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
306d12d0
Commit
306d12d0
authored
Apr 11, 2017
by
LE GAC Renaud
Browse files
Remove the obsolete scripts/run.
parent
5384ff01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
65 deletions
+0
-65
scripts/run
scripts/run
+0
-65
No files found.
scripts/run
deleted
100755 → 0
View file @
5384ff01
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" NAME
run -- run a script using the application model
SYNOPSIS
run [options] script.py
DESCRIPTION
run the script in the web2py context when the
application model is instantiated.
OPTIONS
-h, --help
Display the help and exit.
EXAMPLE
> cd ... myapp/scripts
> ./run myscript.py
AUTHOR
R. Le Gac
"""
if
__name__
==
"__main__"
:
import
os
import
subprocess
import
sys
from
argparse
import
ArgumentParser
APP
=
os
.
getcwd
().
split
(
os
.
sep
)[
-
2
]
WEB2PY_DIR
=
'../../web2py'
WEB2PY
=
os
.
path
.
join
(
WEB2PY_DIR
,
'web2py.py'
)
# command line options
parser
=
ArgumentParser
()
parser
.
add_argument
(
'script'
,
help
=
'the name of the script to be run.'
)
parser
.
add_argument
(
'args'
,
nargs
=
'*'
,
help
=
'the arguments for the script.'
)
args
=
parser
.
parse_args
()
# run the script in the track_publication context
script_path
=
os
.
path
.
join
(
os
.
getcwd
(),
args
.
script
)
cmd
=
[
WEB2PY
,
'--no-banner'
,
'--shell'
,
APP
,
'--import_models'
,
'--run'
,
script_path
]
if
args
.
args
:
cmd
.
append
(
'--args'
)
cmd
.
extend
(
args
.
args
)
return_code
=
subprocess
.
call
(
cmd
)
# exit
sys
.
exit
(
return_code
)
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