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)
return path[len(base):].lstrip('/')
destinations.pop(resource_file, None)
else:
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
files = {}
for path, value in spec.items():
if value is not None:
- path = self.os_dependent_path(path)
files[path] = value
return files
self.options, self.explicit)
RICH_GLOB = re.compile(r'\{([^}]*)\}')
-_CHECK_RECURSIVE_GLOB = re.compile(r'[^/,{]\*\*|\*\*[^/,}]')
+_CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]')
_CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$')
if radical == '':
radical = '*'
else:
+ # we support both
radical = radical.lstrip('/')
+ radical = radical.lstrip('\\')
for path, dir, files in os.walk(prefix):
path = os.path.normpath(path)
for file in _iglob(os.path.join(path, radical)):