Index: Include/pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.66 diff -u -r2.66 pyerrors.h --- Include/pyerrors.h 25 Aug 2004 02:14:06 -0000 2.66 +++ Include/pyerrors.h 25 Jul 2005 23:04:06 -0000 @@ -59,7 +59,7 @@ PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif #ifdef __VMS @@ -96,7 +96,7 @@ PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) Py_GCC_ATTRIBUTE((format(printf, 2, 3))); -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( int, const char *); PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( @@ -115,7 +115,7 @@ PyObject *,int, const Py_UNICODE *); #endif /* Py_WIN_WIDE_FILENAMES */ PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); -#endif /* MS_WINDOWS */ +#endif /* MS_WINDOWS || __CYGWIN__ */ /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); Index: Lib/webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.37 diff -u -r1.37 webbrowser.py --- Lib/webbrowser.py 10 Jul 2004 22:07:02 -0000 1.37 +++ Lib/webbrowser.py 25 Jul 2005 23:04:06 -0000 @@ -319,10 +319,10 @@ # -# Platform support for Windows +# Platform support for Windows and Cygwin # -if sys.platform[:3] == "win": +if sys.platform[:3] == "win" or sys.platform == "cygwin": _tryorder = ["netscape", "windows-default"] register("windows-default", WindowsDefault) Index: Modules/posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.337 diff -u -r2.337 posixmodule.c --- Modules/posixmodule.c 5 Jul 2005 15:21:58 -0000 2.337 +++ Modules/posixmodule.c 25 Jul 2005 23:04:12 -0000 @@ -233,12 +233,19 @@ #include #include "osdefs.h" #define _WIN32_WINNT 0x0400 /* Needed for CryptoAPI on some systems */ -#include -#include /* for ShellExecute() */ #define popen _popen #define pclose _pclose #endif /* _MSC_VER */ +#if defined(_MSC_VER) || defined(__CYGWIN__) +#include +#include /* for ShellExecute() */ +#endif + +#ifdef __CYGWIN__ +#include +#endif + #if defined(PYCC_VACPP) && defined(PYOS_OS2) #include #endif /* OS2 */ @@ -400,7 +407,7 @@ return rc; } -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) static PyObject * win32_error(char* function, char* filename) { @@ -7180,7 +7187,7 @@ return NULL; } -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) PyDoc_STRVAR(win32_startfile__doc__, "startfile(filepath) - Start a file with its associated application.\n\ \n\ @@ -7200,9 +7207,26 @@ win32_startfile(PyObject *self, PyObject *args) { char *filepath; +#ifdef __CYGWIN__ + char win32_filepath[MAX_PATH+1]; +#endif + HINSTANCE rc; if (!PyArg_ParseTuple(args, "s:startfile", &filepath)) return NULL; +#ifdef __CYGWIN__ + /* a colon after char 1 means that filepath is either a URL or + an Alternate Data Stream. But ShellExecute returns + SE_ERR_ACCESSDENIED for an ADS so we might as well assume + it's a URL and not convert the path */ + + if (strstr(filepath, ":") <= (filepath+1)) + { + cygwin_conv_to_win32_path(filepath, win32_filepath); + filepath = win32_filepath; + } +#endif /* __CYGWIN__ */ + Py_BEGIN_ALLOW_THREADS rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL); Py_END_ALLOW_THREADS @@ -7211,7 +7235,7 @@ Py_INCREF(Py_None); return Py_None; } -#endif +#endif /* _MSC_VER || __CYGWIN__ */ #ifdef HAVE_GETLOADAVG PyDoc_STRVAR(posix_getloadavg__doc__, @@ -7423,11 +7447,13 @@ #endif /* HAVE_PLOCK */ #ifdef HAVE_POPEN {"popen", posix_popen, METH_VARARGS, posix_popen__doc__}, +#if defined(MS_WINDOWS) || defined(__CYGWIN__) + {"startfile", win32_startfile, METH_VARARGS, win32_startfile__doc__}, +#endif #ifdef MS_WINDOWS {"popen2", win32_popen2, METH_VARARGS}, {"popen3", win32_popen3, METH_VARARGS}, {"popen4", win32_popen4, METH_VARARGS}, - {"startfile", win32_startfile, METH_VARARGS, win32_startfile__doc__}, #else #if defined(PYOS_OS2) && defined(PYCC_GCC) {"popen2", os2emx_popen2, METH_VARARGS}, Index: Python/errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.83 diff -u -r2.83 errors.c --- Python/errors.c 18 Jan 2005 15:26:11 -0000 2.83 +++ Python/errors.c 25 Jul 2005 23:04:13 -0000 @@ -9,7 +9,7 @@ #endif #endif -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) #include "windows.h" #include "winbase.h" #endif @@ -359,7 +359,7 @@ return PyErr_SetFromErrnoWithFilenameObject(exc, NULL); } -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) /* Windows specific error code handling */ PyObject *PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *exc, @@ -387,7 +387,7 @@ NULL); /* no args */ if (len==0) { /* Only seen this in out of mem situations */ - sprintf(s_small_buf, "Windows Error 0x%X", err); + sprintf(s_small_buf, "Windows Error 0x%X", (int)err); s = s_small_buf; s_buf = NULL; } else { @@ -475,7 +475,7 @@ return result; } #endif /* Py_WIN_WIDE_FILENAMES */ -#endif /* MS_WINDOWS */ +#endif /* MS_WINDOWS || __CYGWIN__ */ void _PyErr_BadInternalCall(char *filename, int lineno) Index: Python/exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.49 diff -u -r1.49 exceptions.c --- Python/exceptions.c 25 Aug 2004 02:14:08 -0000 1.49 +++ Python/exceptions.c 25 Jul 2005 23:04:14 -0000 @@ -648,7 +648,7 @@ PyDoc_STRVAR(OSError__doc__, "OS system call failed."); -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) PyDoc_STRVAR(WindowsError__doc__, "MS-Windows OS system call failed."); #endif /* MS_WINDOWS */ @@ -1617,7 +1617,7 @@ PyObject *PyExc_TypeError; PyObject *PyExc_ValueError; PyObject *PyExc_ZeroDivisionError; -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) PyObject *PyExc_WindowsError; #endif #ifdef __VMS @@ -1671,7 +1671,7 @@ EnvironmentError_methods}, {"IOError", &PyExc_IOError, &PyExc_EnvironmentError, IOError__doc__}, {"OSError", &PyExc_OSError, &PyExc_EnvironmentError, OSError__doc__}, -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) || defined(__CYGWIN__) {"WindowsError", &PyExc_WindowsError, &PyExc_OSError, WindowsError__doc__}, #endif /* MS_WINDOWS */