Commit ec9b76d2 authored by Tarek Ziade's avatar Tarek Ziade

fixed the separator issues in packaging/resources+config

parent 94449616
...@@ -33,6 +33,9 @@ def _pop_values(values_dct, key): ...@@ -33,6 +33,9 @@ def _pop_values(values_dct, key):
def _rel_path(base, path): def _rel_path(base, path):
# normalizes and returns a lstripped-/-separated path
base = base.replace(os.path.sep, '/')
path = path.replace(os.path.sep, '/')
assert path.startswith(base) assert path.startswith(base)
return path[len(base):].lstrip('/') return path[len(base):].lstrip('/')
...@@ -50,7 +53,8 @@ def get_resources_dests(resources_root, rules): ...@@ -50,7 +53,8 @@ def get_resources_dests(resources_root, rules):
destinations.pop(resource_file, None) destinations.pop(resource_file, None)
else: else:
rel_path = _rel_path(abs_base, abs_path) rel_path = _rel_path(abs_base, abs_path)
destinations[resource_file] = os.path.join(dest, rel_path) rel_dest = dest.replace(os.path.sep, '/').rstrip('/')
destinations[resource_file] = rel_dest + '/' + rel_path
return destinations return destinations
......
...@@ -25,7 +25,6 @@ class DataFilesTestCase(GlobTestCaseBase): ...@@ -25,7 +25,6 @@ class DataFilesTestCase(GlobTestCaseBase):
files = {} files = {}
for path, value in spec.items(): for path, value in spec.items():
if value is not None: if value is not None:
path = self.os_dependent_path(path)
files[path] = value files[path] = value
return files return files
......
...@@ -939,7 +939,7 @@ class Mixin2to3: ...@@ -939,7 +939,7 @@ class Mixin2to3:
self.options, self.explicit) self.options, self.explicit)
RICH_GLOB = re.compile(r'\{([^}]*)\}') RICH_GLOB = re.compile(r'\{([^}]*)\}')
_CHECK_RECURSIVE_GLOB = re.compile(r'[^/,{]\*\*|\*\*[^/,}]') _CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]')
_CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$') _CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$')
...@@ -973,7 +973,9 @@ def _iglob(path_glob): ...@@ -973,7 +973,9 @@ def _iglob(path_glob):
if radical == '': if radical == '':
radical = '*' radical = '*'
else: else:
# we support both
radical = radical.lstrip('/') radical = radical.lstrip('/')
radical = radical.lstrip('\\')
for path, dir, files in os.walk(prefix): for path, dir, files in os.walk(prefix):
path = os.path.normpath(path) path = os.path.normpath(path)
for file in _iglob(os.path.join(path, radical)): for file in _iglob(os.path.join(path, radical)):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment