Skip to content

Commit

Permalink
Add warning when downloading recipes from bintray (#9416)
Browse files Browse the repository at this point in the history
* Add warning when downloading recipes from bintray

* fix msg format

* change test

* Use mocked remote

* Update conans/client/graph/proxy.py
  • Loading branch information
danimtb committed Aug 23, 2021
1 parent 77a3e5b commit f16ff88
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions conans/client/graph/proxy.py
Expand Up @@ -13,6 +13,10 @@
from conans.util.tracer import log_recipe_got_from_local_cache


# TODO: Remove warning message when this URL is no longer available
DEPRECATED_CONAN_CENTER_BINTRAY_URL = "https://conan.bintray.com"


class ConanProxy(object):
def __init__(self, cache, output, remote_manager):
# collaborators
Expand Down Expand Up @@ -113,6 +117,12 @@ def _download_recipe(self, layout, ref, output, remotes, remote, recorder):
def _retrieve_from_remote(the_remote):
output.info("Trying with '%s'..." % the_remote.name)
# If incomplete, resolve the latest in server
if the_remote.url.startswith(DEPRECATED_CONAN_CENTER_BINTRAY_URL):
output.warn("Remote https://conan.bintray.com is deprecated and will be shut down "
"soon.")
output.warn("Please use the new 'conancenter' default remote.")
output.warn("Add it to your remotes with: conan remote add -i 0 conancenter "
"https://center.conan.io")
_ref = self._remote_manager.get_recipe(ref, the_remote)
output.info("Downloaded recipe revision %s" % _ref.revision)
recorder.recipe_downloaded(ref, the_remote.url)
Expand Down
18 changes: 18 additions & 0 deletions conans/test/integration/command/install/install_test.py
Expand Up @@ -447,3 +447,21 @@ def test_create_cli_override(self, client):
"test_package/conanfile.py": GenConanfile().with_test("pass")})
client.run("create . pkg/0.1@ --require-override=zlib/2.0")
assert "zlib/2.0: Already installed" in client.out


def test_install_bintray_warning():
server = TestServer(complete_urls=True)
from conans.client.graph import proxy
proxy.DEPRECATED_CONAN_CENTER_BINTRAY_URL = server.fake_url # Mocking!
client = TestClient(servers={"conan-center": server},
users={"conan-center": [("lasote", "mypass")]})
client.save({"conanfile.py": GenConanfile()})
client.run("create . zlib/1.0@lasote/testing")
client.run("upload zlib/1.0@lasote/testing --all -r conan-center")
client.run("remove * -f")
client.run("install zlib/1.0@lasote/testing -r conan-center")
assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \
"soon" in client.out
client.run("install zlib/1.0@lasote/testing -r conan-center -s build_type=Debug")
assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \
"soon" not in client.out

0 comments on commit f16ff88

Please sign in to comment.