From a7656170d75f76dbc46d1c0d1ba782c933eda2b3 Mon Sep 17 00:00:00 2001 From: OlivierArgentieri Date: Sat, 30 Sep 2023 17:51:53 -0400 Subject: [PATCH] add use_canonical_path setting Signed-off-by: OlivierArgentieri --- src/rez/config.py | 1 + src/rez/rezconfig.py | 4 ++++ src/rezplugins/package_repository/filesystem.py | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/rez/config.py b/src/rez/config.py index 4309e2036..0f7e4587b 100644 --- a/src/rez/config.py +++ b/src/rez/config.py @@ -400,6 +400,7 @@ def _parse_env_var(self, value): "alias_back": OptionalStr, "package_preprocess_function": OptionalStrOrFunction, "package_preprocess_mode": PreprocessMode_, + "use_canonical_path": OptionalBool, "context_tracking_host": OptionalStr, "variant_shortlinks_dirname": OptionalStr, "build_thread_count": BuildThreadCount_, diff --git a/src/rez/rezconfig.py b/src/rez/rezconfig.py index 81f7347f1..41b677ea2 100644 --- a/src/rez/rezconfig.py +++ b/src/rez/rezconfig.py @@ -657,6 +657,10 @@ # - "override": Package's preprocess function completely overrides the global preprocess. package_preprocess_mode = "override" +# Defines if we want to use canonical path in our context resolution +# This is useful when you want to have a consistent path for your context +# and avoid resolution of mapped drive on Windows. +use_canonical_path = True ############################################################################### # Context Tracking diff --git a/src/rezplugins/package_repository/filesystem.py b/src/rezplugins/package_repository/filesystem.py index 9652f1e24..8ddaf83ac 100644 --- a/src/rezplugins/package_repository/filesystem.py +++ b/src/rezplugins/package_repository/filesystem.py @@ -495,9 +495,10 @@ def __init__(self, location, resource_pool, disable_memcache=None, disable_pkg_ignore (bool): If True, .ignore* files have no effect """ - # ensure that differing case doesn't get interpreted as different repos - # on case-insensitive platforms (eg windows) - location = canonical_path(location, platform_) + if config.use_canonical_path: + # ensure that differing case doesn't get interpreted as different repos + # on case-insensitive platforms (eg windows) + location = canonical_path(location, platform_) super(FileSystemPackageRepository, self).__init__(location, resource_pool)