From 22378095e82bfcfa7ef5950a3828eecddae307a9 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 29 Aug 2026 16:34:36 -0700 Subject: [PATCH] Take executable as an argument rather than always sys.executable. --- named_python.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/named_python.py b/named_python.py index f1faf4f..14b8e09 100644 --- a/named_python.py +++ b/named_python.py @@ -6,13 +6,12 @@ from voussoirkit import betterhelp from voussoirkit import pathclass from voussoirkit import pipeable -def named_python(name): - this_python = pathclass.Path(sys.executable) +def named_python(executable, name): + this_python = pathclass.Path(executable) name = name.strip() # If this is running via another named python, we'll cut off the dash first. base = this_python.replace_extension('').basename.split('-', 1)[0] - extension = this_python.extension.with_dot - named_python = this_python.parent.with_child(f'{base}-{name}{extension}') + named_python = this_python.parent.with_child(f'{base}-{name}').add_extension(this_python.extension) if named_python.exists: return named_python @@ -20,7 +19,7 @@ def named_python(name): return named_python def namedpython_argparse(args): - exe = named_python(args.name) + exe = named_python(sys.executable, args.name) pipeable.stdout(exe.absolute_path) return 0