Migrate from skills to interfaces #356

Merged
merged 1 commit into from Mar 1, 2016

Conversation

Projects
None yet
3 participants
Collaborator

sergiusens commented Mar 1, 2016

This adds some sort of transparent migration logic from "skills" related
keywords to the ones belonging to "interfaces".

LP: #1549427

Signed-off-by: Sergio Schvezov sergio.schvezov@ubuntu.com

Collaborator

sergiusens commented Mar 1, 2016

meh, cov is 93%... not sure what went wrong here

Collaborator

sergiusens commented Mar 1, 2016

this cannot land before we have an image

@@ -63,6 +63,49 @@ def test_config_loads_plugins(self, mock_get_part, mock_loadPlugin):
self.assertFalse(mock_get_part.called)
+ @unittest.mock.patch('snapcraft.yaml.Config.load_plugin')
+ def test_config_works_with_skills(self, mock_loadPlugin):
@zyga

zyga Mar 1, 2016

Contributor

_with_interfaces

+apps:
+ app1:
+ command: runme
+ uses:
@zyga

zyga Mar 1, 2016

Contributor

Is this intentional?

@sergiusens

sergiusens Mar 1, 2016

Collaborator

yes, that is why the test is called with skills

you don't have to face angry users, I do 😉

@kyrofa

kyrofa Mar 1, 2016

Member

Yeah, good call.

+ 'snap': [], 'stage': [],
+ 'stage-packages': ['fswebcam']}},
+ 'slots': {
+ 'migration': {
@zyga

zyga Mar 1, 2016

Contributor

Ah, ignore me :)

snapcraft/yaml.py
@@ -113,6 +113,10 @@ def __init__(self):
self.after_requests = {}
self.data = _snapcraft_yaml_load()
+
+ # To make the transition less painful
+ self._remap_skills()
@zyga

zyga Mar 1, 2016

Contributor

Nitpicking now, perhaps _translate_skills_to_intrerfaces()?

@sergiusens

sergiusens Mar 1, 2016

Collaborator

I took the middle ground, _remap_skills_to_interfaces

snapcraft/yaml.py
+ def _remap_skills(self):
+ if 'uses' in self.data:
+ logger.warning(
+ "DEPRECATED: Instances of 'uses' remapped to 'slots'")
@zyga

zyga Mar 1, 2016

Contributor

I'd display a link to the mailing list where Gustavo announces this in case anyone wonders what that is.

@sergiusens

sergiusens Mar 1, 2016

Collaborator

I'd rather wait for the documentation to surface on developer.ubuntu.com
In any case people that already know what skills are with little to know documentation will be able to catchup.

Contributor

zyga commented Mar 1, 2016

+1, with two optional notes

Migrate from skills to interfaces
This adds some sort of transparent migration logic from "skills" related
keywords to the ones belonging to "interfaces".

LP: #1549427

Signed-off-by: Sergio Schvezov <sergio.schvezov@ubuntu.com>
+ def _remap_skills_to_interfaces(self):
+ if 'uses' in self.data:
+ logger.warning(
+ "DEPRECATED: Instances of 'uses' remapped to 'slots'")
@kyrofa

kyrofa Mar 1, 2016

Member

Ah, excellent.

Member

kyrofa commented Mar 1, 2016

👍 from me

sergiusens added a commit that referenced this pull request Mar 1, 2016

@sergiusens sergiusens merged commit a9e5f06 into snapcore:master Mar 1, 2016

4 checks passed

Examples tests Success 13 tests run, 0 skipped, 0 failed.
Details
autopkgtest Success No test results found.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.1%) to 94.823%
Details

@sergiusens sergiusens deleted the sergiusens:feature/1549427/skills2interfaces branch Mar 1, 2016

kalikiana pushed a commit to kalikiana/snapcraft that referenced this pull request Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment