commit:     8133bd98d60e3e1ed38fa75662ae9b070a156336
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 21 16:37:53 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 16:37:53 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=8133bd98

overlay.py: Adds optional license attribute to overlay object

 layman/overlays/overlay.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index c6a0cee..8f31a76 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -237,6 +237,11 @@ class Overlay(object):
         else:
             self.priority = 50
 
+        if 'license' in overlay:
+            self.license = encode(overlay['license'])
+        else:
+            self.license = None
+
         if 'homepage' in overlay:
             self.homepage = encode(overlay['homepage'])
         else:
@@ -352,6 +357,11 @@ class Overlay(object):
         else:
             self.priority = 50
 
+        if '@license' in json:
+            self.license = encode(json['@license'])
+        else:
+            self.license = None
+
         if 'homepage' in json:
             self.homepage = encode(json['homepage'])
         else:
@@ -486,6 +496,11 @@ class Overlay(object):
         else:
             self.priority = 50
 
+        if 'license' in xml.attrib:
+            self.license = encode(xml.attrib['license'])
+        else:
+            self.license = None
+
         h = xml.find('homepage')
         l = xml.find('link')
 
@@ -641,6 +656,8 @@ class Overlay(object):
         repo['@quality'] = self.quality
         if self.status != None:
             repo['@status'] = self.status
+        if self.license != None:
+            repo['@license'] = self.license
         repo['name'] = self.name
         repo['description'] = []
         for i in self.descriptions:
@@ -677,6 +694,8 @@ class Overlay(object):
             repo.attrib['status'] = self.status
         repo.attrib['quality'] = self.quality
         repo.attrib['priority'] = str(self.priority)
+        if self.license != None:
+            repo.attrib['license'] = self.license
         name = ET.Element('name')
         name.text = self.name
         repo.append(name)

Reply via email to