diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-12-10 17:55:10 -0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-12-10 17:55:10 -0200 |
commit | 3388334d61d4c30d2a68c740eb1d6d5122886f4f (patch) | |
tree | abd5212c916c8c51e3f96038086909f7e57965d2 | |
parent | added P/PN/PV to the description object. some tests are broken. (diff) | |
download | g-octave-3388334d61d4c30d2a68c740eb1d6d5122886f4f.tar.gz g-octave-3388334d61d4c30d2a68c740eb1d6d5122886f4f.tar.bz2 g-octave-3388334d61d4c30d2a68c740eb1d6d5122886f4f.zip |
added P/PN/PV to the svn description files, and added CAT
-rw-r--r-- | g_octave/description.py | 11 | ||||
-rw-r--r-- | tests/test_description.py | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/g_octave/description.py b/g_octave/description.py index 243a231..bb9a867 100644 --- a/g_octave/description.py +++ b/g_octave/description.py @@ -58,6 +58,9 @@ class Description(object): P = None PN = None PV = None + CAT = None + + _categories = ['main', 'extra', 'language', 'nonfree'] def __init__(self, file, parse_sysreq=True): @@ -76,6 +79,10 @@ class Description(object): self.PN = my_atom.group(2) self.PV = my_atom.group(3) + file_parts = self._file.split(os.sep) + if len(file_parts) >= 3 and file_parts[-3] in self._categories: + self.CAT = file_parts[-3] + # dictionary with the parsed content of the DESCRIPTION file self._desc = dict() @@ -300,4 +307,8 @@ class SvnDescription(Description): except: raise DescriptionException('Failed to fetch DESCRIPTION file from SVN') Description.__init__(self, temp_desc) + self.PN = package + self.PV = '9999' + self.P = '%s-%s' % (self.PN, self.PV) + self.CAT = category os.unlink(temp_desc) diff --git a/tests/test_description.py b/tests/test_description.py index 3688dd1..980b807 100644 --- a/tests/test_description.py +++ b/tests/test_description.py @@ -183,6 +183,7 @@ class TestDescription(testcase.TestCase): self.assertEqual(self.desc.P, 'pkg-0.0.1') self.assertEqual(self.desc.PN, 'pkg') self.assertEqual(self.desc.PV, '0.0.1') + self.assertEqual(self.desc.CAT, None) requirements = [ '<g-octave/pkg12-1.2.3', |