aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2022-03-29 18:35:47 -0400
committerEli Schwartz <eschwartz93@gmail.com>2022-03-29 21:57:46 -0400
commit969ae6e0e1ffe3d1acb6ef0ef93c809b566a3ea1 (patch)
treea13032b4ecc7f3294fad5f40698f0aa77ce88d8e
parent258cd5d5836a6660f1122cec274f0a947c1d0459 (diff)
downloadmeson-969ae6e0e1ffe3d1acb6ef0ef93c809b566a3ea1.zip
meson-969ae6e0e1ffe3d1acb6ef0ef93c809b566a3ea1.tar.gz
meson-969ae6e0e1ffe3d1acb6ef0ef93c809b566a3ea1.tar.bz2
Correctly handle --version argument to runpython
Followup to #10204.
-rw-r--r--mesonbuild/mesonmain.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 04ea8f5..5d720f0 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -96,16 +96,14 @@ class CommandLineParser:
def add_runpython_arguments(self, parser: argparse.ArgumentParser):
parser.add_argument('-c', action='store_true', dest='eval_arg', default=False)
- parser.add_argument('--version', action='store_true')
- parser.add_argument('script_file', nargs='?')
+ parser.add_argument('--version', action='version', version=platform.python_version())
+ parser.add_argument('script_file')
parser.add_argument('script_args', nargs=argparse.REMAINDER)
def run_runpython_command(self, options):
import runpy
if options.eval_arg:
exec(options.script_file)
- elif options.version:
- print(platform.python_version())
else:
sys.argv[1:] = options.script_args
sys.path.insert(0, os.path.dirname(options.script_file))