[Distutils] patch to utils.py for Windows os.path.isdir glitch
Fred Yankowski
fcy@acm.org
Fri, 22 Oct 1999 14:56:57 -0500
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:
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.
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.
--
Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312
Principal Consultant www.OntoSys.com fax: +1.630.879.1370
OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
--
===================================================================
RCS file: RCS/util.py
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** util.py 1999/10/22 18:32:41 1.1
--- util.py 1999/10/22 19:35:03 1.2
***************
*** 37,50 ****
# the creation of the whole path? (quite easy to do the latter since
# we're not using a recursive algorithm)
if os.path.isdir (name):
return
if PATH_CREATED.get (name):
return
(head, tail) = os.path.split (name)
- if not tail: # in case 'name' has trailing slash
- (head, tail) = os.path.split (head)
tails = [tail] # stack of lone dirs to create
while head and tail and not os.path.isdir (head):
--- 37,52 ----
# the creation of the whole path? (quite easy to do the latter since
# we're not using a recursive algorithm)
+ (head, tail) = os.path.split (name)
+ if not tail: # in case 'name' has trailing slash
+ name = head
+
if os.path.isdir (name):
return
if PATH_CREATED.get (name):
return
(head, tail) = os.path.split (name)
tails = [tail] # stack of lone dirs to create
while head and tail and not os.path.isdir (head):