Take executable as an argument rather than always sys.executable.
This commit is contained in:
parent
e209e3a4b9
commit
22378095e8
1 changed files with 4 additions and 5 deletions
|
|
@ -6,13 +6,12 @@ from voussoirkit import betterhelp
|
||||||
from voussoirkit import pathclass
|
from voussoirkit import pathclass
|
||||||
from voussoirkit import pipeable
|
from voussoirkit import pipeable
|
||||||
|
|
||||||
def named_python(name):
|
def named_python(executable, name):
|
||||||
this_python = pathclass.Path(sys.executable)
|
this_python = pathclass.Path(executable)
|
||||||
name = name.strip()
|
name = name.strip()
|
||||||
# If this is running via another named python, we'll cut off the dash first.
|
# If this is running via another named python, we'll cut off the dash first.
|
||||||
base = this_python.replace_extension('').basename.split('-', 1)[0]
|
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}').add_extension(this_python.extension)
|
||||||
named_python = this_python.parent.with_child(f'{base}-{name}{extension}')
|
|
||||||
if named_python.exists:
|
if named_python.exists:
|
||||||
return named_python
|
return named_python
|
||||||
|
|
||||||
|
|
@ -20,7 +19,7 @@ def named_python(name):
|
||||||
return named_python
|
return named_python
|
||||||
|
|
||||||
def namedpython_argparse(args):
|
def namedpython_argparse(args):
|
||||||
exe = named_python(args.name)
|
exe = named_python(sys.executable, args.name)
|
||||||
pipeable.stdout(exe.absolute_path)
|
pipeable.stdout(exe.absolute_path)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue