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

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

parent 427e5ac1
......@@ -65,8 +65,8 @@ def should_skip_build(metadata_tuples):
def next_build_number(channel_url, basename):
"""Calculates the next build number of a package given the channel.
This function returns the next build number (integer) for a package given its
resulting tarball base filename (can be obtained with
This function returns the next build number (integer) for a package given
its resulting tarball base filename (can be obtained with
:py:func:`get_output_path`).
......@@ -212,7 +212,8 @@ def get_parsed_recipe(metadata):
def exists_on_channel(channel_url, basename):
"""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:
......@@ -230,10 +231,10 @@ def exists_on_channel(channel_url, basename):
# remove .tar.bz2/.conda from name, then split from the end twice, on
# '-'
if name.endswith('.tar.bz2'):
name, version, build = name[:-8].rsplit("-", 2)
elif name.endswith('.conda'):
if name.endswith('.conda'):
name, version, build = name[:-6].rsplit("-", 2)
elif name.endswith('.tar.bz2'):
name, version, build = name[:-8].rsplit("-", 2)
else:
raise RuntimeError("Package name %s does not end in either " \
".tar.bz2 or .conda" % (name,))
......@@ -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]
if self_build_number in other_build_numbers:
return "".join(
(channel_url, urls[other_build_numbers.index(self_build_number)])
)
candidate = 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):
......
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