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: Tue, 29 May 2001 13:29:36 -0400 From: Jason Tishler To: Cygwin-Apps Cc: Python-List , Distutils-Sig Subject: Cygwin Python sys.platform and distutils.util.get_platform() patch Message-ID: <20010529132936.C498@dothill.com> Mail-Followup-To: Cygwin-Apps , Python-List , Distutils-Sig Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ohmds5dUDiOjm0u1" Content-Disposition: inline User-Agent: Mutt/1.3.18i Organization: Dot Hill Systems Corp. --ohmds5dUDiOjm0u1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I would like to submit the attached patch (i.e., the first attachment) to Python CVS for inclusion in 2.2. IMO, this is the right solution for many reasons. I have included one example as the the second attachment. If the patch is accepted, then I will back patch and re-release my Cygwin Python 2.1 distribution. Since these two simple changes have possibly far reaching ramifications, I thought that it would be prudent to solicit feedback before submitting the patch. My goal is to eliminate (or at least minimize) the heartache caused by these changes, if any. Note that the two parts of the patch are actually independent but related so I have decided to submit them as one patch instead of two. The first part changes sys.platform, sys.path, and the platform specific module directory name as follows: $ # before patch $ python -c 'import sys; print sys.platform' cygwin_nt-4.01 $ python -c 'import sys; print sys.path' [..., '/usr/lib/python2.1/plat-cygwin_nt-4.01', ...] $ find /usr/lib/python2.1 -name '*cygwin*' -type d /usr/lib/python2.1/plat-cygwin_nt-4.01 $ # after patch $ python -c 'import sys; print sys.platform' cygwin $ python -c 'import sys; print sys.path' [..., '/usr/lib/python2.1/plat-cygwin', ...] $ find /usr/lib/python2.1 -name '*cygwin*' -type d /usr/lib/python2.1/plat-cygwin The second part changes sys.path (only when Python is run out of the build tree) and the directory names used by distutils when building extension modules: $ # before patch $ python -c 'import sys; print sys.path' [..., '/home/jt/src/Python-2.1/build/lib.cygwin_nt-4.0-1.3.2-i686-2.1'] $ find . -name '*cygwin*' ./build/lib.cygwin_nt-4.0-1.3.0-i686-2.1 ./build/temp.cygwin_nt-4.0-1.3.0-i686-2.1 $ # after patch $ python -c 'import sys; print sys.path' [..., '/home/jt/src/Python-2.1/build/lib.cygwin-1.3.2-i686-2.1'] $ find . -name '*cygwin*' ./build/lib.cygwin-1.3.2-i686-2.2 ./build/temp.cygwin-1.3.2-i686-2.2 If I don't receive any negative responses to this patch proposal by 2001/6/1 9:00 EDT, then I will submit this patch to the SourceForge Python Patch Manager. Thanks, Jason -- Jason Tishler Director, Software Engineering Phone: 732.264.8770 x235 Dot Hill Systems Corp. Fax: 732.264.8798 82 Bethany Road, Suite 7 Email: Jason DOT Tishler AT dothill DOT com Hazlet, NJ 07730 USA WWW: http://www.dothill.com --ohmds5dUDiOjm0u1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="python.patch" Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.218 diff -c -r1.218 configure.in *** configure.in 2001/05/11 16:10:56 1.218 --- configure.in 2001/05/28 01:10:03 *************** *** 66,71 **** --- 66,72 ---- MACHDEP="$ac_md_system$ac_md_release" case $MACHDEP in + cygwin*) MACHDEP="cygwin";; '') MACHDEP="unknown";; esac fi Index: Lib/distutils/util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/util.py,v retrieving revision 1.63 diff -c -r1.63 util.py *** Lib/distutils/util.py 2001/03/23 17:30:26 1.63 --- Lib/distutils/util.py 2001/05/28 01:10:03 *************** *** 62,67 **** --- 62,68 ---- elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": + osname = "cygwin" rel_re = re.compile (r'[\d.]+') m = rel_re.match(release) if m: --ohmds5dUDiOjm0u1 Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Sieve: cmu-sieve 2.0 Received: from dothill.com (artecon.artecon.com [206.2.34.1]) by ny.dothill.com (8.11.2/8.11.2) with ESMTP id f4Q06Cd16218 for ; Fri, 25 May 2001 20:06:13 -0400 Received: from niwa.cri.nz (clam.niwa.cri.nz [202.36.29.1]) by dothill.com (8.9.1b+Sun/8.9.1) with ESMTP id QAA22195 for ; Fri, 25 May 2001 16:48:01 -0700 (PDT) Received: from storm.niwa.cri.nz (storm.niwa.cri.nz [192.168.60.10]) by niwa.cri.nz (8.11.2/8.11.2) with ESMTP id f4Q068d08279 for ; Sat, 26 May 2001 12:06:08 +1200 (NZST) Received: from Hadfield (hadfield.greta.niwa.cri.nz [192.168.56.217]) by storm.niwa.cri.nz (8.11.1/8.11.2) with SMTP id f4Q068L74586 for ; Sat, 26 May 2001 12:06:08 +1200 (NZST) Message-ID: <000b01c0e577$b15b1820$d938a8c0 AT Hadfield> From: "Mark Hadfield" To: "Jason Tishler" Subject: Cygwin Python, sys.platform & distutils Date: Sat, 26 May 2001 12:06:20 +1200 Organization: NIWA MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Hello Jason I would like your opinion on another minor Cygwin Python distutils buglet. I recently installed Konrad Hinsen's Scientific Python package with the Python package you built for Cygwin. This package creates one C-extension DLL, which is supposed to be installed into /usr/lib/python2.1/site-packages/Scientific/cygwin_nt-4.01 ..but it is actually put into... /usr/lib/python2.1/site-packages/Scientific/cygwin_nt-4/01 ..where Python doesn't find it. Scientific Python's setup.py includes the following line ext_package = 'Scientific.'+sys.platform, I presume the '.' in sys.platform on the Cygwin system is being interpreted as a delimiter in the package's directory hierarchy. Konrad confirmed this interpretation, but also commented that he was not aware of any other platform which has a '.' in sys.platform. On the only other Unix platform I have easy access to, bash's MACHTYPE is alphaev6-dec-osf5.1 and Python's sys.platform is 'osf1V5'. So should Cygwin Python's sys.platform be calculated differently? --- Mark Hadfield m DOT hadfield AT niwa DOT cri DOT nz http://katipo.niwa.cri.nz/~hadfield National Institute for Water and Atmospheric Research --ohmds5dUDiOjm0u1--