Esempio n. 1
0
 def process_globs(self, patterns):
     """Expands the globs into full file paths, and returns a list of the
        results (the results will be in the original, relative form)."""
     
     def _process_glob(p):
         if '*' in p or '?' in p or '[' in p or ']' in p:
             return glob.glob(os.path.join(self.root_path, p))
         else:
             return p
     
     results = flattened([_process_glob(p) for p in flattened(patterns)])
     return [p.split(self.root_path)[-1] for p in results]
Esempio n. 2
0
 def get_file_list(self, *keys):
     compiled = []
     
     for key in keys:
         value = self.spec[key]
         compiled.append(self.process_patterns(*value))
         compiled.append(key)
     
     compiled = uniquified(flattened(compiled))
     commit = settings.VCS_COMMIT_IDENTIFIER
     return [u'%s/c-%s-%s.%s' % (self.extension, p, commit, self.extension) for p in compiled]
Esempio n. 3
0
 def process_pattern(self, pattern):
     compiled = []
     
     if pattern.startswith('include:'):
         pattern = pattern[8:]
         if pattern not in self.keys_processed:
             self.keys_processed.append(pattern)
             compiled.append([self.process_pattern(s) for s in self.spec[pattern]])
             compiled.append(pattern)
     
     return flattened(compiled)
Esempio n. 4
0
 def process_pattern(self, pattern):
     compiled = []
     
     if pattern.startswith('include:'):
         pattern = pattern[8:]
         # Avoid cyclic dependencies, doing nothing if they exist
         if pattern not in self.keys_processed:
             self.keys_processed.append(pattern)
             compiled.append([self.process_pattern(s) for s in self.spec[pattern]])
     else:
         # Not a dependency
         compiled.append(pattern)
     
     return flattened(compiled)
Esempio n. 5
0
 def get_file_list(self, *keys):
     patterns = flattened([self.spec[key] for key in keys])
     compiled = self.process_patterns(*patterns)
     return uniquified(self.process_globs(compiled))
Esempio n. 6
0
 def process_patterns(self, *patterns):
     """Processes all of the specified patterns using process_pattern."""
     return uniquified(flattened([self.process_pattern(s) for s in patterns]))