def get_package(self): """Create the analogous package. Returns: `Package` object. """ # get and validate package data package_data = self._get_data() package_data = package_schema.validate(package_data) # check compatibility with rez version if "requires_rez_version" in package_data: ver = package_data.pop("requires_rez_version") if _rez_Version < ver: raise PackageMetadataError( "Failed reading package definition file: rez version >= %s " "needed (current version is %s)" % (ver, _rez_Version)) # create a 'memory' package repository containing just this package version_str = package_data.get("version") or "_NO_VERSION" repo_data = {self.name: {version_str: package_data}} repo = create_memory_package_repository(repo_data) # retrieve the package from the new repository family_resource = repo.get_package_family(self.name) it = repo.iter_packages(family_resource) package_resource = it.next() package = self.package_cls(package_resource) # revalidate the package for extra measure package.validate_data() return package
def get_package(self): """Create the analogous package. Returns: `Package` object. """ # get and validate package data package_data = self._get_data() package_data = package_schema.validate(package_data) # create a 'memory' package repository containing just this package version_str = package_data.get("version") or "_NO_VERSION" repo_data = {self.name: {version_str: package_data}} repo = create_memory_package_repository(repo_data) # retrieve the package from the new repository family_resource = repo.get_package_family(self.name) it = repo.iter_packages(family_resource) package_resource = it.next() package = self.package_cls(package_resource) # revalidate the package for extra measure package.validate_data() return package
def get_package(self): """Create the analogous package. Returns: `Package` object. """ # get and validate package data package_data = self._get_data() package_data = package_schema.validate(package_data) # create a 'memory' package repository containing just this package version_str = package_data.get("version") or "_NO_VERSION" repo_data = {self.name: {version_str: package_data}} repo = create_memory_package_repository(repo_data) # retrieve the package from the new repository family_resource = repo.get_package_family(self.name) it = repo.iter_packages(family_resource) package_resource = it.next() package = Package(package_resource) # revalidate the package for extra measure package.validate_data() return package