Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow channel auth when checking if package is built #3133

Merged
merged 5 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import yaml

# used to get version
from .conda_interface import env_path_backup_var_exists, conda_46
from .conda_interface import env_path_backup_var_exists, conda_45, conda_46
from .conda_interface import PY3
from .conda_interface import prefix_placeholder
from .conda_interface import TemporaryDirectory
Expand All @@ -43,7 +43,6 @@
from .conda_interface import url_path
from .conda_interface import root_dir
from .conda_interface import conda_private
from .conda_interface import dist_str_in_index
from .conda_interface import MatchSpec
from .conda_interface import reset_context
from .conda_interface import context
Expand Down Expand Up @@ -2477,24 +2476,27 @@ def is_package_built(metadata, env, include_local=True):
for d in metadata.config.bldpkgs_dirs:
if not os.path.isdir(d):
os.makedirs(d)
update_index(d, verbose=metadata.config.verbose)
update_index(d, verbose=metadata.config.verbose)
subdir = getattr(metadata.config, '{}_subdir'.format(env))
index, index_ts = get_build_index(subdir=subdir,
bldpkgs_dir=metadata.config.bldpkgs_dir,
output_folder=metadata.config.output_folder,
channel_urls=metadata.config.channel_urls,
debug=metadata.config.debug,
verbose=metadata.config.verbose,
locking=metadata.config.locking,
timeout=metadata.config.timeout,
clear_cache=True)

urls = [url_path(metadata.config.output_folder), 'local'] if include_local else []
urls += get_rc_urls()
if metadata.config.channel_urls:
urls.extend(metadata.config.channel_urls)

# will be empty if none found, and evalute to False
found_urls = [url for url in urls
if dist_str_in_index(index, url + '::' + metadata.dist())]
return found_urls[0] if found_urls else None
spec = MatchSpec(name=metadata.name(), version=metadata.version(), build=metadata.build_id())

if conda_45:
from conda.api import SubdirData
return bool(SubdirData.query_all(spec, channels=urls, subdirs=(subdir, "noarch")))
else:
index, index_ts = get_build_index(subdir=subdir,
bldpkgs_dir=metadata.config.bldpkgs_dir,
output_folder=metadata.config.output_folder,
channel_urls=urls,
debug=metadata.config.debug,
verbose=metadata.config.verbose,
locking=metadata.config.locking,
timeout=metadata.config.timeout,
clear_cache=True)
return any(spec.match(prec) for prec in index.values())
3 changes: 1 addition & 2 deletions conda_build/conda_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def try_exports(module, attr):

conda_43 = parse_version(CONDA_VERSION) >= parse_version("4.3.0a0")
conda_44 = parse_version(CONDA_VERSION) >= parse_version("4.4.0a0")
conda_45 = parse_version(CONDA_VERSION) >= parse_version("4.5.0a0")
conda_46 = parse_version(CONDA_VERSION) >= parse_version("4.6.0a0")

if conda_44:
Expand Down Expand Up @@ -61,7 +62,6 @@ def try_exports(module, attr):
from conda.exports import (PY3, StringIO, input, iteritems, lchmod, string_types, # NOQA
text_type, TemporaryDirectory) # NOQA
from conda.exports import VersionOrder # NOQA
from conda.exports import dist_str_in_index # NOQA


TmpDownload = TmpDownload
Expand All @@ -77,7 +77,6 @@ def try_exports(module, attr):
PY3, input, iteritems, lchmod, string_types = PY3, input, iteritems, lchmod, string_types
text_type, TemporaryDirectory = text_type, TemporaryDirectory
ArgumentParser, CondaSession, VersionOrder = ArgumentParser, CondaSession, VersionOrder
dist_str_in_index = dist_str_in_index


from conda.core.package_cache import ProgressiveFetchExtract # NOQA
Expand Down