Commit e5c94fc0 by Timothée Peignier

avoid inserting path already present more efficiently

parent ead5bad7
...@@ -76,14 +76,16 @@ class Packager(object): ...@@ -76,14 +76,16 @@ class Packager(object):
return packages return packages
for name in config: for name in config:
packages[name] = {} packages[name] = {}
paths = []
if 'external_urls' in config[name]: if 'external_urls' in config[name]:
packages[name]['externals'] = config[name]['external_urls'] packages[name]['externals'] = config[name]['external_urls']
continue continue
paths = []
for path in config[name]['source_filenames']: for path in config[name]['source_filenames']:
full_path = os.path.join(settings.COMPRESS_ROOT, path) full_path = os.path.join(settings.COMPRESS_ROOT, path)
paths.extend([os.path.normpath(path).replace(settings.COMPRESS_ROOT, '') for path in glob.glob(full_path):
for path in glob.glob(full_path) if not path in paths]) path = os.path.normpath(path).replace(settings.COMPRESS_ROOT, '')
if not path in paths:
paths.append(path)
packages[name]['paths'] = paths packages[name]['paths'] = paths
packages[name]['output'] = config[name]['output_filename'] packages[name]['output'] = config[name]['output_filename']
packages[name]['context'] = {} packages[name]['context'] = {}
......
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