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

Do not raise when accessing the metadata of editable packages #5461

Merged
merged 10 commits into from
Jul 29, 2019
6 changes: 6 additions & 0 deletions conans/client/cache/remote_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ def clear(self):
remotes = self.load_remotes()
remotes.clear()
for ref in self._cache.all_refs():
if ref in self._cache.editable_packages.edited_refs:
continue # Skip editable packages
with self._cache.package_layout(ref).update_metadata() as metadata:
metadata.recipe.remote = None
for pkg_metadata in metadata.packages.values():
Expand All @@ -313,6 +315,8 @@ def remove(self, remote_name):
del remotes[remote_name]

for ref in self._cache.all_refs():
if ref in self._cache.editable_packages.edited_refs:
continue # Skip editable packages
with self._cache.package_layout(ref).update_metadata() as metadata:
if metadata.recipe.remote == remote_name:
metadata.recipe.remote = None
Expand All @@ -339,6 +343,8 @@ def rename(self, remote_name, new_remote_name):
remotes.rename(remote_name, new_remote_name)

for ref in self._cache.all_refs():
if ref in self._cache.editable_packages.edited_refs:
continue # Skip editable packages
with self._cache.package_layout(ref).update_metadata() as metadata:
if metadata.recipe.remote == remote_name:
metadata.recipe.remote = new_remote_name
Expand Down
17 changes: 17 additions & 0 deletions conans/test/functional/command/remote_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,20 @@ def test_invalid_url(self):
self.client.user_io.out)
self.client.run("remote list")
self.assertIn("pepe.org", self.client.out)

def test_metadata_editable_packages(self):
"""
conan remote remove fails with editable packages
danimtb marked this conversation as resolved.
Show resolved Hide resolved
"""
self.client.save({"conanfile.py": """from conans import ConanFile
class Conan(ConanFile):
pass"""})
self.client.run("create . pkg/1.1@lasote/stable")
self.client.run("upload pkg/1.1@lasote/stable --all -c --remote remote1")
self.client.run("remove -f pkg/1.1@lasote/stable")
self.client.run("install pkg/1.1@lasote/stable")
self.client.run("editable add . pkg/1.1@lasote/stable")
self.client.run("remote update remote1 %sfake" % self.servers["remote1"].fake_url)
self.client.run("remote rename remote1 remote-fake")
self.client.run("remote remove remote-fake")
self.client.run("remote clean")
danimtb marked this conversation as resolved.
Show resolved Hide resolved