Merge lp:~kyrofa/unity-scope-snappy/launcher_scope into lp:~unity-api-team/unity-scope-snappy/trunk

Proposed by Kyle Fazzari
Status: Needs review
Proposed branch: lp:~kyrofa/unity-scope-snappy/launcher_scope
Merge into: lp:~unity-api-team/unity-scope-snappy/trunk
Diff against target: 268 lines (+197/-6)
7 files modified
Makefile (+1/-1)
debian/rules (+7/-2)
debian/unity-scope-snappy.install (+9/-3)
launcher/main.go (+39/-0)
launcher/scope/scope.go (+87/-0)
launcher/snappy-launcher.ini (+6/-0)
test/launcher/test_surface.py (+48/-0)
To merge this branch: bzr merge lp:~kyrofa/unity-scope-snappy/launcher_scope
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Unity API Team Pending
Review via email: mp+266132@code.launchpad.net

Commit message

Add basic launcher scope with debian packaging and integration tests.

Description of the change

Add basic launcher scope, along with debian packaging and integration test.

The scope has no functionality yet-- this is all just scaffolding.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

34. By Kyle Fazzari

Add basic launcher scope with debian packaging and integration tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2015-07-16 16:41:37 +0000
+++ Makefile 2015-07-28 16:46:34 +0000
@@ -5,7 +5,7 @@
5GOFMT=gofmt -w5GOFMT=gofmt -w
66
7TOP_PACKAGE := launchpad.net/unity-scope-snappy7TOP_PACKAGE := launchpad.net/unity-scope-snappy
8EXECUTABLES := store package-management-daemon8EXECUTABLES := launcher store package-management-daemon
9PACKAGES_TO_TEST := package-management-daemon/daemon \9PACKAGES_TO_TEST := package-management-daemon/daemon \
10 store/actions \10 store/actions \
11 store/packages \11 store/packages \
1212
=== added file 'data/snappy-launcher.png'
13Binary files data/snappy-launcher.png 1970-01-01 00:00:00 +0000 and data/snappy-launcher.png 2015-07-28 16:46:34 +0000 differ13Binary files data/snappy-launcher.png 1970-01-01 00:00:00 +0000 and data/snappy-launcher.png 2015-07-28 16:46:34 +0000 differ
=== modified file 'debian/rules'
--- debian/rules 2015-07-16 18:09:58 +0000
+++ debian/rules 2015-07-28 16:46:34 +0000
@@ -10,12 +10,13 @@
10export PATH := $(GOPATH)/bin:$(PATH)10export PATH := $(GOPATH)/bin:$(PATH)
1111
12STORE_FILE_PATH := /usr/lib/$(DEB_HOST_MULTIARCH)/unity-scopes/snappy-store/store12STORE_FILE_PATH := /usr/lib/$(DEB_HOST_MULTIARCH)/unity-scopes/snappy-store/store
13LAUNCHER_FILE_PATH := /usr/lib/$(DEB_HOST_MULTIARCH)/unity-scopes/snappy-launcher/launcher
1314
14%:15%:
15 dh $@ --buildsystem=golang --with=golang16 dh $@ --buildsystem=golang --with=golang
1617
17# Run the tests and produce a Cobertura-compatible coverage report.18# Run the tests and produce a Cobertura-compatible coverage report.
18override_dh_auto_test: debian/snappy-store.ini debian/com.canonical.applications.WebdmPackageManager.service19override_dh_auto_test: debian/snappy-launcher.ini debian/snappy-store.ini debian/com.canonical.applications.WebdmPackageManager.service
19 dbus-test-runner -m 600 -t make -p integration_tests20 dbus-test-runner -m 600 -t make -p integration_tests
20 dbus-test-runner -m 600 -t make -p coverage.xml21 dbus-test-runner -m 600 -t make -p coverage.xml
2122
@@ -23,6 +24,10 @@
23debian/%: data/%.in24debian/%: data/%.in
24 sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@25 sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
2526
26# Rewrite the scope.ini file to point to the multiarch location.27# Rewrite the snappy-store.ini file to point to the multiarch location.
27debian/snappy-store.ini: store/snappy-store.ini28debian/snappy-store.ini: store/snappy-store.ini
28 sed 's|ScopeRunner.*|ScopeRunner = $(STORE_FILE_PATH) --runtime %R --scope %S|g' $< > $@29 sed 's|ScopeRunner.*|ScopeRunner = $(STORE_FILE_PATH) --runtime %R --scope %S|g' $< > $@
30
31# Rewrite the snappy-launcher.ini file to point to the multiarch location.
32debian/snappy-launcher.ini: launcher/snappy-launcher.ini
33 sed 's|ScopeRunner.*|ScopeRunner = $(LAUNCHER_FILE_PATH) --runtime %R --scope %S|g' $< > $@
2934
=== modified file 'debian/unity-scope-snappy.install'
--- debian/unity-scope-snappy.install 2015-07-16 18:09:58 +0000
+++ debian/unity-scope-snappy.install 2015-07-28 16:46:34 +0000
@@ -1,5 +1,11 @@
1#!/usr/bin/dh-exec1#!/usr/bin/dh-exec
22
3usr/bin/store usr/lib/${DEB_HOST_MULTIARCH}/unity-scopes/snappy-store/3# Install Snappy Store
4debian/snappy-store.ini usr/lib/${DEB_HOST_MULTIARCH}/unity-scopes/snappy-store/4usr/bin/store usr/lib/${DEB_HOST_MULTIARCH}/unity-scopes/snappy-store
5data/snappy-store.png usr/share/unity/scopes/snappy-store/5debian/snappy-store.ini usr/lib/${DEB_HOST_MULTIARCH}/unity-scopes/snappy-store
6data/snappy-store.png usr/share/unity/scopes/snappy-store
7
8# Install Snappy Launcher
9usr/bin/launcher usr/lib/${DEB_HOST_MULTIARCH}/unity-scopes/snappy-launcher
10debian/snappy-launcher.ini usr/lib/${DEB_HOST_MULTIARCH}/unity-scopes/snappy-launcher
11data/snappy-launcher.png usr/share/unity/scopes/snappy-launcher
612
=== added directory 'launcher'
=== added file 'launcher/main.go'
--- launcher/main.go 1970-01-01 00:00:00 +0000
+++ launcher/main.go 2015-07-28 16:46:34 +0000
@@ -0,0 +1,39 @@
1/* Copyright (C) 2015 Canonical Ltd.
2 *
3 * This file is part of unity-scope-snappy.
4 *
5 * unity-scope-snappy is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation, either version 3 of the License, or (at your option) any
8 * later version.
9 *
10 * unity-scope-snappy is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * unity-scope-snappy. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package main
20
21import (
22 "launchpad.net/unity-scope-snappy/internal/launchpad.net/go-unityscopes/v2"
23 "launchpad.net/unity-scope-snappy/launcher/scope"
24 "log"
25)
26
27// main is the entry point of the scope.
28func main() {
29 scope, err := scope.New()
30 if err != nil {
31 log.Printf("snappy-launcher: Unable to create scope: %s", err)
32 return
33 }
34
35 err = scopes.Run(scope)
36 if err != nil {
37 log.Printf("snappy-launcher: Unable to run scope: %s", err)
38 }
39}
040
=== added directory 'launcher/scope'
=== added file 'launcher/scope/scope.go'
--- launcher/scope/scope.go 1970-01-01 00:00:00 +0000
+++ launcher/scope/scope.go 2015-07-28 16:46:34 +0000
@@ -0,0 +1,87 @@
1/* Copyright (C) 2015 Canonical Ltd.
2 *
3 * This file is part of unity-scope-snappy.
4 *
5 * unity-scope-snappy is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation, either version 3 of the License, or (at your option) any
8 * later version.
9 *
10 * unity-scope-snappy is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * unity-scope-snappy. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package scope
20
21import (
22 "fmt"
23 "launchpad.net/unity-scope-snappy/internal/launchpad.net/go-unityscopes/v2"
24 "log"
25)
26
27// template for the grid layout of the search results.
28const layout = `{
29 "schema-version": 1,
30 "template": {
31 "category-layout": "grid",
32 "card-size": "small"
33 },
34 "components": {
35 "title": "title",
36 "art" : {
37 "field": "art"
38 },
39 "subtitle": "subtitle"
40 }
41}`
42
43// Scope is the struct representing the scope itself.
44type Scope struct {}
45
46// New creates a new Snappy Launcher scope.
47func New() (*Scope, error) {
48 return &Scope{}, nil
49}
50
51func (scope *Scope) SetScopeBase(base *scopes.ScopeBase) {
52 // Do nothing
53}
54
55func (scope Scope) Search(query *scopes.CannedQuery, metadata *scopes.SearchMetadata, reply *scopes.SearchReply, cancelled <-chan bool) error {
56 //createDepartments(query, reply)
57
58 return nil
59}
60
61func (scope Scope) Preview(result *scopes.Result, metadata *scopes.ActionMetadata, reply *scopes.PreviewReply, cancelled <-chan bool) error {
62 return nil
63}
64
65// createDepartments is used to create a set of static departments for the
66// scope.
67//
68// It accepts a query to be executed when the department is selected, and a
69// reply onto which the new departments will be registered.
70func createDepartments(query *scopes.CannedQuery, reply *scopes.SearchReply) error {
71 rootDepartment, err := scopes.NewDepartment("", query, "All Categories")
72 if err != nil {
73 return fmt.Errorf(`Unable to create "All Categories" department: %s`, err)
74 }
75
76 reply.RegisterDepartments(rootDepartment)
77
78 return nil
79}
80
81// scopeError prints an error to stderr as well as returning an actual error.
82// This is used because the errors returned from the scope functions don't seem
83// to be handled, logged, or otherwise displayed to the user in any way.
84func scopeError(format string, a ...interface{}) error {
85 log.Printf(format, a...)
86 return fmt.Errorf(format, a...)
87}
088
=== added file 'launcher/snappy-launcher.ini'
--- launcher/snappy-launcher.ini 1970-01-01 00:00:00 +0000
+++ launcher/snappy-launcher.ini 2015-07-28 16:46:34 +0000
@@ -0,0 +1,6 @@
1[ScopeConfig]
2DisplayName = Snappy Launcher
3Description = A scope to view and launch snap and legacy applications
4Author = Canonical
5Icon = /usr/share/unity/scopes/snappy-launcher/snappy-launcher.png
6ScopeRunner = $GOPATH/bin/launcher --runtime %R --scope %S
07
=== added directory 'test/launcher'
=== added file 'test/launcher/__init__.py'
=== added file 'test/launcher/test_surface.py'
--- test/launcher/test_surface.py 1970-01-01 00:00:00 +0000
+++ test/launcher/test_surface.py 2015-07-28 16:46:34 +0000
@@ -0,0 +1,48 @@
1#!/usr/bin/env python3
2
3# Copyright (C) 2015 Canonical Ltd.
4#
5# This file is part of unity-scope-snappy.
6#
7# unity-scope-snappy is free software: you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by the Free
9# Software Foundation, either version 3 of the License, or (at your option) any
10# later version.
11#
12# unity-scope-snappy is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15# details.
16#
17# You should have received a copy of the GNU General Public License along with
18# unity-scope-snappy. If not, see <http://www.gnu.org/licenses/>.
19
20import os
21import sys
22import unittest
23
24from scope_harness.testing import ScopeHarnessTestCase
25from scope_harness import (ScopeHarness,
26 Parameters)
27
28class TestInitialSurface(ScopeHarnessTestCase):
29 """Test the initial surfacing of the launcher scope (no search query).
30 """
31
32 def setUp(self):
33 """Run the Snappy Launcher using the harness.
34 """
35
36 self.harness = ScopeHarness.new_from_scope_list(Parameters([
37 "{}/../../launcher/snappy-launcher.ini".format(os.path.dirname(os.path.realpath(__file__)))
38 ]))
39 self.view = self.harness.results_view
40 self.view.active_scope = "snappy-launcher"
41 self.view.search_query = ""
42
43 def testScopeProperties(self):
44 """Test the scope properties from the .ini file"""
45
46 self.assertEqual(self.view.scope_id, "snappy-launcher")
47 self.assertEqual(self.view.display_name, "Snappy Launcher")
48 self.assertEqual(self.view.description, "A scope to view and launch snap and legacy applications")

Subscribers

People subscribed via source and target branches