def read_recipe_name_version_build(meta_yaml_path): """ Read the given metadata file and return (package_name, version, build_number) meta_yaml_path: May be a path to a meta.yaml file or it's parent recipe directory. """ # Provide these default values, otherwise conda-build will # choke on jinja templates that reference them. # This will be fixed when they finally merge conda-build PR#662 and PR#666 if "CONDA_NPY" not in os.environ: os.environ["CONDA_NPY"] = '19' if "CONDA_PY" not in os.environ: os.environ["CONDA_PY"] = '27' os.environ["GIT_FULL_HASH"] = "9999999" if os.path.isdir(meta_yaml_path): recipe_dir = meta_yaml_path else: recipe_dir = os.path.split(meta_yaml_path)[0] try: metadata = MetaData(recipe_dir) return (metadata.name(), metadata.version(), metadata.build_number()) except SystemExit as ex: raise Exception(*ex.args)
def have_noarch_python_build_number(meta: MetaData) -> bool: """Checks if we have a noarch:python build with same version+build_number Args: meta: Variant MetaData object Returns: True if noarch:python and version+build_number exists already in repodata """ if meta.get_value('build/noarch') != 'python': return False res = RepoData().get_package_data( name=meta.name(), version=meta.version(), build_number=meta.build_number(), platform=['noarch'], ) if res: logger.debug("Package %s=%s[build_number=%s, subdir=noarch] exists", meta.name(), meta.version(), meta.build_number()) return res
def will_build_variant(meta: MetaData) -> bool: """Check if the recipe variant will be built as currently rendered Args: meta: Variant MetaData object Returns: True if all extant build numbers are smaller than the one indicated by the variant MetaData. """ build_numbers = RepoData().get_package_data( 'build_number', name=meta.name(), version=meta.version(), platform=['linux', 'noarch'], ) current_num = int(meta.build_number()) res = all(num < current_num for num in build_numbers) if res: logger.debug("Package %s=%s will be built already because %s < %s)", meta.name(), meta.version(), max(build_numbers) if build_numbers else "N/A", meta.build_number()) return res