summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-08-01 21:57:49 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-08-01 21:57:49 (GMT)
commitea0c3828c00de81c953e147e085d4d2b4b906850 (patch)
treeed934aa93d0daec99e7dd57a7f3bd62a2790ebf0 /Modules
parentbe3e1f7a95a277cf77e27e0e365227cd8aecc90a (diff)
downloadcpython-ea0c3828c00de81c953e147e085d4d2b4b906850.zip
cpython-ea0c3828c00de81c953e147e085d4d2b4b906850.tar.gz
cpython-ea0c3828c00de81c953e147e085d4d2b4b906850.tar.bz2
- Get _environ through the NSEnviron call in a MacOSX framework. This allows
us to completely decouple the framework from the executable, so we can use a two-level namespace. - Do framework builds with a twolevel namespace. - Reorganized the code that creates the minimal framework in the build directory, to make it more robust against incomplete frameworks (from earlier aborted builds, or builds of previous Python versions).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 6f18da8..bf178f8 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -276,8 +276,13 @@ extern int lstat(const char *, struct stat *);
#endif
/* Return a dictionary corresponding to the POSIX environment table */
-
-#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
+#ifdef WITH_NEXT_FRAMEWORK
+/* On Darwin/MacOSX a shared library or framework has no access to
+** environ directly, we must obtain it with _NSGetEnviron().
+*/
+#include <crt_externs.h>
+static char **environ;
+#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
extern char **environ;
#endif /* !_MSC_VER */
@@ -289,6 +294,10 @@ convertenviron(void)
d = PyDict_New();
if (d == NULL)
return NULL;
+#ifdef WITH_NEXT_FRAMEWORK
+ if (environ == NULL)
+ environ = *_NSGetEnviron();
+#endif
if (environ == NULL)
return d;
/* This part ignores errors */