diff options
author | Jesus Cea <jcea@jcea.es> | 2012-10-04 23:48:08 (GMT) |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2012-10-04 23:48:08 (GMT) |
commit | ab70e2ab3264c444ac70a1c98e869b0de0b22c4a (patch) | |
tree | a2099226049a55b36ae852219ef083f25554dd85 /Modules/posixmodule.c | |
parent | f6c2e894aec9c373b658b0aaa13d7e54da10f3ad (diff) | |
download | cpython-ab70e2ab3264c444ac70a1c98e869b0de0b22c4a.zip cpython-ab70e2ab3264c444ac70a1c98e869b0de0b22c4a.tar.gz cpython-ab70e2ab3264c444ac70a1c98e869b0de0b22c4a.tar.bz2 |
#16135: Removal of OS/2 support (posixmodule y platform dependent files)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 554 |
1 files changed, 8 insertions, 546 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index bd94ffb..1089ae3 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1,15 +1,12 @@ /* POSIX module implementation */ -/* This file is also used for Windows NT/MS-Win and OS/2. In that case the - module actually calls itself 'nt' or 'os2', not 'posix', and a few +/* This file is also used for Windows NT/MS-Win. In that case the + module actually calls itself 'nt', not 'posix', and a few functions are either unimplemented or implemented differently. The source assumes that for Windows NT, the macro 'MS_WINDOWS' is defined independent of the compiler used. Different compilers define their own feature - test macro, e.g. '__BORLANDC__' or '_MSC_VER'. For OS/2, the compiler - independent macro PYOS_OS2 should be defined. On OS/2 the default - compiler is assumed to be IBM's VisualAge C++ (VACPP). PYCC_GCC is used - as the compiler specific macro for the EMX port of gcc to OS/2. */ + test macro, e.g. '__BORLANDC__' or '_MSC_VER'. */ #ifdef __APPLE__ /* @@ -43,22 +40,6 @@ disguised Unix interface). Refer to the library manual and\n\ corresponding Unix manual entries for more information on calls."); -#if defined(PYOS_OS2) -#error "PEP 11: OS/2 is now unsupported, code will be removed in Python 3.4" -#define INCL_DOS -#define INCL_DOSERRORS -#define INCL_DOSPROCESS -#define INCL_NOPMAPI -#include <os2.h> -#if defined(PYCC_GCC) -#include <ctype.h> -#include <io.h> -#include <stdio.h> -#include <process.h> -#endif -#include "osdefs.h" -#endif - #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #endif @@ -143,17 +124,10 @@ corresponding Unix manual entries for more information on calls."); /* Various compilers have only certain posix functions */ /* XXX Gosh I wish these were all moved into pyconfig.h */ -#if defined(PYCC_VACPP) && defined(PYOS_OS2) -#include <process.h> -#else #if defined(__WATCOMC__) && !defined(__QNX__) /* Watcom compiler */ #define HAVE_GETCWD 1 #define HAVE_OPENDIR 1 #define HAVE_SYSTEM 1 -#if defined(__OS2__) -#define HAVE_EXECV 1 -#define HAVE_WAIT 1 -#endif #include <process.h> #else #ifdef __BORLANDC__ /* Borland compiler */ @@ -176,8 +150,8 @@ corresponding Unix manual entries for more information on calls."); #define HAVE_FSYNC 1 #define fsync _commit #else -#if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS) -/* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */ +#if defined(__VMS) +/* Everything needed is defined in vms/pyconfig.h */ #else /* all other compilers */ /* Unix functions that the configure script doesn't check for */ #define HAVE_EXECV 1 @@ -197,11 +171,10 @@ corresponding Unix manual entries for more information on calls."); #define HAVE_SYSTEM 1 #define HAVE_WAIT 1 #define HAVE_TTYNAME 1 -#endif /* PYOS_OS2 && PYCC_GCC && __VMS */ +#endif /* __VMS */ #endif /* _MSC_VER */ #endif /* __BORLANDC__ */ #endif /* ! __WATCOMC__ || __QNX__ */ -#endif /* ! __IBMC__ */ @@ -332,10 +305,6 @@ static int win32_can_symlink = 0; #endif #endif /* _MSC_VER */ -#if defined(PYCC_VACPP) && defined(PYOS_OS2) -#include <io.h> -#endif /* OS2 */ - #ifndef MAXPATHLEN #if defined(PATH_MAX) && PATH_MAX > 1024 #define MAXPATHLEN PATH_MAX @@ -970,10 +939,6 @@ convertenviron(void) #else char **e; #endif -#if defined(PYOS_OS2) - APIRET rc; - char buffer[1024]; /* OS/2 Provides a Documented Max of 1024 Chars */ -#endif d = PyDict_New(); if (d == NULL) @@ -1042,20 +1007,6 @@ convertenviron(void) Py_DECREF(v); } #endif -#if defined(PYOS_OS2) - rc = DosQueryExtLIBPATH(buffer, BEGIN_LIBPATH); - if (rc == NO_ERROR) { /* (not a type, envname is NOT 'BEGIN_LIBPATH') */ - PyObject *v = PyBytes_FromString(buffer); - PyDict_SetItemString(d, "BEGINLIBPATH", v); - Py_DECREF(v); - } - rc = DosQueryExtLIBPATH(buffer, END_LIBPATH); - if (rc == NO_ERROR) { /* (not a typo, envname is NOT 'END_LIBPATH') */ - PyObject *v = PyBytes_FromString(buffer); - PyDict_SetItemString(d, "ENDLIBPATH", v); - Py_DECREF(v); - } -#endif return d; } @@ -1155,83 +1106,6 @@ path_error(char *function_name, path_t *path) #endif } -#if defined(PYOS_OS2) -/********************************************************************** - * Helper Function to Trim and Format OS/2 Messages - **********************************************************************/ -static void -os2_formatmsg(char *msgbuf, int msglen, char *reason) -{ - msgbuf[msglen] = '\0'; /* OS/2 Doesn't Guarantee a Terminator */ - - if (strlen(msgbuf) > 0) { /* If Non-Empty Msg, Trim CRLF */ - char *lastc = &msgbuf[ strlen(msgbuf)-1 ]; - - while (lastc > msgbuf && isspace(Py_CHARMASK(*lastc))) - *lastc-- = '\0'; /* Trim Trailing Whitespace (CRLF) */ - } - - /* Add Optional Reason Text */ - if (reason) { - strcat(msgbuf, " : "); - strcat(msgbuf, reason); - } -} - -/********************************************************************** - * Decode an OS/2 Operating System Error Code - * - * A convenience function to lookup an OS/2 error code and return a - * text message we can use to raise a Python exception. - * - * Notes: - * The messages for errors returned from the OS/2 kernel reside in - * the file OSO001.MSG in the \OS2 directory hierarchy. - * - **********************************************************************/ -static char * -os2_strerror(char *msgbuf, int msgbuflen, int errorcode, char *reason) -{ - APIRET rc; - ULONG msglen; - - /* Retrieve Kernel-Related Error Message from OSO001.MSG File */ - Py_BEGIN_ALLOW_THREADS - rc = DosGetMessage(NULL, 0, msgbuf, msgbuflen, - errorcode, "oso001.msg", &msglen); - Py_END_ALLOW_THREADS - - if (rc == NO_ERROR) - os2_formatmsg(msgbuf, msglen, reason); - else - PyOS_snprintf(msgbuf, msgbuflen, - "unknown OS error #%d", errorcode); - - return msgbuf; -} - -/* Set an OS/2-specific error and return NULL. OS/2 kernel - errors are not in a global variable e.g. 'errno' nor are - they congruent with posix error numbers. */ - -static PyObject * -os2_error(int code) -{ - char text[1024]; - PyObject *v; - - os2_strerror(text, sizeof(text), code, ""); - - v = Py_BuildValue("(is)", code, text); - if (v != NULL) { - PyErr_SetObject(PyExc_OSError, v); - Py_DECREF(v); - } - return NULL; /* Signal to Python that an Exception is Pending */ -} - -#endif /* OS2 */ - /* POSIX generic methods */ static PyObject * @@ -2569,8 +2443,6 @@ posix_chdir(PyObject *self, PyObject *args, PyObject *kwargs) else result = win32_chdir(path.narrow); result = !result; /* on unix, success = 0, on windows, success = !0 */ -#elif defined(PYOS_OS2) && defined(PYCC_GCC) - result = _chdir2(path.narrow); #else #ifdef HAVE_FCHDIR if (path.fd != -1) @@ -3145,11 +3017,7 @@ posix_getcwd(int use_bytes) #endif Py_BEGIN_ALLOW_THREADS -#if defined(PYOS_OS2) && defined(PYCC_GCC) - res = _getcwd2(buf, sizeof buf); -#else res = getcwd(buf, sizeof buf); -#endif Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); @@ -3313,17 +3181,6 @@ posix_listdir(PyObject *self, PyObject *args, PyObject *kwargs) Py_ssize_t len = sizeof(namebuf)-5; PyObject *po = NULL; wchar_t *wnamebuf = NULL; -#elif defined(PYOS_OS2) -#ifndef MAX_PATH -#define MAX_PATH CCHMAXPATH -#endif - char *pt; - PyObject *v; - char namebuf[MAX_PATH+5]; - HDIR hdir = 1; - ULONG srchcnt = 1; - FILEFINDBUF3 ep; - APIRET rc; #else PyObject *v; DIR *dirp = NULL; @@ -3485,68 +3342,6 @@ exit: return list; -#elif defined(PYOS_OS2) - if (path.length >= MAX_PATH) { - PyErr_SetString(PyExc_ValueError, "path too long"); - goto exit; - } - strcpy(namebuf, path.narrow); - for (pt = namebuf; *pt; pt++) - if (*pt == ALTSEP) - *pt = SEP; - if (namebuf[len-1] != SEP) - namebuf[len++] = SEP; - strcpy(namebuf + len, "*.*"); - - if ((list = PyList_New(0)) == NULL) { - goto exit; - } - - rc = DosFindFirst(namebuf, /* Wildcard Pattern to Match */ - &hdir, /* Handle to Use While Search Directory */ - FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY, - &ep, sizeof(ep), /* Structure to Receive Directory Entry */ - &srchcnt, /* Max and Actual Count of Entries Per Iteration */ - FIL_STANDARD); /* Format of Entry (EAs or Not) */ - - if (rc != NO_ERROR) { - errno = ENOENT; - Py_DECREF(list); - list = posix_error_with_filename(path.narrow); - goto exit; - } - - if (srchcnt > 0) { /* If Directory is NOT Totally Empty, */ - do { - if (ep.achName[0] == '.' - && (ep.achName[1] == '\0' || (ep.achName[1] == '.' && ep.achName[2] == '\0'))) - continue; /* Skip Over "." and ".." Names */ - - strcpy(namebuf, ep.achName); - - /* Leave Case of Name Alone -- In Native Form */ - /* (Removed Forced Lowercasing Code) */ - - v = PyBytes_FromString(namebuf); - if (v == NULL) { - Py_DECREF(list); - list = NULL; - break; - } - if (PyList_Append(list, v) != 0) { - Py_DECREF(v); - Py_DECREF(list); - list = NULL; - break; - } - Py_DECREF(v); - } while (DosFindNext(hdir, &ep, sizeof(ep), &srchcnt) == NO_ERROR && srchcnt > 0); - } - -exit: - path_cleanup(&path); - - return list; #else errno = 0; @@ -4852,10 +4647,6 @@ parse_envlist(PyObject* env, Py_ssize_t *envc_ptr) goto error; } -#if defined(PYOS_OS2) - /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ - if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { -#endif k = PyBytes_AsString(key2); v = PyBytes_AsString(val2); len = PyBytes_GET_SIZE(key2) + PyBytes_GET_SIZE(val2) + 2; @@ -4871,9 +4662,6 @@ parse_envlist(PyObject* env, Py_ssize_t *envc_ptr) envlist[envc++] = p; Py_DECREF(key2); Py_DECREF(val2); -#if defined(PYOS_OS2) - } -#endif } Py_DECREF(vals); Py_DECREF(keys); @@ -5114,18 +4902,12 @@ posix_spawnv(PyObject *self, PyObject *args) } argvlist[argc] = NULL; -#if defined(PYOS_OS2) && defined(PYCC_GCC) - Py_BEGIN_ALLOW_THREADS - spawnval = spawnv(mode, path, argvlist); - Py_END_ALLOW_THREADS -#else if (mode == _OLD_P_OVERLAY) mode = _P_OVERLAY; Py_BEGIN_ALLOW_THREADS spawnval = _spawnv(mode, path, argvlist); Py_END_ALLOW_THREADS -#endif free_string_array(argvlist, argc); Py_DECREF(opath); @@ -5213,18 +4995,12 @@ posix_spawnve(PyObject *self, PyObject *args) if (envlist == NULL) goto fail_1; -#if defined(PYOS_OS2) && defined(PYCC_GCC) - Py_BEGIN_ALLOW_THREADS - spawnval = spawnve(mode, path, argvlist, envlist); - Py_END_ALLOW_THREADS -#else if (mode == _OLD_P_OVERLAY) mode = _P_OVERLAY; Py_BEGIN_ALLOW_THREADS spawnval = _spawnve(mode, path, argvlist, envlist); Py_END_ALLOW_THREADS -#endif if (spawnval == -1) (void) posix_error(); @@ -5245,183 +5021,6 @@ posix_spawnve(PyObject *self, PyObject *args) return res; } -/* OS/2 supports spawnvp & spawnvpe natively */ -#if defined(PYOS_OS2) -PyDoc_STRVAR(posix_spawnvp__doc__, -"spawnvp(mode, file, args)\n\n\ -Execute the program 'file' in a new process, using the environment\n\ -search path to find the file.\n\ -\n\ - mode: mode of process creation\n\ - file: executable file name\n\ - args: tuple or list of strings"); - -static PyObject * -posix_spawnvp(PyObject *self, PyObject *args) -{ - PyObject *opath; - char *path; - PyObject *argv; - char **argvlist; - int mode, i, argc; - Py_intptr_t spawnval; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - - /* spawnvp has three arguments: (mode, path, argv), where - argv is a list or tuple of strings. */ - - if (!PyArg_ParseTuple(args, "iO&O:spawnvp", &mode, - PyUnicode_FSConverter, - &opath, &argv)) - return NULL; - path = PyBytes_AsString(opath); - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, - "spawnvp() arg 2 must be a tuple or list"); - Py_DECREF(opath); - return NULL; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - Py_DECREF(opath); - return PyErr_NoMemory(); - } - for (i = 0; i < argc; i++) { - if (!fsconvert_strdup((*getitem)(argv, i), - &argvlist[i])) { - free_string_array(argvlist, i); - PyErr_SetString( - PyExc_TypeError, - "spawnvp() arg 2 must contain only strings"); - Py_DECREF(opath); - return NULL; - } - } - argvlist[argc] = NULL; - - Py_BEGIN_ALLOW_THREADS -#if defined(PYCC_GCC) - spawnval = spawnvp(mode, path, argvlist); -#else - spawnval = _spawnvp(mode, path, argvlist); -#endif - Py_END_ALLOW_THREADS - - free_string_array(argvlist, argc); - Py_DECREF(opath); - - if (spawnval == -1) - return posix_error(); - else - return Py_BuildValue("l", (long) spawnval); -} - - -PyDoc_STRVAR(posix_spawnvpe__doc__, -"spawnvpe(mode, file, args, env)\n\n\ -Execute the program 'file' in a new process, using the environment\n\ -search path to find the file.\n\ -\n\ - mode: mode of process creation\n\ - file: executable file name\n\ - args: tuple or list of arguments\n\ - env: dictionary of strings mapping to strings"); - -static PyObject * -posix_spawnvpe(PyObject *self, PyObject *args) -{ - PyObject *opath; - char *path; - PyObject *argv, *env; - char **argvlist; - char **envlist; - PyObject *res=NULL; - int mode; - Py_ssize_t argc, i, envc; - Py_intptr_t spawnval; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - int lastarg = 0; - - /* spawnvpe has four arguments: (mode, path, argv, env), where - argv is a list or tuple of strings and env is a dictionary - like posix.environ. */ - - if (!PyArg_ParseTuple(args, "ietOO:spawnvpe", &mode, - PyUnicode_FSConverter, - &opath, &argv, &env)) - return NULL; - path = PyBytes_AsString(opath); - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, - "spawnvpe() arg 2 must be a tuple or list"); - goto fail_0; - } - if (!PyMapping_Check(env)) { - PyErr_SetString(PyExc_TypeError, - "spawnvpe() arg 3 must be a mapping object"); - goto fail_0; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - PyErr_NoMemory(); - goto fail_0; - } - for (i = 0; i < argc; i++) { - if (!fsconvert_strdup((*getitem)(argv, i), - &argvlist[i])) - { - lastarg = i; - goto fail_1; - } - } - lastarg = argc; - argvlist[argc] = NULL; - - envlist = parse_envlist(env, &envc); - if (envlist == NULL) - goto fail_1; - - Py_BEGIN_ALLOW_THREADS -#if defined(PYCC_GCC) - spawnval = spawnvpe(mode, path, argvlist, envlist); -#else - spawnval = _spawnvpe(mode, path, argvlist, envlist); -#endif - Py_END_ALLOW_THREADS - - if (spawnval == -1) - (void) posix_error(); - else - res = Py_BuildValue("l", (long) spawnval); - - while (--envc >= 0) - PyMem_DEL(envlist[envc]); - PyMem_DEL(envlist); - fail_1: - free_string_array(argvlist, lastarg); - fail_0: - Py_DECREF(opath); - return res; -} -#endif /* PYOS_OS2 */ #endif /* HAVE_SPAWNV */ @@ -6420,23 +6019,8 @@ posix_kill(PyObject *self, PyObject *args) int sig; if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i:kill", &pid, &sig)) return NULL; -#if defined(PYOS_OS2) && !defined(PYCC_GCC) - if (sig == XCPT_SIGNAL_INTR || sig == XCPT_SIGNAL_BREAK) { - APIRET rc; - if ((rc = DosSendSignalException(pid, sig)) != NO_ERROR) - return os2_error(rc); - - } else if (sig == XCPT_SIGNAL_KILLPROC) { - APIRET rc; - if ((rc = DosKillProcess(DKP_PROCESS, pid)) != NO_ERROR) - return os2_error(rc); - - } else - return NULL; /* Unrecognized Signal Requested */ -#else if (kill(pid, sig) == -1) return posix_error(); -#endif Py_INCREF(Py_None); return Py_None; } @@ -7333,31 +6917,7 @@ Return an object containing floating point numbers indicating process\n\ times. The object behaves like a named tuple with these fields:\n\ (utime, stime, cutime, cstime, elapsed_time)"); -#if defined(PYCC_VACPP) && defined(PYOS_OS2) -static long -system_uptime(void) -{ - ULONG value = 0; - - Py_BEGIN_ALLOW_THREADS - DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &value, sizeof(value)); - Py_END_ALLOW_THREADS - - return value; -} - -static PyObject * -posix_times(PyObject *self, PyObject *noargs) -{ - /* Currently Only Uptime is Provided -- Others Later */ - return build_times_result( - (double)0 /* t.tms_utime / HZ */, - (double)0 /* t.tms_stime / HZ */, - (double)0 /* t.tms_cutime / HZ */, - (double)0 /* t.tms_cstime / HZ */, - (double)system_uptime() / 1000); -} -#elif defined(MS_WINDOWS) +#if defined(MS_WINDOWS) static PyObject * posix_times(PyObject *self, PyObject *noargs) { @@ -7379,7 +6939,7 @@ posix_times(PyObject *self, PyObject *noargs) (double)0, (double)0); } -#else /* Neither Windows nor OS/2 */ +#else /* Not Windows */ #define NEED_TICKS_PER_SECOND static long ticks_per_second = -1; static PyObject * @@ -8123,16 +7683,6 @@ Create a pipe."); static PyObject * posix_pipe(PyObject *self, PyObject *noargs) { -#if defined(PYOS_OS2) - HFILE read, write; - APIRET rc; - - rc = DosCreatePipe( &read, &write, 4096); - if (rc != NO_ERROR) - return os2_error(rc); - - return Py_BuildValue("(ii)", read, write); -#else #if !defined(MS_WINDOWS) int fds[2]; int res; @@ -8151,7 +7701,6 @@ posix_pipe(PyObject *self, PyObject *noargs) write_fd = _open_osfhandle((Py_intptr_t)write, 1); return Py_BuildValue("(ii)", read_fd, write_fd); #endif /* MS_WINDOWS */ -#endif } #endif /* HAVE_PIPE */ @@ -10825,10 +10374,6 @@ static PyMethodDef posix_methods[] = { #ifdef HAVE_SPAWNV {"spawnv", posix_spawnv, METH_VARARGS, posix_spawnv__doc__}, {"spawnve", posix_spawnve, METH_VARARGS, posix_spawnve__doc__}, -#if defined(PYOS_OS2) - {"spawnvp", posix_spawnvp, METH_VARARGS, posix_spawnvp__doc__}, - {"spawnvpe", posix_spawnvpe, METH_VARARGS, posix_spawnvpe__doc__}, -#endif /* PYOS_OS2 */ #endif /* HAVE_SPAWNV */ #ifdef HAVE_FORK1 {"fork1", posix_fork1, METH_NOARGS, posix_fork1__doc__}, @@ -11155,59 +10700,6 @@ ins(PyObject *module, char *symbol, long value) return PyModule_AddIntConstant(module, symbol, value); } -#if defined(PYOS_OS2) -/* Insert Platform-Specific Constant Values (Strings & Numbers) of Common Use */ -static int insertvalues(PyObject *module) -{ - APIRET rc; - ULONG values[QSV_MAX+1]; - PyObject *v; - char *ver, tmp[50]; - - Py_BEGIN_ALLOW_THREADS - rc = DosQuerySysInfo(1L, QSV_MAX, &values[1], sizeof(ULONG) * QSV_MAX); - Py_END_ALLOW_THREADS - - if (rc != NO_ERROR) { - os2_error(rc); - return -1; - } - - if (ins(module, "meminstalled", values[QSV_TOTPHYSMEM])) return -1; - if (ins(module, "memkernel", values[QSV_TOTRESMEM])) return -1; - if (ins(module, "memvirtual", values[QSV_TOTAVAILMEM])) return -1; - if (ins(module, "maxpathlen", values[QSV_MAX_PATH_LENGTH])) return -1; - if (ins(module, "maxnamelen", values[QSV_MAX_COMP_LENGTH])) return -1; - if (ins(module, "revision", values[QSV_VERSION_REVISION])) return -1; - if (ins(module, "timeslice", values[QSV_MIN_SLICE])) return -1; - - switch (values[QSV_VERSION_MINOR]) { - case 0: ver = "2.00"; break; - case 10: ver = "2.10"; break; - case 11: ver = "2.11"; break; - case 30: ver = "3.00"; break; - case 40: ver = "4.00"; break; - case 50: ver = "5.00"; break; - default: - PyOS_snprintf(tmp, sizeof(tmp), - "%d-%d", values[QSV_VERSION_MAJOR], - values[QSV_VERSION_MINOR]); - ver = &tmp[0]; - } - - /* Add Indicator of the Version of the Operating System */ - if (PyModule_AddStringConstant(module, "version", tmp) < 0) - return -1; - - /* Add Indicator of Which Drive was Used to Boot the System */ - tmp[0] = 'A' + values[QSV_BOOT_DRIVE] - 1; - tmp[1] = ':'; - tmp[2] = '\0'; - - return PyModule_AddStringConstant(module, "bootdrive", tmp); -} -#endif - #if defined(HAVE_SYMLINK) && defined(MS_WINDOWS) static int enable_symlink() @@ -11542,35 +11034,12 @@ all_ins(PyObject *d) #endif #ifdef HAVE_SPAWNV -#if defined(PYOS_OS2) && defined(PYCC_GCC) - if (ins(d, "P_WAIT", (long)P_WAIT)) return -1; - if (ins(d, "P_NOWAIT", (long)P_NOWAIT)) return -1; - if (ins(d, "P_OVERLAY", (long)P_OVERLAY)) return -1; - if (ins(d, "P_DEBUG", (long)P_DEBUG)) return -1; - if (ins(d, "P_SESSION", (long)P_SESSION)) return -1; - if (ins(d, "P_DETACH", (long)P_DETACH)) return -1; - if (ins(d, "P_PM", (long)P_PM)) return -1; - if (ins(d, "P_DEFAULT", (long)P_DEFAULT)) return -1; - if (ins(d, "P_MINIMIZE", (long)P_MINIMIZE)) return -1; - if (ins(d, "P_MAXIMIZE", (long)P_MAXIMIZE)) return -1; - if (ins(d, "P_FULLSCREEN", (long)P_FULLSCREEN)) return -1; - if (ins(d, "P_WINDOWED", (long)P_WINDOWED)) return -1; - if (ins(d, "P_FOREGROUND", (long)P_FOREGROUND)) return -1; - if (ins(d, "P_BACKGROUND", (long)P_BACKGROUND)) return -1; - if (ins(d, "P_NOCLOSE", (long)P_NOCLOSE)) return -1; - if (ins(d, "P_NOSESSION", (long)P_NOSESSION)) return -1; - if (ins(d, "P_QUOTE", (long)P_QUOTE)) return -1; - if (ins(d, "P_TILDE", (long)P_TILDE)) return -1; - if (ins(d, "P_UNRELATED", (long)P_UNRELATED)) return -1; - if (ins(d, "P_DEBUGDESC", (long)P_DEBUGDESC)) return -1; -#else if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1; if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1; if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1; #endif -#endif #ifdef HAVE_SCHED_H if (ins(d, "SCHED_OTHER", (long)SCHED_OTHER)) return -1; @@ -11630,9 +11099,6 @@ all_ins(PyObject *d) if (PyModule_AddIntMacro(d, RTLD_DEEPBIND)) return -1; #endif -#if defined(PYOS_OS2) - if (insertvalues(d)) return -1; -#endif return 0; } @@ -11641,10 +11107,6 @@ all_ins(PyObject *d) #define INITFUNC PyInit_nt #define MODNAME "nt" -#elif defined(PYOS_OS2) -#define INITFUNC PyInit_os2 -#define MODNAME "os2" - #else #define INITFUNC PyInit_posix #define MODNAME "posix" |