conan remote remove fails with editable packages

Created on 2 Jul 2019  路  4Comments  路  Source: conan-io/conan

Trying to update the metadata, it fails because the PackageEditableLayout has no update_metadata(). The main questions are:

  • Should the editable packages still have the metadata methods available?
    or
  • Should we force always to retrieve the PackageCacheLayout sometimes, e.g from the remote_registry.py?
Traceback (most recent call last):                                                                                                                                                                                                                                             
  File "/home/luism/workspace/conan_sources/conans/client/command.py", line 1832, in run                                                                                                                                                                                       
    method(args[0][1:])                                                                                                                                                                                                                                                        
  File "/home/luism/workspace/conan_sources/conans/client/command.py", line 1423, in remote                                                                                                                                                                                    
    return self._conan.remote_remove(remote_name)                                                                                                                                                                                                                              
  File "/home/luism/workspace/conan_sources/conans/client/conan_api.py", line 77, in wrapper                                                                                                                                                                                   
    return f(*args, **kwargs)
  File "/home/luism/workspace/conan_sources/conans/client/conan_api.py", line 922, in remote_remove
    return self._cache.registry.remove(remote_name)
  File "/home/luism/workspace/conan_sources/conans/client/cache/remote_registry.py", line 301, in remove
    with self._cache.package_layout(ref).update_metadata() as metadata:
AttributeError: 'PackageEditableLayout' object has no attribute 'update_metadata'
low medium review bug

Most helpful comment

I see, you are right.

I think there are 2 approaches:

  • Explicit force to get the cache metadata, like: with self._cache.package_layout(ref, from-cache=True).update_metadata() as metadata:
  • Explicit disabling of editables, like in the RemoteRegistry.remove make cache.editables = {} and at the end of the function restore it.

I think at the moment I prefer the later one, until we have more cases.

All 4 comments

@memsharded I would like to know what do you think about this.

I think that so far it doesn't make sense, as metadata are revisions (we don't have them while editable) and remote (same). If the package is in editable mode, I think doesn't make much sense to return PackageCacheLayout for it, so far the PacakgeEditableLayout have placeholder methods to provide better error messages.

Agree. But then what, how to solve this issue? Should the remote remove just ignore the editable layouts? When the package is no longer in "editable mode" it will have metadata with a wrong remote (removed).

I see, you are right.

I think there are 2 approaches:

  • Explicit force to get the cache metadata, like: with self._cache.package_layout(ref, from-cache=True).update_metadata() as metadata:
  • Explicit disabling of editables, like in the RemoteRegistry.remove make cache.editables = {} and at the end of the function restore it.

I think at the moment I prefer the later one, until we have more cases.

Was this page helpful?
0 / 5 - 0 ratings