Ejemplo n.º 1
0
 def from_file(self, path):
     # Moving the file around
     file_name = '.'.join(split_name(os.path.basename(path))[:2])
     destination = self.ensure_path(os.path.join(self.base_path, file_name))
     shutil.copy(path, destination)
     self.index(destination)
     return destination
Ejemplo n.º 2
0
 def from_file(self, path):
     # Moving the file around
     file_name = '.'.join(split_name(os.path.basename(path))[:2])
     destination = self.ensure_path(os.path.join(self.base_path, file_name))
     shutil.copy(path, destination)
     self.index(destination)
     return destination
Ejemplo n.º 3
0
 def from_data(self, path, data):
     # Build the name of the package based on its spec and extension
     file_name = '.'.join(split_name(os.path.basename(path))[:2])
     destination = self.ensure_path(os.path.join(self.base_path, file_name))
     with open(destination, 'wb') as fobj:
         fobj.write(data)
     self.index(destination)
     return destination
Ejemplo n.º 4
0
 def from_data(self, path, data):
     # Build the name of the package based on its spec and extension
     file_name = '.'.join(split_name(os.path.basename(path))[:2])
     destination = self.ensure_path(os.path.join(self.base_path, file_name))
     with open(destination, 'wb') as fobj:
         fobj.write(data)
     self.index(destination)
     return destination
Ejemplo n.º 5
0
def match_format(format_, name):
    ext = split_name(name)[1]
    if format_.startswith('~'):
        return format_[1:] != ext
    return format_ == ext
Ejemplo n.º 6
0
def match_format(format_, name):
    ext = split_name(name)[1]
    if format_.startswith('~'):
        return format_[1:] != ext
    return format_ == ext