From 3ba679f0e51a9828ca627866d9324696c812ec9d Mon Sep 17 00:00:00 2001 From: Amir MOHAMMADI <amir.mohammadi@idiap.ch> Date: Wed, 20 Oct 2021 11:37:15 +0200 Subject: [PATCH] Do not mix stable and beta channels since we have moved to conda-forge, we do not need the stable channel when building beta packages. Also, this marks the final change required to conda-forge migration Fixes #72 --- bob/devtools/bootstrap.py | 31 +++++++------- bob/devtools/test_bootstrap.py | 76 ++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 bob/devtools/test_bootstrap.py diff --git a/bob/devtools/bootstrap.py b/bob/devtools/bootstrap.py index a6d9af53..80b27b23 100644 --- a/bob/devtools/bootstrap.py +++ b/bob/devtools/bootstrap.py @@ -294,21 +294,18 @@ def get_channels( The subset of channels to be returned depends on the visibility and stability of the package being built. Here are the rules: - * public and stable: only returns the public stable channel(s) - * public and not stable: returns both public stable and beta channels + * public and stable: returns the public stable channel + * public and not stable: returns the public beta channel * not public and stable: returns both public and private stable channels - * not public and not stable: returns all channels - - Beta channels have priority over stable channels, if returned. Public - channels have priority over private channles, if turned. + * not public and not stable: returns both public and private beta channels + Public channels have priority over private channles, if turned. Args: public: Boolean indicating if we're supposed to include only public channels - stable: Boolean indicating if we're supposed to include only stable - channels + stable: Boolean indicating if we're supposed to include stable channels server: The base address of the server containing our conda channels intranet: Boolean indicating if we should add "private"/"public" prefixes on the conda paths @@ -316,8 +313,7 @@ def get_channels( compiling is part of. Values should match URL namespaces currently available on our internal webserver. Currently, only "bob" or "beat" will work. - add_dependent_channels: If True, will add the defaults and conda-forge - channels to the list + add_dependent_channels: If True, will add the conda-forge channel to the list Returns: a list of channels that need to be considered. @@ -335,20 +331,21 @@ def get_channels( # do not use '/public' urls for public channels prefix = "/software/" + group - if not stable: + if stable: + channels += [server + prefix + "/conda"] + channels_dict["public/stable"] = channels[-1] + else: channels += [server + prefix + "/conda/label/beta"] # allowed betas channels_dict["public/beta"] = channels[-1] - channels += [server + prefix + "/conda"] - channels_dict["public/stable"] = channels[-1] - if not public: prefix = "/private" - if not stable: # allowed private channels + if stable: # allowed private channels + channels += [server + prefix + "/conda"] + channels_dict["private/stable"] = channels[-1] + else: channels += [server + prefix + "/conda/label/beta"] # allowed betas channels_dict["private/beta"] = channels[-1] - channels += [server + prefix + "/conda"] - channels_dict["private/stable"] = channels[-1] upload_channel = channels_dict[ "{}/{}".format( diff --git a/bob/devtools/test_bootstrap.py b/bob/devtools/test_bootstrap.py new file mode 100644 index 00000000..b8f7e800 --- /dev/null +++ b/bob/devtools/test_bootstrap.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +from .bootstrap import get_channels + + +def test_get_channels(): + server, group = "idiap.ch", "bob" + + # test when building public beta packages + public, stable = True, False + channels, upload_channel = get_channels( + public=public, + stable=stable, + server=server, + intranet=not public, + group=group, + ) + assert channels == [f"{server}/software/{group}/conda/label/beta"] + assert upload_channel == channels[0] + + # test with add_dependent_channels + channels, upload_channel = get_channels( + public=public, + stable=stable, + server=server, + intranet=not public, + group=group, + add_dependent_channels=True, + ) + assert channels == [ + f"{server}/software/{group}/conda/label/beta", + "conda-forge", + ] + assert upload_channel == channels[0] + + # test when building public stable packages + public, stable = True, True + channels, upload_channel = get_channels( + public=public, + stable=stable, + server=server, + intranet=not public, + group=group, + ) + assert channels == [f"{server}/software/{group}/conda"] + assert upload_channel == channels[0] + + # test when building private beta packages + public, stable = False, False + channels, upload_channel = get_channels( + public=public, + stable=stable, + server=server, + intranet=not public, + group=group, + ) + assert channels == [ + f"{server}/software/{group}/conda/label/beta", + f"{server}/private/conda/label/beta", + ] + assert upload_channel == channels[1] + + # test when building private stable packages + public, stable = False, True + channels, upload_channel = get_channels( + public=public, + stable=stable, + server=server, + intranet=not public, + group=group, + ) + assert channels == [ + f"{server}/software/{group}/conda", + f"{server}/private/conda", + ] + assert upload_channel == channels[1] -- GitLab