From e02b91145019e33e9e36e7116e6830ff41465079 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 3 Mar 2010 15:07:56 +0100 Subject: [PATCH] Replace os.path.sep.join(seq) with utils.PathJoin This is a no-op change, but at least we concentrate the calls to path joins into a single function. A use in utils.FindFile is left as-is (don't want to raise exceptions there, at least for now). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/backend.py | 6 +++--- lib/utils.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index 026432bdc..60182102f 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1682,7 +1682,7 @@ def _OSOndiskAPIVersion(os_dir): data holding either the vaid versions or an error message """ - api_file = os.path.sep.join([os_dir, constants.OS_API_FILE]) + api_file = utils.PathJoin(os_dir, constants.OS_API_FILE) try: st = os.stat(api_file) @@ -1738,7 +1738,7 @@ def DiagnoseOS(top_dirs=None): logging.exception("Can't list the OS directory %s: %s", dir_name, err) break for name in f_names: - os_path = os.path.sep.join([dir_name, name]) + os_path = utils.PathJoin(dir_name, name) status, os_inst = _TryOSFromDisk(name, base_dir=dir_name) if status: diagnose = "" @@ -1789,7 +1789,7 @@ def _TryOSFromDisk(name, base_dir=None): os_files[constants.OS_VARIANTS_FILE] = '' for filename in os_files: - os_files[filename] = os.path.sep.join([os_dir, filename]) + os_files[filename] = utils.PathJoin(os_dir, filename) try: st = os.stat(os_files[filename]) diff --git a/lib/utils.py b/lib/utils.py index dbd1520f9..efd736ad0 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -1748,6 +1748,7 @@ def FindFile(name, search_path, test=os.path.exists): return None for dir_name in search_path: + # FIXME: investigate switch to PathJoin item_name = os.path.sep.join([dir_name, name]) # check the user test and that we're indeed resolving to the given # basename -- GitLab