[Python-Dev] Case-sensitive import

Tim Peters tim.one@home.com
Tue, 27 Feb 2001 14:27:12 -0500


I'm still trying to sort this out.  Some concerns and questions:

I don't like the new MatchFilename, because it triggers on *all* platforms
that #define HAVE_DIRENT_H.

Anyone, doesn't that trigger on straight Linux systems too (all I know is
that it's part of the Single UNIX Specification)?

I don't like it because it implements a woefully inefficient algorithm:  it
cycles through the entire directory looking for a case-sensitive match.  But
there can be hundreds of .py files in a directory, and on average it will
need to look at half of them, while if this triggers on straight Linux
there's no need to look at *any* of them there.  I also don't like it because
it apparently triggers on Cygwin too but the code that calls it doesn't cater
to that Cygwin possibly *should* be defining ALTSEP as well as SEP.

Would rather dump MatchFilename and rewrite in terms of the old check_case
(which should run much quicker, and already comes in several appropriate
platform-aware versions -- and I clearly minimize the chance of breakage if I
stick to that time-tested code).

Steven, there is a "#ifdef macintosh" version of check_case already.  Will
that or won't that work correctly on your variant of Mac?  If not, would you
please supply a version that does (along with the #ifdef'ery needed to
recognize your Mac variant)?

Jason, I *assume* that the existing "#if defined(MS_WIN32) ||
defined(__CYGWIN__)" version of check_case works already for you.  Scream if
that's wrong.

Steven and Jack, does getenv() work on both your flavors of Mac?  I want to
make PYTHONCASEOK work for you too.