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

Commit 306d12d0 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove the obsolete scripts/run.

parent 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)
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