Skip to content

Commit

Permalink
Fix rez.system is_production_rez_install to handle forward slash path…
Browse files Browse the repository at this point in the history
…s under windows. (#1899)

This allows to import rez module from paths with forward slashes. The following code printed "False" before the fix:

```
import sys
sys.path.append('C:/rez_test/Lib/site-packages')
from rez.system import system
print( 'is_production_rez_install', system.is_production_rez_install )
```

---------

Signed-off-by: Michal Fratczak <[email protected]>
Signed-off-by: Jean-Christophe Morin <[email protected]>
Co-authored-by: Jean-Christophe Morin <[email protected]>
  • Loading branch information
michalfratczak and JeanChristopheMorinPerso authored Jan 26, 2025
1 parent 6d63378 commit 233b82c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rez/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ def rez_bin_path(self):
#
import rez
module_path = rez.__path__[0]
# Best effort attempt at converting slashes to the current
# platform native slash. (for example, forward to backward).
module_path = os.path.normpath(module_path)

parts = module_path.split(os.path.sep)
parts_lower = module_path.lower().split(os.path.sep)
Expand Down

0 comments on commit 233b82c

Please sign in to comment.