From d8dfb4c4b8d661acee263e3feb77974ced69e97d Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Wed, 31 May 2000 02:32:10 +0000 Subject: 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). --- Lib/distutils/command/install.py | 4 ++-- Lib/distutils/command/sdist.py | 10 +++++----- Lib/distutils/util.py | 12 ++++-------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index 13fa88e..7176fab 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -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 diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 6626b9e..c06860f 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -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: " + diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 6063aa6..5754638 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -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): -- cgit v0.12