summaryrefslogtreecommitdiff
path: root/Mac
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-05-26 03:45:29 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-05-26 03:45:29 +0100
commitbd885cf8bc59f7621b62029065a7bbfe7ab3b9fc (patch)
treeb4509ec6075d931aee2e92e6affe2a16eb578287 /Mac
parenta124eb0185543ea02b835a6a41f5128c0a2943f5 (diff)
downloadcpython-bd885cf8bc59f7621b62029065a7bbfe7ab3b9fc.tar.gz
Implemented PEP 405 (Python virtual environments).
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Makefile.in4
-rw-r--r--Mac/Tools/pythonw.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/Mac/Makefile.in b/Mac/Makefile.in
index 8a62a9097c..6d2ad164c6 100644
--- a/Mac/Makefile.in
+++ b/Mac/Makefile.in
@@ -72,7 +72,7 @@ installunixtools:
for fn in python3 pythonw3 idle3 pydoc3 python3-config \
python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
pydoc$(VERSION) python$(VERSION)-config 2to3 \
- 2to3-$(VERSION) ;\
+ 2to3-$(VERSION) pyvenv pyvenv-$(VERSION) ;\
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
@@ -93,7 +93,7 @@ altinstallunixtools:
$(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
fi
for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
- pydoc$(VERSION) python$(VERSION)-config 2to3-$(VERSION);\
+ pydoc$(VERSION) python$(VERSION)-config 2to3-$(VERSION) pyvenv-$(VERSION) ;\
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
diff --git a/Mac/Tools/pythonw.c b/Mac/Tools/pythonw.c
index 30c82ac476..ebee5312f8 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