summaryrefslogtreecommitdiff
path: root/portato/eix
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-08-14 17:13:19 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-08-14 17:13:19 +0200
commitd041a06226aec18308b846bd90ef99a744367f3e (patch)
treed95ef06eaddb694793f3db52d31551ee59feacc4 /portato/eix
parentb8197fa83d32be76327bb00da29081a10979339d (diff)
downloadportato-d041a06226aec18308b846bd90ef99a744367f3e.tar.gz
portato-d041a06226aec18308b846bd90ef99a744367f3e.tar.bz2
portato-d041a06226aec18308b846bd90ef99a744367f3e.zip
Add package and category objects
Diffstat (limited to '')
-rw-r--r--portato/eix/parser.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/portato/eix/parser.py b/portato/eix/parser.py
index 44c4214..ac49789 100644
--- a/portato/eix/parser.py
+++ b/portato/eix/parser.py
@@ -14,11 +14,10 @@ from __future__ import absolute_import, with_statement
import os
import struct
-
-from ..helper import debug
from functools import partial
-from . import exceptions as ex
+from ..helper import debug
+from .exceptions import EndOfFileException
def _get_bytes (file, length, expect_list = False):
s = file.read(length)
@@ -137,3 +136,30 @@ class header (object):
self.useflags = LE(typed_vector(string))
self.slots = LE(typed_vector(string))
self.sets = LE(typed_vector(string))
+
+class package (object):
+ def __init__ (self, file, skip = False):
+ def LE (t):
+ return LazyElement(t, file)
+
+ self.offset = number(file)
+
+ after_offset = file.tell()
+
+ self.name = LE(string)
+ self.description = LE(string)
+ self.provide = LE(typed_vector(number))
+ self.homepage = LE(string)
+ self.license = LE(number)
+ self.useflags = LE(typed_vector(number))
+
+ # self.versions = LE(typed_vector(version))
+ # for the moment just skip the versions
+ file.seek(self.offset - (file.tell() - after_offset), os.SEEK_CUR)
+
+class category (object):
+ __slots__ = ("name", "packages")
+
+ def __init__ (self, file, skip = False):
+ self.name = LazyElement(string, file)
+ self.packages = LazyElement(typed_vector(package), file)