Code review comment for lp:~doanac/phablet-tools/click-x86

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

> On 05/14/2014 09:39 AM, Sergio Schvezov wrote:
> > How about using 'adb shell dpkg --print-architecture's result as another key
> entry to lookup in the map? Just in case we add some other arch sooner than
> later
>
> can you elaborate? I'm not sure I understand what you are saying here.

I guess I was too sleepy when I commented on this :-/

    arch = adb.shell('dpkg --print-architecture').strip()

But instead of constructing the 'key' from appending two strings, a map from the arches seems cleaner:

basic_packages = (
    {'source': 'unity8', 'binary': 'unity8'},
    {'source': 'ubuntu-ui-toolkit',
     'binary': {'armhf': 'qtdeclarative5-ubuntu-ui-toolkit-plugin',
                'i386': 'qtdeclarative5-ubuntu-ui-toolkit-plugin-gles'})

But this is just a hassle for the case where they are the same, so this could work:

basic_packages = (
    {'source': 'unity8', 'binary': {'all': 'unity8'}},
    {'source': 'ubuntu-ui-toolkit',
     'binary': {'armhf': 'qtdeclarative5-ubuntu-ui-toolkit-plugin',
                'i386': 'qtdeclarative5-ubuntu-ui-toolkit-plugin-gles'}})

then when looping over basic_packages just

binary = p['binary'][arch] if arch in p['binary'] else p['binary']['all']

or something like that

« Back to merge proposal