def check_package_version(self): """Check the package version in meta.yaml for proper formatting.""" package_version = self.meta.get("package", {}).get("version", "") if package_version == "": return Error(self.recipe_dir, "C2104", "Missing package version in meta.yaml") if isinstance(package_version, str): if (not self.version_pat.match(package_version) or package_version.startswith( ("_", ".")) or package_version.endswith(("_", "."))): return Error( self.recipe_dir, "C2105", u'Found invalid package version "{}" in meta.yaml'.format( package_version), ) seq = get_bad_seq(package_version) if seq: return Error( self.recipe_dir, "C2106", u'Found invalid sequence "{}" in package version'.format( seq), )
def check_package_version(self): """Check the package version located in info/index.json.""" package_version = str(self.info.get("version")) if package_version == "None": return Error( self.path, "C1104", "Missing package version in info/index.json" ) if package_version.startswith(("_", ".")) or package_version.endswith( ("_", ".") ): return Error( self.path, "C1107", "Package version in info/index.json cannot start or end with '_' or '.'", ) if not self.version_pat.match(package_version) or get_bad_seq(package_version): return Error( self.path, "C1105", "Found invalid version number in info/index.json" ) if package_version != self.version: return Error( self.path, "C1106", u'Found package version in info/index.json "{}" does not match filename version "{}"'.format( package_version, self.version ), )
def check_package_version(self): """Check the package version located in info/index.json.""" package_version = str(self.info.get('version')) if not package_version: return Error(self.path, 'C1104', 'Missing package version in info/index.json') if not self.version_pat.match(package_version) or get_bad_seq(package_version): return Error(self.path, 'C1105', 'Found invalid version number in info/index.json') if package_version != self.version: return Error(self.path, 'C1106', u'Found package version in info/index.json "{}" does not match filename version "{}"' .format(package_version, self.version)) if package_version.startswith(('_', '.')) or package_version.endswith(('_', '.')): return Error(self.path, 'C1107', "Package version in info/index.json cannot start or end with '_' or '.'")
def retrieve_package_name(path): """Retrieve the package name from the conda package path.""" path = os.path.basename(path) seq = get_bad_seq(path) if seq: raise PackageError(u'Found invalid sequence "{}" in package in info/index.json' .format(seq)) if path.endswith('.tar.bz2'): return path[:-8] elif path.endswith('.tar'): return path[:-4] else: raise PackageError('Found package with invalid extension "{}"' .format(os.path.splitext(path)[1]))
def check_package_name(self): """Check the package name in meta.yaml for proper formatting.""" package_name = self.meta.get('package', {}).get('name', '') if package_name == '': return Error(self.recipe_dir, 'C2101', 'Missing package name in meta.yaml') if not self.name_pat.match(package_name) or package_name.endswith(('.', '-', '_')): return Error(self.recipe_dir, 'C2102', u'Found invalid package name "{}" in meta.yaml' .format(package_name)) seq = get_bad_seq(package_name) if seq: return Error(self.recipe_dir, 'C2103', u'Found invalid sequence "{}" in package name' .format(seq))
def check_package_version(self): """Check the package version in meta.yaml for proper formatting.""" package_version = self.meta.get('package', {}).get('version', '') if package_version == '': return Error(self.recipe_dir, 'C2104', 'Missing package version in meta.yaml') if isinstance(package_version, str): if not self.version_pat.match(package_version) or package_version.startswith(('_', '.')) or package_version.endswith(('_', '.')): return Error(self.recipe_dir, 'C2105', u'Found invalid package version "{}" in meta.yaml' .format(package_version)) seq = get_bad_seq(package_version) if seq: return Error(self.recipe_dir, 'C2106', u'Found invalid sequence "{}" in package version' .format(seq))
def check_package_name(self): """Check the package name in meta.yaml for proper formatting.""" package_name = self.meta.get("package", {}).get("name", "") if package_name == "": return Error(self.recipe_dir, "C2101", "Missing package name in meta.yaml") if not self.name_pat.match(package_name) or package_name.endswith( (".", "-", "_") ): return Error( self.recipe_dir, "C2102", u'Found invalid package name "{}" in meta.yaml'.format(package_name), ) seq = get_bad_seq(package_name) if seq: return Error( self.recipe_dir, "C2103", u'Found invalid sequence "{}" in package name'.format(seq), )