Create an enum for different package types

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2017-11-20 20:31:49 +05:30 committed by James Valleroy
parent 0b1b8157e4
commit 590ba78f89
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
12 changed files with 39 additions and 23 deletions

View File

@ -17,6 +17,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Package
clients = [{ clients = [{
'name': 'name':
_('Deluge'), _('Deluge'),
@ -24,10 +26,10 @@ clients = [{
_('Bittorrent client written in Python/PyGTK '), _('Bittorrent client written in Python/PyGTK '),
'platforms': [{ 'platforms': [{
'type': 'web', 'type': 'web',
'relative_path': '/deluge' 'url': '/deluge'
}, { }, {
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'deluge', 'name': 'deluge',
}] }]
}] }]

View File

@ -18,7 +18,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.modules.jsxc import manifest as jsxc_manifest from plinth.modules.jsxc import manifest as jsxc_manifest
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package,
Store)
from plinth.utils import play_store_url from plinth.utils import play_store_url
yaxim_package_id = 'org.yaxim.androidclient' yaxim_package_id = 'org.yaxim.androidclient'
@ -86,7 +87,7 @@ _clients = [{
_('Gajim'), _('Gajim'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'gajim' 'name': 'gajim'
}, { }, {
'type': 'download', 'type': 'download',

View File

@ -18,7 +18,7 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth import cfg from plinth import cfg
from plinth.templatetags.plinth_extras import Desktop_OS from plinth.templatetags.plinth_extras import Desktop_OS, Package
from plinth.utils import format_lazy from plinth.utils import format_lazy
clients = [{ clients = [{
@ -34,10 +34,10 @@ clients = [{
'platforms': [{ 'platforms': [{
'type': 'download', 'type': 'download',
'os': Desktop_OS.WINDOWS.value, 'os': Desktop_OS.WINDOWS.value,
'url': 'http://releases.0x539.de/gobby/gobby-stable.exe' 'url': 'https://github.com/gobby/gobby/wiki/Download'
}, { }, {
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'gobby' 'name': 'gobby'
}] }]
}] }]

View File

@ -17,12 +17,14 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Package
clients = [{ clients = [{
'name': 'name':
_('JSXC'), _('JSXC'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'libjs-jsxc' 'name': 'libjs-jsxc'
}, { }, {
'type': 'web', 'type': 'web',

View File

@ -17,7 +17,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package,
Store)
clients = [{ clients = [{
'name': 'name':
@ -40,7 +41,7 @@ clients = [{
'url': 'https://f-droid.org/packages/net.minetest.minetest/ ' 'url': 'https://f-droid.org/packages/net.minetest.minetest/ '
}, { }, {
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'minetest' 'name': 'minetest'
}] }]
}] }]

View File

@ -17,7 +17,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package,
Store)
from plinth.utils import f_droid_url, play_store_url from plinth.utils import f_droid_url, play_store_url
plumble_package_id = 'com.morlunk.mumbleclient.free' plumble_package_id = 'com.morlunk.mumbleclient.free'
@ -35,7 +36,7 @@ clients = [{
'url': 'https://wiki.mumble.info/wiki/Main_Page' 'url': 'https://wiki.mumble.info/wiki/Main_Page'
}, { }, {
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'mumble' 'name': 'mumble'
}, { }, {
'type': 'store', 'type': 'store',

View File

@ -17,7 +17,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package,
Store)
from plinth.utils import play_store_url from plinth.utils import play_store_url
quasseldroid_package_id = 'com.iskrembilen.quasseldroid', quasseldroid_package_id = 'com.iskrembilen.quasseldroid',
@ -32,7 +33,7 @@ clients = [{
'url': quassel_download_url, 'url': quassel_download_url,
}, { }, {
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'quassel-client', 'name': 'quassel-client',
}] }]
}, { }, {

View File

@ -17,7 +17,7 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Mobile_OS, Store from plinth.templatetags.plinth_extras import Mobile_OS, Package, Store
from plinth.utils import play_store_url from plinth.utils import play_store_url
davdroid_package_id = 'at.bitfire.davdroid' davdroid_package_id = 'at.bitfire.davdroid'
@ -41,7 +41,7 @@ clients = [{
_('GNOME Calendar'), _('GNOME Calendar'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'gnome-calendar' 'name': 'gnome-calendar'
}] }]
}, { }, {
@ -59,7 +59,7 @@ clients = [{
'calendars and address books.'), 'calendars and address books.'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'evolution' 'name': 'evolution'
}] }]
}] }]

View File

@ -17,7 +17,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package,
Store)
from plinth.utils import play_store_url from plinth.utils import play_store_url
jitsi_package_id = 'org.jitsi.meet' jitsi_package_id = 'org.jitsi.meet'
@ -53,7 +54,7 @@ clients = [{
'url': jitsi_download_url 'url': jitsi_download_url
}, { }, {
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'jitsi' 'name': 'jitsi'
}, { }, {
'type': 'download', 'type': 'download',

View File

@ -17,7 +17,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package,
Store)
from plinth.utils import f_droid_url, play_store_url from plinth.utils import f_droid_url, play_store_url
syncthing_package_id = 'com.nutomic.syncthingandroid' syncthing_package_id = 'com.nutomic.syncthingandroid'
@ -28,11 +29,11 @@ clients = [{
_('Syncthing'), _('Syncthing'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'format': 'deb', 'format': Package.DEB.value,
'name': 'syncthing', 'name': 'syncthing',
}, { }, {
'type': 'package', 'type': 'package',
'format': 'homebrew', 'format': Package.HOMEBREW.value,
'name': 'syncthing', 'name': 'syncthing',
}, { }, {
'type': 'download', 'type': 'download',

View File

@ -170,7 +170,7 @@
{% if platform.type == 'package' and platform.format == 'deb' %} {% if platform.type == 'package' and platform.format == 'deb' %}
<li> <strong> Debian: </strong> {{ platform.name }} </li> <li> <strong> Debian: </strong> {{ platform.name }} </li>
{% endif %} {% endif %}
{% if platform.type == 'package' and platform.format == 'homebrew' %} {% if platform.type == 'package' and platform.format == 'brew' %}
<li> <strong> HomeBrew: </strong> {{ platform.name }} </li> <li> <strong> HomeBrew: </strong> {{ platform.name }} </li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -40,6 +40,12 @@ class Store(Enum):
GOOGLE_PLAY = 'google-play' GOOGLE_PLAY = 'google-play'
class Package(Enum):
DEB = 'deb'
HOMEBREW = 'brew'
RPM = 'rpm'
def enum_values(enum): def enum_values(enum):
return [x.value for x in list(enum)] return [x.value for x in list(enum)]