Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com Date: Wed, 24 Jan 2001 09:18:18 -0500 From: Jason Tishler To: cygwin-apps AT sources DOT redhat DOT com Subject: Cygwin 1.1.7 Python 2.1a1 Patch Message-ID: <20010124091818.I1028@dothill.com> Mail-Followup-To: cygwin-apps AT sources DOT redhat DOT com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="kG28oeYIzhRxmqN9" Content-Disposition: inline User-Agent: Mutt/1.2.5i Organization: Dot Hill Systems Corp. --kG28oeYIzhRxmqN9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Previously, I had submitted the Cygwin Python DLL and Shared Extension Patch which was accepted and committed into Python CVS. This patch builds Python with a DLL core (instead of a static library) just like the native Win32 version. Once Cygwin Python has a DLL core, the standard modules can be built as shared libraries (i.e., DLLs) and extension modules can be built using either the traditional Modules/Makefile.pre or Distutils methods. Hence, Cygwin Python now supports shared extensions identical to other UNIX platforms. If you are interested in the gory details, then please see the following: http://sourceforge.net/patch/?func=detailpatch&patch_id=102409&group_id=5470 Unfortunately when the Python build was changed to use Distutils instead of the traditional method to build the standard modules, this broke the build for Cygwin. The attached patch (re)enables Python 2.1a1 to build OOTB under Cygwin. I am in the process of getting the relevant portions of this patch accepted into Python CVS. Hopefully, Cygwin Python will build OOTB from 2.1a2 on. The procedure to build Cygwin Python 2.1a1 under Cygwin 1.1.7 is as follows: $ wget -nd http://download.sourceforge.net/python/Python-2.1a1.tgz $ # save attached patch to /tmp/Cygwin-1.1.7-Python-2.1a1.patch $ tar -xvzf Python-2.1a1.tgz $ cd Python-2.1a1 $ patch -p0 > 24, (sys.hexversion >> 16) & 0xff)) + # don't extend ext.libraries, it may be shared with other + # extensions, it is a reference to the original list + return ext.libraries + [pythonlib] + elif sys.platform[:6] == "cygwin": + template = "python%d.%d" pythonlib = (template % (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) # don't extend ext.libraries, it may be shared with other Index: Modules/syslogmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/syslogmodule.c,v retrieving revision 2.17 diff -u -r2.17 syslogmodule.c --- Modules/syslogmodule.c 2000/09/01 09:01:32 2.17 +++ Modules/syslogmodule.c 2001/01/23 18:26:45 @@ -115,7 +115,11 @@ if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri)) return NULL; +#ifdef __CYGWIN__ + omaskpri = 0; +#else omaskpri = setlogmask(maskpri); +#endif return PyInt_FromLong(omaskpri); } Index: Python/import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.156 diff -u -r2.156 import.c --- Python/import.c 2001/01/18 03:03:16 2.156 +++ Python/import.c 2001/01/23 18:26:46 @@ -832,6 +832,9 @@ #ifdef CHECK_IMPORT_CASE static int check_case(char *, int, int, char *); +#ifdef __CYGWIN__ +static int cyg_check_case(char *buf, char *name, int namelen); +#endif /* __CYGWIN__ */ #endif static int find_init_module(char *); /* Forward */ @@ -965,6 +968,10 @@ strcpy(buf+len, fdp->suffix); if (Py_VerboseFlag > 1) PySys_WriteStderr("# trying %s\n", buf); +#if defined(__CYGWIN__) && defined(CHECK_IMPORT_CASE) + if (cyg_check_case(buf, name, namelen)) + continue; +#endif /* __CYGWIN__ && CHECK_IMPORT_CASE */ fp = fopen(buf, fdp->mode); if (fp != NULL) break; @@ -1063,6 +1070,34 @@ return 0; } return 1; +} + +/* + * cyg_check_case determines if the potential module matches but the name + * case does not. + * + * Returns: + * 1, if the module matches but the name case does not + * 0, otherwise + */ +static int +cyg_check_case(char *buf, char *name, int namelen) +{ + WIN32_FIND_DATA data; + HANDLE h; + char tempbuf[MAX_PATH]; + int status = 0; + + cygwin32_conv_to_win32_path(buf, tempbuf); + h = FindFirstFile(tempbuf, &data); + if (h != INVALID_HANDLE_VALUE) + { + if (strncmp(data.cFileName, name, namelen) != 0) + status = 1; + } + FindClose(h); + + return status; } #endif /* MS_WIN32 */ --kG28oeYIzhRxmqN9--