[jhbuild/desrt/master: 15/22] packagedb: move from_xml method
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/desrt/master: 15/22] packagedb: move from_xml method
- Date: Mon, 19 Jan 2015 03:36:47 +0000 (UTC)
commit cc45b55baedd45c61258ef7b01719effe7a3d835
Author: Ryan Lortie <desrt desrt ca>
Date: Sun Jan 18 10:08:02 2015 -0500
packagedb: move from_xml method
Earlier patches put methods in an illogical order. Fix that up so that
the to/from xml functions are together at the bottom.
Sorry for the noise.
https://bugzilla.gnome.org/show_bug.cgi?id=743127
jhbuild/utils/packagedb.py | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/jhbuild/utils/packagedb.py b/jhbuild/utils/packagedb.py
index b698e33..e7160cb 100644
--- a/jhbuild/utils/packagedb.py
+++ b/jhbuild/utils/packagedb.py
@@ -76,23 +76,6 @@ class PackageEntry:
manifest = property(get_manifest, set_manifest)
- @classmethod
- def from_xml(cls, node, manifests_dir):
- package = node.attrib['package']
- version = node.attrib['version']
- metadata = {}
-
- installed_string = node.attrib['installed']
- if installed_string:
- metadata['installed-date'] = _parse_isotime(installed_string)
- configure_hash = node.attrib.get('configure-hash')
- if configure_hash:
- metadata['configure-hash'] = configure_hash
-
- dbentry = cls(package, version, metadata, manifests_dir)
-
- return dbentry
-
def write(self):
writer = fileutils.SafeWriter(os.path.join(self.manifests_dir, self.package))
writer.fp.write('\n'.join(self.manifest) + '\n')
@@ -112,6 +95,24 @@ class PackageEntry:
return entry_node
+ @classmethod
+ def from_xml(cls, node, manifests_dir):
+ package = node.attrib['package']
+ version = node.attrib['version']
+ metadata = {}
+
+ installed_string = node.attrib['installed']
+ if installed_string:
+ metadata['installed-date'] = _parse_isotime(installed_string)
+ configure_hash = node.attrib.get('configure-hash')
+ if configure_hash:
+ metadata['configure-hash'] = configure_hash
+
+ dbentry = cls(package, version, metadata, manifests_dir)
+
+ return dbentry
+
+
class PackageDB:
def __init__(self, dbfile, config):
self.dbfile = dbfile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]