summaryrefslogtreecommitdiffstats
path: root/Mac/Tools
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-05-26 02:45:29 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-05-26 02:45:29 (GMT)
commit7ded1f0f694f0f99252ea19eca18b74ea5e36cb0 (patch)
tree1f07c57fddc9627f3d506b7a8d25ded561f5a2e0 /Mac/Tools
parentf2bdc3690a59ca2af3f2fa82f506350874ff1467 (diff)
downloadcpython-7ded1f0f694f0f99252ea19eca18b74ea5e36cb0.zip
cpython-7ded1f0f694f0f99252ea19eca18b74ea5e36cb0.tar.gz
cpython-7ded1f0f694f0f99252ea19eca18b74ea5e36cb0.tar.bz2
Implemented PEP 405 (Python virtual environments).
Diffstat (limited to 'Mac/Tools')
-rw-r--r--Mac/Tools/pythonw.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Mac/Tools/pythonw.c b/Mac/Tools/pythonw.c
index 30c82ac..ebee531 100644
--- a/Mac/Tools/pythonw.c
+++ b/Mac/Tools/pythonw.c
@@ -150,6 +150,18 @@ setup_spawnattr(posix_spawnattr_t* spawnattr)
int
main(int argc, char **argv) {
char* exec_path = get_python_path();
+ static char path[PATH_MAX * 2];
+ static char real_path[PATH_MAX * 2];
+ int status;
+ uint32_t size = PATH_MAX * 2;
+
+ /* Set the original executable path in the environment. */
+ status = _NSGetExecutablePath(path, &size);
+ if (status == 0) {
+ if (realpath(path, real_path) != NULL) {
+ setenv("__PYTHONV_LAUNCHER__", real_path, 1);
+ }
+ }
/*
* Let argv[0] refer to the new interpreter. This is needed to