Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8dfb4c

Browse files
committed
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).
1 parent 65bc20c commit d8dfb4c

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

Lib/distutils/command/install.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from types import *
1111
from distutils.core import Command, DEBUG
1212
from distutils import sysconfig
13-
from distutils.util import write_file, native_path, subst_vars, change_root
13+
from distutils.util import write_file, convert_path, subst_vars, change_root
1414
from distutils.errors import DistutilsOptionError
1515
from glob import glob
1616

@@ -423,7 +423,7 @@ def handle_extra_path (self):
423423

424424
# convert to local form in case Unix notation used (as it
425425
# should be in setup scripts)
426-
extra_dirs = native_path (extra_dirs)
426+
extra_dirs = convert_path (extra_dirs)
427427

428428
else:
429429
path_file = None

Lib/distutils/command/sdist.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from types import *
1212
from glob import glob
1313
from distutils.core import Command
14-
from distutils.util import newer, create_tree, remove_tree, native_path, \
14+
from distutils.util import newer, create_tree, remove_tree, convert_path, \
1515
write_file
1616
from distutils.archive_util import check_archive_formats
1717
from distutils.text_file import TextFile
@@ -322,7 +322,7 @@ def read_template (self):
322322
action)
323323
continue
324324

325-
pattern_list = map(native_path, words[1:])
325+
pattern_list = map(convert_path, words[1:])
326326

327327
elif action in ('recursive-include','recursive-exclude'):
328328
if len (words) < 3:
@@ -332,8 +332,8 @@ def read_template (self):
332332
action)
333333
continue
334334

335-
dir = native_path(words[1])
336-
pattern_list = map (native_path, words[2:])
335+
dir = convert_path(words[1])
336+
pattern_list = map (convert_path, words[2:])
337337

338338
elif action in ('graft','prune'):
339339
if len (words) != 2:
@@ -343,7 +343,7 @@ def read_template (self):
343343
action)
344344
continue
345345

346-
dir_pattern = native_path (words[1])
346+
dir_pattern = convert_path (words[1])
347347

348348
else:
349349
template.warn ("invalid manifest template line: " +

Lib/distutils/util.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_platform ():
5858
# get_platform()
5959

6060

61-
def native_path (pathname):
61+
def convert_path (pathname):
6262
"""Return 'pathname' as a name that will work on the native
6363
filesystem, i.e. split it on '/' and put it back together again
6464
using the current directory separator. Needed because filenames in
@@ -73,16 +73,12 @@ def native_path (pathname):
7373
if pathname[-1] == '/':
7474
raise ValueError, "path '%s' cannot end with '/'" % pathname
7575
if os.sep != '/':
76-
if os.sep in pathname:
77-
raise ValueError, \
78-
"path '%s' cannot contain '%c' character" % (pathname, os.sep)
79-
else:
80-
paths = string.split (pathname, '/')
81-
return apply (os.path.join, paths)
76+
paths = string.split (pathname, '/')
77+
return apply (os.path.join, paths)
8278
else:
8379
return pathname
8480

85-
# native_path ()
81+
# convert_path ()
8682

8783

8884
def change_root (new_root, pathname):

0 commit comments

Comments
 (0)