You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, run() directly exec's the setuptools-generated entrypoint script, which in turn finds the correct python by including the full path to the {env_dir}/bin/python executable as a shebang line.
I propose to specify the python executable in appenv itself, instead of relying on the shebang line, like this:
diff --git a/batou b/batou
index 8f03df7..455def7 100755
--- a/batou+++ b/batou@@ -200,7 +200,10 @@ def run(argv, meta_args):
env_dir = _prepare(meta_args)
# Allow called programs to find out where the wrapper lives
os.environ['APPENV_BASEDIR'] = meta_args.base
- os.execv(os.path.join(env_dir, 'bin', meta_args.appname), argv)+ interpreter = os.path.join(env_dir, 'bin', 'python')+ entrypoint = os.path.join(env_dir, 'bin', meta_args.appname)+ argv[0] = interpreter+ argv.insert(1, entrypoint)+ os.execv(interpreter, argv)
This works fine with batou, but argv[0] is not preserved (since at least under Debian we must set argv[0] to the venv/bin/python, otherwise the venv is not recognized and the spawned python runs with the system site-packages), so programs that are interested in that will have trouble. Not sure if that's something we have to worry about, though.
The text was updated successfully, but these errors were encountered:
Ok, so one thing I'm up for is to to actually reduce the venv hash to 8 characters, similar to git's short hash. This should still be reliable enough according to 'the internet' and 'stackoverflow'. I'm with that. It's not cryptographically secure but I don't think that matters here as we're basically using it for content addressing.
Did you try the most current version of appenv? I'm running batou on debian machines and think I have fixed the site-packages issue already through a pth hack... or does that fail for you?
Creating venv ...
Ensuring pip ...
Installing batou ...
Traceback (most recent call last):
File "./batou", line 312, in <module>
main()
File "./batou", line 308, in main
meta_args.func(argv, meta_args)
File "./batou", line 203, in run
os.execv(os.path.join(env_dir, 'bin', meta_args.appname), argv)
OSError: [Errno 8] Exec format error
Currently,
run()
directlyexec
's the setuptools-generated entrypoint script, which in turn finds the correctpython
by including the full path to the{env_dir}/bin/python
executable as a shebang line.Shebang lines are limited to 127 characters, which is very easy to exceed with appenv, since the venv hash already takes up 64.
I propose to specify the python executable in appenv itself, instead of relying on the shebang line, like this:
This works fine with batou, but
argv[0]
is not preserved (since at least under Debian we must setargv[0]
to the venv/bin/python, otherwise the venv is not recognized and the spawned python runs with the system site-packages), so programs that are interested in that will have trouble. Not sure if that's something we have to worry about, though.The text was updated successfully, but these errors were encountered: