[Distutils] patch to utils.py for Windows os.path.isdir glitch

Greg Ward gward@cnri.reston.va.us
Sat, 23 Oct 1999 16:33:33 -0400


On 22 October 1999, Fred Yankowski said:
> I was finally able to install the distutils 0.1 package on my Windows
> NT machine running Python 1.5.2, after getting around two problems:

Great!

> 1) I had a very old python.exe sitting in my PATH, which when run
>    would report itself as Python version 1.5.2 but would cause
>    sys.prefix and sys.exec_prefix to be empty because Python couldn't
>    find the expected libraries relative to the python.exe location.  I
>    deleted that old python.exe and now sys.prefix and sys.exec_prefix
>    are set correctly.  Thanks to Mark Hammond for suggesting the fix.

Ahh, good -- when I read your first post, I was inclined to shoot back
with a "Sounds like a broken Python installation", but I know very very
little about Python on Windows so I kept my mouth shut.  Looks like I
would have been right.

Should I add code somewhere in Distutils to detect empty sys.prefix or
exec_prefix?  This really sounds like a clear indication that the Python
installation is badly broken, so there's no point in trying to install
anything because it simply won't work.

> 2) Running 'python -v start.py install' would result in an exception
>    in utils.py when os.mkdir() would be called on an existing
>    directory.  It seems that on Windows, os.path.isdir() does not
>    accept trailing backslashes on a directory name.  For example,
>    os.path.isdir('c:\\progra~1') returns 1 on my machine, but
>    os.path.isdir('c:\\progra~1\\') returns 0.  I tweaked utils.py to
>    account for that and now the installation seems to finish OK.  I
>    have attached the patch with my suggested change.

Yep, that's already been fixed.  It just took me a couple of weeks to
get around to trying it out on a Windows machine myself.  Now done.  See
my next post...

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                           voice: +1-703-620-8990
Reston, Virginia, USA  20191-5434                    fax: +1-703-620-0913