Renamed 'native_path()' to 'convert_path()'.
Also changed it so it doesn't barf if the path is already in native format (ie. contains os.sep).
This commit is contained in:
parent
65bc20c23e
commit
d8dfb4c4b8
|
@ -10,7 +10,7 @@ import sys, os, string
|
|||
from types import *
|
||||
from distutils.core import Command, DEBUG
|
||||
from distutils import sysconfig
|
||||
from distutils.util import write_file, native_path, subst_vars, change_root
|
||||
from distutils.util import write_file, convert_path, subst_vars, change_root
|
||||
from distutils.errors import DistutilsOptionError
|
||||
from glob import glob
|
||||
|
||||
|
@ -423,7 +423,7 @@ class install (Command):
|
|||
|
||||
# convert to local form in case Unix notation used (as it
|
||||
# should be in setup scripts)
|
||||
extra_dirs = native_path (extra_dirs)
|
||||
extra_dirs = convert_path (extra_dirs)
|
||||
|
||||
else:
|
||||
path_file = None
|
||||
|
|
|
@ -11,7 +11,7 @@ import fnmatch
|
|||
from types import *
|
||||
from glob import glob
|
||||
from distutils.core import Command
|
||||
from distutils.util import newer, create_tree, remove_tree, native_path, \
|
||||
from distutils.util import newer, create_tree, remove_tree, convert_path, \
|
||||
write_file
|
||||
from distutils.archive_util import check_archive_formats
|
||||
from distutils.text_file import TextFile
|
||||
|
@ -322,7 +322,7 @@ class sdist (Command):
|
|||
action)
|
||||
continue
|
||||
|
||||
pattern_list = map(native_path, words[1:])
|
||||
pattern_list = map(convert_path, words[1:])
|
||||
|
||||
elif action in ('recursive-include','recursive-exclude'):
|
||||
if len (words) < 3:
|
||||
|
@ -332,8 +332,8 @@ class sdist (Command):
|
|||
action)
|
||||
continue
|
||||
|
||||
dir = native_path(words[1])
|
||||
pattern_list = map (native_path, words[2:])
|
||||
dir = convert_path(words[1])
|
||||
pattern_list = map (convert_path, words[2:])
|
||||
|
||||
elif action in ('graft','prune'):
|
||||
if len (words) != 2:
|
||||
|
@ -343,7 +343,7 @@ class sdist (Command):
|
|||
action)
|
||||
continue
|
||||
|
||||
dir_pattern = native_path (words[1])
|
||||
dir_pattern = convert_path (words[1])
|
||||
|
||||
else:
|
||||
template.warn ("invalid manifest template line: " +
|
||||
|
|
|
@ -58,7 +58,7 @@ def get_platform ():
|
|||
# get_platform()
|
||||
|
||||
|
||||
def native_path (pathname):
|
||||
def convert_path (pathname):
|
||||
"""Return 'pathname' as a name that will work on the native
|
||||
filesystem, i.e. split it on '/' and put it back together again
|
||||
using the current directory separator. Needed because filenames in
|
||||
|
@ -73,16 +73,12 @@ def native_path (pathname):
|
|||
if pathname[-1] == '/':
|
||||
raise ValueError, "path '%s' cannot end with '/'" % pathname
|
||||
if os.sep != '/':
|
||||
if os.sep in pathname:
|
||||
raise ValueError, \
|
||||
"path '%s' cannot contain '%c' character" % (pathname, os.sep)
|
||||
else:
|
||||
paths = string.split (pathname, '/')
|
||||
return apply (os.path.join, paths)
|
||||
paths = string.split (pathname, '/')
|
||||
return apply (os.path.join, paths)
|
||||
else:
|
||||
return pathname
|
||||
|
||||
# native_path ()
|
||||
# convert_path ()
|
||||
|
||||
|
||||
def change_root (new_root, pathname):
|
||||
|
|
Loading…
Reference in New Issue