Cygwin Python sys.platform and distutils.util.get_platform() patch

Jason Tishler Jason.Tishler at dothill.com
Tue May 29 13:29:36 EDT 2001


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.Tishler at dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com
-------------- next part --------------
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:
-------------- next part --------------
An embedded message was scrubbed...
From: "Mark Hadfield" <m.hadfield at niwa.cri.nz>
Subject: Cygwin Python, sys.platform & distutils
Date: Sat, 26 May 2001 12:06:20 +1200
Size: 2594
URL: <http://mail.python.org/pipermail/python-list/attachments/20010529/d641f56d/attachment.mht>


More information about the Python-list mailing list