def _get_family(self, name): is_valid_package_name(name, raise_error=True) if os.path.isdir(os.path.join(self.location, name)): # force case-sensitive match on pkg family dir, on case-insensitive platforms if not platform_.has_case_sensitive_filesystem and \ name not in os.listdir(self.location): return None return self.get_resource( FileSystemPackageFamilyResource.key, location=self.location, name=name ) else: filepath, format_ = self.get_file(self.location, package_filename=name) if filepath: # force case-sensitive match on pkg filename, on case-insensitive platforms if not platform_.has_case_sensitive_filesystem: ext = os.path.splitext(filepath)[-1] if (name + ext) not in os.listdir(self.location): return None return self.get_resource( FileSystemCombinedPackageFamilyResource.key, location=self.location, name=name, ext=format_.extension ) return None
def get_package_family(self, name): is_valid_package_name(name, raise_error=True) if name in self.data: family = self.get_resource(MemoryPackageFamilyResource.key, location=self.location, name=name) return family return None
def get_package_family(self, name): is_valid_package_name(name, raise_error=True) if name in self.data: family = self.get_resource( MemoryPackageFamilyResource.key, location=self.location, name=name) return family return None
def _get_family_dirs(self): dirs = [] if not os.path.isdir(self.location): return dirs for name in os.listdir(self.location): path = os.path.join(self.location, name) if os.path.isdir(path): if is_valid_package_name(name) and name != self.file_lock_dir: dirs.append((name, None)) else: name_, ext_ = os.path.splitext(name) if ext_ in (".py", ".yaml") and is_valid_package_name(name_): dirs.append((name_, ext_[1:])) return dirs
def _get_family(self, name): is_valid_package_name(name, raise_error=True) document = self.collection.find_one({ "type": "family", "_id": name }, projection={"_id": True}) if document is not None: family = self.get_resource(MongozarkPackageFamilyResource.key, location=self.location, name=name) return family
def _get_family(self, name): is_valid_package_name(name, raise_error=True) if os.path.isdir(os.path.join(self.location, name)): family = self.get_resource(FileSystemPackageFamilyResource.key, location=self.location, name=name) return family else: filepath, format_ = self.get_file(self.location, name) if filepath: family = self.get_resource( FileSystemCombinedPackageFamilyResource.key, location=self.location, name=name, ext=format_.extension) return family return None
def _get_family(self, name): is_valid_package_name(name, raise_error=True) if os.path.isdir(os.path.join(self.location, name)): family = self.get_resource( FileSystemPackageFamilyResource.key, location=self.location, name=name) return family else: filepath, format_ = self.get_file(self.location, package_filename=name) if filepath: family = self.get_resource( FileSystemCombinedPackageFamilyResource.key, location=self.location, name=name, ext=format_.extension) return family return None
def _get_family_dirs(self): dirs = [] if not os.path.isdir(self.location): return dirs for name in os.listdir(self.location): path = os.path.join(self.location, name) if name in ("settings.yaml", self.file_lock_dir): continue # skip reserved file/dirnames if os.path.isdir(path): if is_valid_package_name(name): dirs.append((name, None)) else: name_, ext_ = os.path.splitext(name) if ext_ in (".py", ".yaml") and is_valid_package_name(name_): dirs.append((name_, ext_[1:])) return dirs