[Distutils] Proposed bdist_dumb fix

Steven Knight knight@baldmt.com
Thu Nov 21 16:08:52 2002


> 't[0:1] == os.sep' is not a valid test for an absolute pathname,
> those contain drive letters on Windows.
> This will work, and should also work on other platforms if I understand
> the docs for splitdrive() correctly.
> 
>             else:
>                 # install_base usually is a full path; we need to
>                 # make it a relative path so it can be the second argument
>                 # to os.path.join().
>                 t = install.install_base
>                 # on systems where a drive letter is used, split it off
>                 _, t = os.path.splitdrive(t)
>                 if t[0:1] == os.sep:
>                     t = t[1:]
>                 archive_root = os.path.join(self.bdist_dir, t)

This still isn't completely correct.  To really identify an absolute
pathname, you should use the os.path.isabs() function provided for that
purpose:

		_, t = os.path.splitdrive(t)
		if os.path.isabs(t):
		    t = t[1:]
                archive_root = os.path.join(self.bdist_dir, t)

Directly examining the first character loses on some systems.  Old MacOS
path names use a leading separator (:) to specify a *relative* path
name, for example.

	--SK