[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59241] trunk/blender/release/scripts/ modules: More "relpath" try/except protection...
Bastien Montagne
montagne29 at wanadoo.fr
Sun Aug 18 17:17:33 CEST 2013
Revision: 59241
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59241
Author: mont29
Date: 2013-08-18 15:17:33 +0000 (Sun, 18 Aug 2013)
Log Message:
-----------
More "relpath" try/except protection...
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py
trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
Modified: trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
===================================================================
--- trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py 2013-08-18 15:14:55 UTC (rev 59240)
+++ trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py 2013-08-18 15:17:33 UTC (rev 59241)
@@ -410,9 +410,15 @@
def make_rel(path):
for rp in root_paths:
if path.startswith(rp):
- return os.path.relpath(path, rp)
+ try: # can't always find the relative path (between drive letters on windows)
+ return os.path.relpath(path, rp)
+ except ValueError:
+ return path
# Use binary's dir as fallback...
- return os.path.relpath(path, os.path.dirname(bpy.app.binary_path))
+ try: # can't always find the relative path (between drive letters on windows)
+ return os.path.relpath(path, os.path.dirname(bpy.app.binary_path))
+ except ValueError:
+ return path
# Helper function
def extract_strings_ex(node, is_split=False):
@@ -768,7 +774,10 @@
if os.path.splitext(fname)[1] not in settings.PYGETTEXT_ALLOWED_EXTS:
continue
path = os.path.join(root, fname)
- rel_path = os.path.relpath(path, settings.SOURCE_DIR)
+ try: # can't always find the relative path (between drive letters on windows)
+ rel_path = os.path.relpath(path, settings.SOURCE_DIR)
+ except ValueError:
+ rel_path = path
if rel_path in forbidden:
continue
elif rel_path not in forced:
Modified: trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py
===================================================================
--- trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py 2013-08-18 15:14:55 UTC (rev 59240)
+++ trunk/blender/release/scripts/modules/bl_i18n_utils/settings.py 2013-08-18 15:17:33 UTC (rev 59241)
@@ -467,9 +467,12 @@
path = os.path.normpath(path)
# If given path is absolute, make it relative to current ref one (else we consider it is already the case!)
if os.path.isabs(path):
- return os.path.relpath(path, ref)
- else:
- return path
+ # can't always find the relative path (between drive letters on windows)
+ try:
+ return os.path.relpath(path, ref)
+ except ValueError:
+ pass
+ return path
def _gen_get_set_path(ref, name):
def _get(self):
Modified: trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/io_utils.py 2013-08-18 15:14:55 UTC (rev 59240)
+++ trunk/blender/release/scripts/modules/bpy_extras/io_utils.py 2013-08-18 15:17:33 UTC (rev 59241)
@@ -409,7 +409,10 @@
if mode == 'ABSOLUTE':
return filepath_abs
elif mode == 'RELATIVE':
- return os.path.relpath(filepath_abs, base_dst)
+ try: # can't always find the relative path (between drive letters on windows)
+ return os.path.relpath(filepath_abs, base_dst)
+ except ValueError:
+ return filepath_abs
elif mode == 'STRIP':
return os.path.basename(filepath_abs)
More information about the Bf-blender-cvs
mailing list