Kaydet (Commit) d8dfb4c4 authored tarafından Greg Ward's avatar Greg Ward

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).
üst 65bc20c2
...@@ -10,7 +10,7 @@ import sys, os, string ...@@ -10,7 +10,7 @@ import sys, os, string
from types import * from types import *
from distutils.core import Command, DEBUG from distutils.core import Command, DEBUG
from distutils import sysconfig 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 distutils.errors import DistutilsOptionError
from glob import glob from glob import glob
...@@ -423,7 +423,7 @@ class install (Command): ...@@ -423,7 +423,7 @@ class install (Command):
# convert to local form in case Unix notation used (as it # convert to local form in case Unix notation used (as it
# should be in setup scripts) # should be in setup scripts)
extra_dirs = native_path (extra_dirs) extra_dirs = convert_path (extra_dirs)
else: else:
path_file = None path_file = None
......
...@@ -11,7 +11,7 @@ import fnmatch ...@@ -11,7 +11,7 @@ import fnmatch
from types import * from types import *
from glob import glob from glob import glob
from distutils.core import Command 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 write_file
from distutils.archive_util import check_archive_formats from distutils.archive_util import check_archive_formats
from distutils.text_file import TextFile from distutils.text_file import TextFile
...@@ -322,7 +322,7 @@ class sdist (Command): ...@@ -322,7 +322,7 @@ class sdist (Command):
action) action)
continue continue
pattern_list = map(native_path, words[1:]) pattern_list = map(convert_path, words[1:])
elif action in ('recursive-include','recursive-exclude'): elif action in ('recursive-include','recursive-exclude'):
if len (words) < 3: if len (words) < 3:
...@@ -332,8 +332,8 @@ class sdist (Command): ...@@ -332,8 +332,8 @@ class sdist (Command):
action) action)
continue continue
dir = native_path(words[1]) dir = convert_path(words[1])
pattern_list = map (native_path, words[2:]) pattern_list = map (convert_path, words[2:])
elif action in ('graft','prune'): elif action in ('graft','prune'):
if len (words) != 2: if len (words) != 2:
...@@ -343,7 +343,7 @@ class sdist (Command): ...@@ -343,7 +343,7 @@ class sdist (Command):
action) action)
continue continue
dir_pattern = native_path (words[1]) dir_pattern = convert_path (words[1])
else: else:
template.warn ("invalid manifest template line: " + template.warn ("invalid manifest template line: " +
......
...@@ -58,7 +58,7 @@ def get_platform (): ...@@ -58,7 +58,7 @@ def get_platform ():
# get_platform() # get_platform()
def native_path (pathname): def convert_path (pathname):
"""Return 'pathname' as a name that will work on the native """Return 'pathname' as a name that will work on the native
filesystem, i.e. split it on '/' and put it back together again filesystem, i.e. split it on '/' and put it back together again
using the current directory separator. Needed because filenames in using the current directory separator. Needed because filenames in
...@@ -73,16 +73,12 @@ def native_path (pathname): ...@@ -73,16 +73,12 @@ def native_path (pathname):
if pathname[-1] == '/': if pathname[-1] == '/':
raise ValueError, "path '%s' cannot end with '/'" % pathname raise ValueError, "path '%s' cannot end with '/'" % pathname
if os.sep != '/': if os.sep != '/':
if os.sep in pathname: paths = string.split (pathname, '/')
raise ValueError, \ return apply (os.path.join, paths)
"path '%s' cannot contain '%c' character" % (pathname, os.sep)
else:
paths = string.split (pathname, '/')
return apply (os.path.join, paths)
else: else:
return pathname return pathname
# native_path () # convert_path ()
def change_root (new_root, pathname): def change_root (new_root, pathname):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment