summaryrefslogtreecommitdiff
path: root/config.py
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-08 13:26:54 -0600
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-08 13:26:54 -0600
commit2cae61ff561561e405f0cd0c150dbcd77ce25b82 (patch)
tree176cb99305d56348eaff771a1dfe266ea6dce2ac /config.py
parentd9ac9d17a92607b09fb9afa91ff96aeae38dbdf3 (diff)
config py:
* Make Package class init, restrict keys. filter.py * Corrected function * Added generate_rsync_exclude
Diffstat (limited to 'config.py')
-rw-r--r--config.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/config.py b/config.py
index 6206607..bd8ef1b 100644
--- a/config.py
+++ b/config.py
@@ -47,15 +47,21 @@ class NonValidCommand(ValueError): pass
class Package:
""" An object that has information about a package. """
- package_info={ "name" : False,
- "version" : False,
- "release" : False,
- "arch" : False,
- "license" : False,
- "location": False}
+ package_info=dict()
+ def __init__(self):
+ self.package_info={ "name" : False,
+ "version" : False,
+ "release" : False,
+ "arch" : False,
+ "license" : False,
+ "location": False}
+
def __setitem__(self, key, item):
- return self.package_info.__setitem__(key, item)
+ if key in self.package_info.keys():
+ return self.package_info.__setitem__(key, item)
+ else:
+ raise ValueError("Package has no %s attribute" % key)
def __getitem__(self, key):
return self.package_info.__getitem__(key)
@@ -63,4 +69,15 @@ class Package:
def __unicode__(self):
return str(self.package_info)
+ def __repr__(self):
+ return str(self.package_info)
+
+ def __eq__(self,x):
+ if not isinstance(x, Package):
+ return False
+ for key in self.package_info.keys():
+ if x[key] != self[key]:
+ return False
+ else:
+ return True