Commit 6a5b791d authored by André Anjos's avatar André Anjos 💬
Browse files

[build] exists_on_channel() now checks for a matching package type

parent 427e5ac1
...@@ -65,8 +65,8 @@ def should_skip_build(metadata_tuples): ...@@ -65,8 +65,8 @@ def should_skip_build(metadata_tuples):
def next_build_number(channel_url, basename): def next_build_number(channel_url, basename):
"""Calculates the next build number of a package given the channel. """Calculates the next build number of a package given the channel.
This function returns the next build number (integer) for a package given its This function returns the next build number (integer) for a package given
resulting tarball base filename (can be obtained with its resulting tarball base filename (can be obtained with
:py:func:`get_output_path`). :py:func:`get_output_path`).
...@@ -212,7 +212,8 @@ def get_parsed_recipe(metadata): ...@@ -212,7 +212,8 @@ def get_parsed_recipe(metadata):
def exists_on_channel(channel_url, basename): def exists_on_channel(channel_url, basename):
"""Checks on the given channel if a package with the specs exist. """Checks on the given channel if a package with the specs exist.
This procedure always ignores the package hash code, if one is set This procedure always ignores the package hash code, if one is set. It
differentiates between `.conda` and `.tar.bz2` packages.
Args: Args:
...@@ -230,10 +231,10 @@ def exists_on_channel(channel_url, basename): ...@@ -230,10 +231,10 @@ def exists_on_channel(channel_url, basename):
# remove .tar.bz2/.conda from name, then split from the end twice, on # remove .tar.bz2/.conda from name, then split from the end twice, on
# '-' # '-'
if name.endswith('.tar.bz2'): if name.endswith('.conda'):
name, version, build = name[:-8].rsplit("-", 2)
elif name.endswith('.conda'):
name, version, build = name[:-6].rsplit("-", 2) name, version, build = name[:-6].rsplit("-", 2)
elif name.endswith('.tar.bz2'):
name, version, build = name[:-8].rsplit("-", 2)
else: else:
raise RuntimeError("Package name %s does not end in either " \ raise RuntimeError("Package name %s does not end in either " \
".tar.bz2 or .conda" % (name,)) ".tar.bz2 or .conda" % (name,))
...@@ -252,9 +253,10 @@ def exists_on_channel(channel_url, basename): ...@@ -252,9 +253,10 @@ def exists_on_channel(channel_url, basename):
other_build_numbers = [_get_build_number(os.path.basename(k)) for k in urls] other_build_numbers = [_get_build_number(os.path.basename(k)) for k in urls]
if self_build_number in other_build_numbers: if self_build_number in other_build_numbers:
return "".join( candidate = urls[other_build_numbers.index(self_build_number)]
(channel_url, urls[other_build_numbers.index(self_build_number)]) pkg_type = '.conda' if basename.endswidth('.conda') else '.tar.bz2'
) if candidate.endswith(pkg_type): #match
return "".join(channel_url, candidate)
def remove_pins(deps): def remove_pins(deps):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment