[Pkg-privacy-commits] [tails-installer] 116/210: Data dictionary structural changes to get rid of redundancy with more architectures in one release
Intrigeri
intrigeri at moszumanska.debian.org
Wed May 24 15:26:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to tag 3.90.0
in repository tails-installer.
commit 318e2c1a90737754c380fc5eaa4872e7b9a4661f
Author: Martin Briza <mbriza at redhat.com>
Date: Tue Jul 7 17:37:18 2015 +0200
Data dictionary structural changes to get rid of redundancy with more architectures in one release
---
liveusb/components/ImageDetails.qml | 2 +-
liveusb/creator.py | 14 --------
liveusb/gui.py | 65 +++++++++----------------------------
liveusb/releases.py | 62 ++++++++++++++++++-----------------
4 files changed, 48 insertions(+), 95 deletions(-)
diff --git a/liveusb/components/ImageDetails.qml b/liveusb/components/ImageDetails.qml
index 113ffd3..29d3ce5 100644
--- a/liveusb/components/ImageDetails.qml
+++ b/liveusb/components/ImageDetails.qml
@@ -116,7 +116,7 @@ Item {
}
}
Text {
- text: liveUSBData.currentImage.arch
+ text: liveUSBData.releaseProxyModel.archFilter
color: "gray"
AdwaitaButton {
diff --git a/liveusb/creator.py b/liveusb/creator.py
index 85505be..0e55822 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -679,25 +679,11 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
self.callbackAdded()
def handleRemoved(path, interfaces):
-
- print ("KEYS!", path, self.drives.keys())
if self.drives.has_key(path):
- print("PRE REMOVED", path, interfaces)
del self.drives[path]
- print("POST REMOVED", path, interfaces)
if self.callbackRemoved:
self.callbackRemoved()
- #blk = device['org.freedesktop.UDisks2.Block']
- #if path.startswith("/org/freedesktop/UDisks2"):
-
- #if 'org.freedesktop.UDisks2.Block' in interfaces:
- #object = self.bus.get_object("org.freedesktop.UDisks2", path)
- #device = dbus.Interface(object, "org.freedesktop.UDisks2.Block").GetAll("Drive")
- #print device
- #print("FOUND:", device['org.freedesktop.UDisks2.Block'])
- #print("GOT:", self.drives.keys())
- #callbackRemoved()
self.bus.add_signal_receiver(handleAdded, "InterfacesAdded", "org.freedesktop.DBus.ObjectManager", "org.freedesktop.UDisks2", "/org/freedesktop/UDisks2")
self.bus.add_signal_receiver(handleRemoved, "InterfacesRemoved", "org.freedesktop.DBus.ObjectManager", "org.freedesktop.UDisks2", "/org/freedesktop/UDisks2")
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 5da2857..e6eb592 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -86,6 +86,7 @@ class ReleaseDownloadThread(QThread):
home = os.getenv('HOME', 'USERPROFILE')
filename = os.path.basename(urlparse.urlparse(self.url).path)
try:
+ print self.url
iso = self.grabber.urlgrab(self.url, reget='simple')
except URLGrabError, e:
# TODO find out if this errno is _really_ benign
@@ -437,52 +438,12 @@ class Release(QObject):
self.liveUSBData = parent
self._data = data
- """
- self._name = name.replace('_', ' ')
- self._logo = logo
- self._size = size
- self._arch = arch
- self._fullName = fullName
- self._releaseDate = releaseDate
- self._summary = summary
- self._fullDescription = fullDescription
- self._isLocal = isLocal
- self._screenshots = screenshots
- self._url = url
- """
-
self._path = ''
self._info = []
self._warning = []
self._error = []
- """
- if self._logo == '':
- if self._name == 'Fedora Workstation':
- self._logo = 'qrc:/logo-color-workstation.png'
- elif self._name == 'Fedora Server':
- self._logo = 'qrc:/logo-color-server.png'
- elif self._name == 'Fedora Cloud':
- self._logo = 'qrc:/logo-color-cloud.png'
- elif self._name == 'Fedora KDE':
- self._logo = 'qrc:/logo-plasma5.png'
- elif self._name == 'Fedora Xfce':
- self._logo = 'qrc:/logo-xfce.svg'
- elif self._name == 'Fedora LXDE':
- self._logo = 'qrc:/logo-lxde.png'
- else:
- self._logo = 'qrc:/logo-fedora.svg'
-
- if self._name == 'Fedora Workstation':
- self._fullDescription = _('Fedora Workstation is a reliable, user-friendly, and powerful operating system for your laptop or desktop computer. It supports a wide range of developers, from hobbyists and students to professionals in corporate environments.')
- if self._name == 'Fedora Server':
- self._fullDescription = _('Fedora Server is a powerful, flexible operating system that includes the best and latest datacenter technologies. It puts you in control of all your infrastructure and services.')
- if self._name == 'Fedora Cloud':
- self._fullDescription = _('Fedora Cloud provides a minimal image of Fedora for use in public and private cloud environments. It includes just the bare essentials, so you get enough to run your cloud application -- and nothing more.')
-
- """
-
self._download = ReleaseDownload(self)
self._download.pathChanged.connect(self.pathChanged)
@@ -565,17 +526,19 @@ class Release(QObject):
@pyqtProperty(float, notify=sizeChanged)
def size(self):
- return self._data['size']
+ if 'x86_64' in self._data['variants'].keys():
+ return self._data['variants']['x86_64']['size']
+ return self._data['variants']['']['size']
@size.setter
def size(self, value):
if value != self._size:
- self._data['size'] = value
+ self._data['x86_64']['size'] = value
self.sizeChanged.emit()
@pyqtProperty(str, constant=True)
def arch(self):
- return self._data['arch']
+ return self._data['variants'].keys()
@pyqtProperty(QDateTime, constant=True)
def releaseDate(self):
@@ -599,7 +562,9 @@ class Release(QObject):
@pyqtProperty(str, constant=True)
def url(self):
- return self._data['url']
+ if 'x86_64' in self._data['variants'].keys():
+ return self._data['variants']['x86_64']['url']
+ return self._data['variants']['']['url']
@pyqtProperty(str, notify=pathChanged)
def path(self):
@@ -702,7 +667,7 @@ class ReleaseListProxy(QSortFilterProxyModel):
_nameFilter = ''
_frontPage = True
- _archMap = {'64bit': ['x86_64'], '32bit': ['i686','i386']}
+ _archMap = {'64bit': ['x86_64'], '32bit': ['i686','i386'], 'ARM': ['armv7hl']}
def __init__(self, parent, sourceModel):
QSortFilterProxyModel.__init__(self, parent)
@@ -715,7 +680,7 @@ class ReleaseListProxy(QSortFilterProxyModel):
def filterAcceptsRow(self, sourceRow, sourceParent):
row = self.sourceModel().index(sourceRow, 0, sourceParent).data()
- if len(self._archFilter) == 0 or row.arch.lower() in [x.lower() for x in self._archFilter] or row.isLocal:
+ if len(self._archFilter) == 0 or row.isLocal or set(row.arch) & set(self._archFilter):
if len(self._nameFilter) == 0 or self._nameFilter.lower() in row.name.lower() or self._nameFilter.lower() in row.summary.lower():
return True
return False
@@ -870,6 +835,7 @@ class LiveUSBData(QObject):
for i, drive in enumerate(self._usbDrives):
if drive.drive['device'] == previouslySelected:
self.currentDrive = i
+ self.currentDriveChanged.emit()
@pyqtProperty(ReleaseListModel, notify=releasesChanged)
def releaseModel(self):
@@ -910,14 +876,13 @@ class LiveUSBData(QObject):
@currentDrive.setter
def currentDrive(self, value):
if len(self._usbDrives) == 0:
+ self.live.drive = None
self._currentDrive = -1
self.currentDriveChanged.emit()
- self.live.drive = None
return
- if value > len(self._usbDrives):
+ elif value > len(self._usbDrives):
value = 0
- print ("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", value, len(self._usbDrives))
- if self._currentDrive != value or self.live.drives[self.live.drive]['device'] != self._usbDrives[value].drive['device']:
+ if self._currentDrive != value:# or not self.live.drive or self.live.drives[self.live.drive]['device'] != self._usbDrives[value].drive['device']:
self._currentDrive = value
if len(self._usbDrives) > 0:
self.live.drive = self._usbDrives[self._currentDrive].drive['device']
diff --git a/liveusb/releases.py b/liveusb/releases.py
index 7c034ed..b75fe2e 100644
--- a/liveusb/releases.py
+++ b/liveusb/releases.py
@@ -47,16 +47,17 @@ def getSpinDetails(url, source):
d = pyquery.PyQuery(urlread(url))
spin = {
'name': '',
- 'description': '',
- 'screenshots': [],
- 'logo': 'qrc:/logo-fedora.svg',
- 'url': '',
'summary': '',
- 'sha256': '',
- 'size': 0,
+ 'description': '',
'releaseDate': '',
+ 'logo': 'qrc:/logo-fedora.svg',
+ 'screenshots': [],
'source': '',
- 'arch': 'x86_64'
+ 'variants': dict()
+ #{'x86_64': {
+ # 'url': '',
+ # 'sha256': '',
+ # 'size': 0}}
}
spin['source'] = source
@@ -72,10 +73,12 @@ def getSpinDetails(url, source):
spin['description'] += line
download = getDownload(url + "/.." + d('a.btn').attr('href'))
- spin['url'] = download
- spin['sha256'] = getSHA(download)
- spin['arch'] = getArch(download)
- spin['release'] = getRelease(download)
+ spin['variants'][getArch(download)] = dict(
+ url = download,
+ sha256 = getSHA(download),
+ size = 0
+ )
+ #spin['release'] = getRelease(download)
return spin
@@ -95,16 +98,17 @@ def getProductDetails(url, name):
d = pyquery.PyQuery(urlread(url))
product = {
'name': '',
- 'description': '',
- 'screenshots': [],
- 'logo': 'qrc:/logo-fedora.svg',
- 'url': '',
'summary': '',
- 'sha256': '',
- 'size': 0,
+ 'description': '',
'releaseDate': '',
+ 'logo': 'qrc:/logo-fedora.svg',
+ 'screenshots': [],
'source': '',
- 'arch': 'x86_64'
+ 'variants': dict()
+ #{'x86_64': {
+ # 'url': '',
+ # 'sha256': '',
+ # 'size': 0}}
}
product['name'] = name
product['source'] = name
@@ -131,12 +135,13 @@ def getProductDetails(url, name):
if name == "Server":
product['logo'] = 'qrc:/logo-color-server.png'
- if d('a.btn-success'):
- download = getDownload(url + "/" + d('a.btn-success').attr('href'))
- product['url'] = download
- product['sha256'] = getSHA(download)
- product['arch'] = getArch(download)
- product['release'] = getRelease(download)
+ download = getDownload(url + "/download")
+ product['variants'][getArch(download)] = dict(
+ url = download,
+ sha256 = getSHA(download),
+ size = 0
+ )
+ #product['release'] = getRelease(download)
return product
@@ -163,13 +168,10 @@ def get_fedora_flavors():
'description': _('Here you can choose a OS image from your hard drive to be written to your flash disk'),
'logo': 'qrc:/icon-folder.svg',
'screenshots': [],
- 'url': '',
- 'summary': _('<pick from file chooser>'),
- 'sha256': '',
- 'size': 0,
+ 'summary': _('Pick a file from your drive(s)'),
'releaseDate': '',
'source': 'Local',
- 'arch': ''}]
+ 'variants': {'': dict(url='', sha256='', size=0)}}]
releases += getProducts('https://getfedora.org/')
releases += getSpins("http://spins.fedoraproject.org", "Spins")
releases += getSpins("http://labs.fedoraproject.org", "Labs")
@@ -278,6 +280,6 @@ def get_fedora_releases():
return releases
# A backup list of releases, just in case we can't fetch them.
-fedora_releases = [{'description': u'Here you can choose a OS image from your hard drive to be written to your flash disk', 'releaseDate': '', 'logo': 'qrc:/icon-folder.svg', 'screenshots': [], 'size': 0, 'name': u'Custom OS...', 'url': '', 'arch': '', 'summary': u'<pick from file chooser>', 'source': 'Local', 'sha256': ''}, {'description': "<p>Fedora Workstation is a reliable, user-friendly, and powerful operating system for your laptop or desktop computer. It supports a wide range of d [...]
+fedora_releases = [{'releaseDate': '', 'source': 'Local', 'name': u'Custom OS...', 'logo': 'qrc:/icon-folder.svg', 'variants': {'': {'url': '', 'sha256': '', 'size': 0}}, 'summary': u'Pick a file from your drive(s)', 'screenshots': [], 'description': u'Here you can choose a OS image from your hard drive to be written to your flash disk'}, {'releaseDate': '', 'source': 'Workstation', 'name': 'Workstation', 'logo': 'qrc:/logo-color-workstation.png', 'description': "<p>Fedora Workstation is [...]
releases = fedora_releases
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git
More information about the Pkg-privacy-commits
mailing list