This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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

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'
    $ 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

    $ # after patch
    $ python -c 'import sys; print sys.platform'
    $ python -c 'import sys; print sys.path'
    [..., '/usr/lib/python2.1/plat-cygwin', ...]
    $ find /usr/lib/python2.1 -name '*cygwin*' -type d

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*'

    $ # 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*'

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.


Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798
82 Bethany Road, Suite 7             Email:
Hazlet, NJ 07730 USA                 WWW:
RCS file: /cvsroot/python/python/dist/src/,v
retrieving revision 1.218
diff -c -r1.218
***	2001/05/11 16:10:56	1.218
---	2001/05/28 01:10:03
*** 66,71 ****
--- 66,72 ----
  	case $MACHDEP in
+ 	cygwin*) MACHDEP="cygwin";;
  	'')	MACHDEP="unknown";;
Index: Lib/distutils/
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/,v
retrieving revision 1.63
diff -c -r1.63
*** Lib/distutils/	2001/03/23 17:30:26	1.63
--- Lib/distutils/	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:

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


..but it is actually put into...


..where Python doesn't find it.

Scientific Python's 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
National Institute for Water and Atmospheric Research

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]