Merge lp:~ricmm/python-ubuntu-platform-api/papi-v2 into lp:python-ubuntu-platform-api

Proposed by Ricardo Mendoza
Status: Merged
Merged at revision: 21
Proposed branch: lp:~ricmm/python-ubuntu-platform-api/papi-v2
Merge into: lp:python-ubuntu-platform-api
Diff against target: 362 lines (+3/-308)
4 files modified
debian/control (+1/-1)
setup.py (+2/-15)
upa/__init__.py (+0/-5)
upa/_sf.cpp (+0/-287)
To merge this branch: bzr merge lp:~ricmm/python-ubuntu-platform-api/papi-v2
Reviewer Review Type Date Requested Status
Thomi Richards (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+221324@code.launchpad.net

Commit message

Migrate to Platform API V2

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

i can't get the package to build with 'bzr bd'.

I get:

dpkg-genchanges: error: binary build with no binary artifacts found; cannot distribute

I built and installed https://code.launchpad.net/~ricmm/platform-api/v2-dynamic-refactor/+merge/220721 but I still get this failure. Any ideas what I'm doing wrong?

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2013-06-11 12:52:02 +0000
3+++ debian/control 2014-05-29 07:29:44 +0000
4@@ -5,7 +5,7 @@
5 Build-Depends: debhelper (>= 9),
6 libgles2-mesa-dev,
7 libhybris-dev,
8- libubuntu-platform-api1-dev,
9+ libubuntu-application-api-dev,
10 python-dev,
11 Standards-Version: 3.9.4
12 Homepage: https://launchpad.net/python-ubuntu-platform-api
13
14=== modified file 'setup.py'
15--- setup.py 2013-10-01 02:56:12 +0000
16+++ setup.py 2014-05-29 07:29:44 +0000
17@@ -17,25 +17,12 @@
18
19 from distutils.core import setup, Extension
20
21-
22-sf_backend = Extension(name='upa._sf',
23- sources=['upa/_sf.cpp'],
24- include_dirs=['/usr/include/hybris'],
25- library_dirs=['/usr/lib/arm-linux-gnueabihf'],
26- libraries=[
27- 'ubuntu_application_api',
28- 'hybris_ics',
29- 'EGL',
30- 'GLESv2'
31- ]
32- )
33-
34 mir_backend = Extension(name='upa._mir',
35 sources=['upa/_mir.cpp'],
36 include_dirs=['/usr/include/hybris'],
37 library_dirs=['/usr/lib/arm-linux-gnueabihf'],
38 libraries=[
39- 'ubuntu_application_api_mirclient',
40+ 'ubuntu_application_api',
41 'hybris_ics',
42 'EGL',
43 'GLESv2'
44@@ -46,7 +33,7 @@
45 name = 'UPA',
46 version = '1.0',
47 description = 'This is a demo package',
48- ext_modules = [sf_backend, mir_backend],
49+ ext_modules = [mir_backend],
50 scripts=['monitor_upa'],
51 packages=['upa'],
52 )
53
54=== modified file 'upa/__init__.py'
55--- upa/__init__.py 2013-10-01 14:59:30 +0000
56+++ upa/__init__.py 2014-05-29 07:29:44 +0000
57@@ -29,13 +29,8 @@
58
59
60 def _get_correct_backend():
61- if (getstatusoutput("pgrep surfaceflinger")[0] != 0):
62 import _mir
63 return _mir
64- else:
65- import _sf
66- return _sf
67-
68
69 def get_resolution():
70 """Return a tuple containing x, y screen resolution."""
71
72=== removed file 'upa/_sf.cpp'
73--- upa/_sf.cpp 2013-10-01 03:16:14 +0000
74+++ upa/_sf.cpp 1970-01-01 00:00:00 +0000
75@@ -1,287 +0,0 @@
76-/*
77- * Copyright 2013 Canonical Ltd.
78- *
79- * This file is part of python-ubuntu-platform-api.
80- *
81- * python-upa is free software: you can redistribute it and/or modify
82- * it under the terms of the GNU General Public License as published by
83- * the Free Software Foundation; version 3.
84- *
85- * python-upa is distributed in the hope that it will be useful,
86- * but WITHOUT ANY WARRANTY; without even the implied warranty of
87- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88- * GNU General Public License for more details.
89- *
90- * You should have received a copy of the GNU General Public License
91- * along with this program. If not, see <http://www.gnu.org/licenses/>.
92- */
93-
94-#include <Python.h>
95-
96-#include <ubuntu/ui/ubuntu_ui_session_service.h>
97-#include <ubuntu/application/ui/display.h>
98-
99-
100-/// These represent python callables we call when each different event happens.
101-static PyObject* usr_session_requested_cb = NULL;
102-static PyObject* usr_session_born_cb = NULL;
103-static PyObject* usr_session_focused_cb = NULL;
104-static PyObject* usr_session_unfocused_cb = NULL;
105-static PyObject* usr_session_died_cb = NULL;
106-
107-// The observer itself:
108-static ubuntu_ui_session_lifecycle_observer observer;
109-
110-// forward declared functions:
111-static PyObject* py_set_session_requested_cb(PyObject* dummy, PyObject* args);
112-static PyObject* py_set_session_born_cb(PyObject* dummy, PyObject* args);
113-static PyObject* py_set_session_focused_cb(PyObject* dummy, PyObject* args);
114-static PyObject* py_set_session_unfocused_cb(PyObject* dummy, PyObject* args);
115-static PyObject* py_set_session_died_cb(PyObject* dummy, PyObject* args);
116-static PyObject* set_cb(PyObject *callable, PyObject** cb_to_set);
117-static PyObject* py_start_monitoring(PyObject*, PyObject*);
118-static const char* get_well_known_app_name(ubuntu_ui_well_known_application app);
119-static PyObject* get_arglist_dict_from_session_properties(ubuntu_ui_session_properties props);
120-static void on_session_requested(ubuntu_ui_well_known_application app, void*);
121-static void on_session_born(ubuntu_ui_session_properties props, void*);
122-static void on_session_focused(ubuntu_ui_session_properties props, void*);
123-static void on_session_unfocused(ubuntu_ui_session_properties props, void*);
124-static void on_session_died(ubuntu_ui_session_properties props, void*);
125-
126-
127-
128-
129-static PyObject* py_set_session_requested_cb(PyObject* dummy, PyObject* args)
130-{
131- PyObject* callable;
132-
133- if (PyArg_ParseTuple(args, "O:set_session_requested_callback", &callable)) {
134- if (!PyCallable_Check(callable)) {
135- PyErr_SetString(PyExc_TypeError, "parameter must be callable");
136- return NULL;
137- }
138- return set_cb(callable, &usr_session_requested_cb);
139- }
140- return NULL;
141-}
142-
143-static PyObject* py_set_session_born_cb(PyObject* dummy, PyObject* args)
144-{
145- PyObject* callable;
146-
147- if (PyArg_ParseTuple(args, "O:set_session_born_callback", &callable)) {
148- if (!PyCallable_Check(callable)) {
149- PyErr_SetString(PyExc_TypeError, "parameter must be callable");
150- return NULL;
151- }
152- return set_cb(callable, &usr_session_born_cb);
153- }
154- return NULL;
155-}
156-
157-static PyObject* py_set_session_focused_cb(PyObject* dummy, PyObject* args)
158-{
159- PyObject* callable;
160-
161- if (PyArg_ParseTuple(args, "O:set_session_focused_callback", &callable)) {
162- if (!PyCallable_Check(callable)) {
163- PyErr_SetString(PyExc_TypeError, "parameter must be callable");
164- return NULL;
165- }
166- return set_cb(callable, &usr_session_focused_cb);
167- }
168- return NULL;
169-}
170-
171-static PyObject* py_set_session_unfocused_cb(PyObject* dummy, PyObject* args)
172-{
173- PyObject* callable;
174-
175- if (PyArg_ParseTuple(args, "O:set_session_unfocused_callback", &callable)) {
176- if (!PyCallable_Check(callable)) {
177- PyErr_SetString(PyExc_TypeError, "parameter must be callable");
178- return NULL;
179- }
180- return set_cb(callable, &usr_session_unfocused_cb);
181- }
182- return NULL;
183-}
184-
185-static PyObject* py_set_session_died_cb(PyObject* dummy, PyObject* args)
186-{
187- PyObject* callable;
188-
189- if (PyArg_ParseTuple(args, "O:set_session_died_callback", &callable)) {
190- if (!PyCallable_Check(callable)) {
191- PyErr_SetString(PyExc_TypeError, "parameter must be callable");
192- return NULL;
193- }
194- return set_cb(callable, &usr_session_died_cb);
195- }
196- return NULL;
197-}
198-
199-/// Do the boilderplate code to actually store the callable object:
200-static PyObject* set_cb(PyObject *callable, PyObject** cb_to_set)
201-{
202- Py_XINCREF(callable); /* Add a reference to new callback */
203- Py_XDECREF(*cb_to_set); /* Dispose of previous callback */
204- *cb_to_set = callable; /* Remember new callback */
205-
206- Py_RETURN_NONE;
207-}
208-
209-static PyObject* py_start_monitoring(PyObject*, PyObject*)
210-{
211- memset(&observer, 0, sizeof(observer));
212- observer.on_session_requested = on_session_requested;
213- observer.on_session_born = on_session_born;
214- observer.on_session_unfocused = on_session_unfocused;
215- observer.on_session_focused = on_session_focused;
216- observer.on_session_died = on_session_died;
217-
218- ubuntu_ui_session_install_session_lifecycle_observer(&observer);
219-
220- Py_RETURN_NONE;
221-}
222-
223-static const char* get_well_known_app_name(ubuntu_ui_well_known_application app)
224-{
225- switch (app)
226- {
227- case UNKNOWN_APP:
228- return "unknown";
229- case CAMERA_APP:
230- return "camera";
231- case GALLERY_APP:
232- return "gallery";
233- case BROWSER_APP:
234- return "browser";
235- case SHARE_APP:
236- return "share";
237- default:
238- return "other";
239- }
240-}
241-
242-/// Get a PyObject* representing a dictionary of all the information we can extract
243-/// from the session properties object. The return value must be DECREF'd.
244-static PyObject* get_arglist_dict_from_session_properties(ubuntu_ui_session_properties props)
245-{
246- return Py_BuildValue("({s:i,s:s})",
247- "app-instance-id", ubuntu_ui_session_properties_get_application_instance_id(props),
248- "desktop-file-hint", ubuntu_ui_session_properties_get_desktop_file_hint(props)
249- );
250-}
251-
252-static PyObject* py_get_resolution(PyObject* dummy, PyObject* args)
253-{
254- UAUiDisplay* display = ua_ui_display_new_with_index(0); // get info for screen 0.
255- int32_t res_x = ua_ui_display_query_horizontal_res(display);
256- int32_t res_y = ua_ui_display_query_vertical_res(display);
257- ua_ui_display_destroy(display);
258- return Py_BuildValue("(i,i)", res_x, res_y);
259-}
260-
261-static void on_session_requested(ubuntu_ui_well_known_application app, void*)
262-{
263- PyGILState_STATE gstate;
264- gstate = PyGILState_Ensure();
265- if (usr_session_requested_cb)
266- {
267- PyObject* arglist = Py_BuildValue("({s:s})", "application", get_well_known_app_name(app));
268- PyObject* result = PyObject_CallObject(usr_session_requested_cb, arglist);
269- if (result)
270- Py_DECREF(result);
271- else
272- PyErr_Print();
273- Py_DECREF(arglist);
274- }
275- PyGILState_Release(gstate);
276-}
277-
278-static void on_session_born(ubuntu_ui_session_properties props, void*)
279-{
280- PyGILState_STATE gstate;
281- gstate = PyGILState_Ensure();
282- if (usr_session_born_cb)
283- {
284- PyObject* args = get_arglist_dict_from_session_properties(props);
285- PyObject* result = PyObject_CallObject(usr_session_born_cb, args);
286- if (result)
287- Py_DECREF(result);
288- else
289- PyErr_Print();
290- Py_DECREF(args);
291- }
292- PyGILState_Release(gstate);
293-}
294-
295-static void on_session_focused(ubuntu_ui_session_properties props, void*)
296-{
297- PyGILState_STATE gstate;
298- gstate = PyGILState_Ensure();
299- if (usr_session_focused_cb)
300- {
301- PyObject* args = get_arglist_dict_from_session_properties(props);
302- PyObject* result = PyObject_CallObject(usr_session_focused_cb, args);
303- if (result)
304- Py_DECREF(result);
305- else
306- PyErr_Print();
307- Py_DECREF(args);
308- }
309- PyGILState_Release(gstate);
310-}
311-
312-static void on_session_unfocused(ubuntu_ui_session_properties props, void*)
313-{
314- PyGILState_STATE gstate;
315- gstate = PyGILState_Ensure();
316- if (usr_session_unfocused_cb)
317- {
318- PyObject* args = get_arglist_dict_from_session_properties(props);
319- PyObject* result = PyObject_CallObject(usr_session_unfocused_cb, args);
320- if (result)
321- Py_DECREF(result);
322- else
323- PyErr_Print();
324- Py_DECREF(args);
325- }
326- PyGILState_Release(gstate);
327-}
328-
329-static void on_session_died(ubuntu_ui_session_properties props, void*)
330-{
331- PyGILState_STATE gstate;
332- gstate = PyGILState_Ensure();
333- if (usr_session_died_cb)
334- {
335- PyObject* args = get_arglist_dict_from_session_properties(props);
336- PyObject* result = PyObject_CallObject(usr_session_died_cb, args);
337- if (result)
338- Py_DECREF(result);
339- else
340- PyErr_Print();
341- Py_DECREF(args);
342- }
343- PyGILState_Release(gstate);
344-}
345-
346-static PyMethodDef UPAMethods[] = {
347- {"set_session_requested_callback", py_set_session_requested_cb, METH_VARARGS, "Set callback for 'session requested'."},
348- {"set_session_born_callback", py_set_session_born_cb, METH_VARARGS, "Set callback for 'session born'."},
349- {"set_session_focused_callback", py_set_session_focused_cb, METH_VARARGS, "Set callback for 'session focused'."},
350- {"set_session_unfocused_callback", py_set_session_unfocused_cb, METH_VARARGS, "Set callback for 'session unfocused'."},
351- {"set_session_died_callback", py_set_session_died_cb, METH_VARARGS, "Set callback for 'session died'."},
352- {"get_resolution", py_get_resolution, METH_VARARGS, "Get horizontal and verticle resolution."},
353- {"start_monitoring", py_start_monitoring, METH_VARARGS, "Start monitoring."},
354- {NULL, NULL, 0, NULL} /* Sentinel */
355-};
356-
357-
358-PyMODINIT_FUNC init_sf(void)
359-{
360- PyEval_InitThreads();
361- (void) Py_InitModule("_sf", UPAMethods);
362-}

Subscribers

People subscribed via source and target branches