From 510d402a9bd0fd2a71428d798e0a8fe2f2582fee Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 7 Aug 2018 14:50:16 +0200 Subject: [PATCH] local_run: Allow Python interpreter options That way you can do "local_run -Wall boobank" -Wall was previously not working at all, being passed as argv[0], and gets quickly annoying. --- tools/local_run.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/local_run.py b/tools/local_run.py index 8476ed143a..4f5b7929f0 100644 --- a/tools/local_run.py +++ b/tools/local_run.py @@ -2,16 +2,20 @@ # -*- coding: utf-8 -*- from __future__ import print_function +import os import subprocess import sys -import os if len(sys.argv) < 2: print("Usage: %s SCRIPTNAME [args]" % sys.argv[0]) sys.exit(1) else: - script = sys.argv[1] - args = sys.argv[2:] + args = sys.argv[1:] + pyargs = [] + while args and args[0].startswith('-'): + pyargs.append(args.pop(0)) + script = args.pop(0) + project = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) wd = os.path.join(project, 'localconfig') @@ -54,5 +58,5 @@ os.execvpe( sys.executable, - [sys.executable, '-Wall', '-s', spath] + args, + [sys.executable, '-s'] + pyargs + [spath] + args, env) -- GitLab