[Python-Dev] Case sensitive import.

Jason Tishler Jason.Tishler@dothill.com
Mon, 5 Feb 2001 12:27:21 -0500


On Sun, Feb 04, 2001 at 03:13:29AM -0500, Tim Peters wrote:
> [Barry A. Warsaw]
> > So, let's tease out what the Right solution would be, and then
> > see how close or if we can get there for 2.1.  I've no clue what
> > behavior Mac and Windows users would /like/ to see -- what would
> > be most natural for them?

On 2001-Jan-11 07:56, Jason Tishler wrote:
> I have created a (hacky) patch, that solves this problem for both Cygwin and 
> Win32. I can redo it so that it only affects Cygwin and leaves the Win32 
> functionality alone. I would like to upload it for discussion...

Part of my motivation when submitting patch 103154, was to attempt to
elicit the "right" solution.

> I don't understand what Cygwin does; here from a Cygwin bash shell session:
> 
> ...
> 
> So best I can tell, they're like Steven:  working with a case-insensitive
> filesystem but trying to make Python insist that it's not, and what basic
> tools there do about case is seemingly random (wc doesn't care, shell
> expansion does, touch doesn't, rm doesn't (not shown) -- maybe it's just
> shell expansion that's trying to pretend this is Unix?

Sorry, but I don't agree with your assessment that Cygwin's treatment
of case is "seemingly random."  IMO, Cygwin behaves appropriately
regarding case for a case-insensitive, but case-preserving file system.

The only "inconsistency" that you found is just one of bash's
idiosyncrasies -- how it handles glob-ing.  Note that one can use
"shopt -s nocaseglob" to get case-insensitive glob-ing with bash on
Cygwin *and* UNIX.

> So I view the current rules as inexplicable:  they're neither
> platform-independent nor consistent with the platform's natural behavior
> (unless that platform has case-sensitive filesystem semantics).

Agreed.

> Bottom line:  for the purpose of import-from-file (and except for
> case-destroying filesystems, where PYTHONCASEOK is the only hope), we *can*
> make case-insensitive case-preserving filesystems "act like" they were
> case-sensitive with modest effort.

I feel that the above behavior would be best for Cygwin Python.  I hope
that Steven's patch (i.e., 103495) or a modified version of it remains
as part of Python CVS.

> We can't do the reverse.  That would
> lead to explainable rules and maximal portability.

Sorry but I don't grok the above.  Tim, can you try again?

BTW, importing of builtin modules is case-sensitive even on platforms
such as Windows.  Wouldn't it be more consistent if all imports
regardless of type were case-sensitive?

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com