1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Distribution Indexes
=====================
An ``Index`` is conceptually a set of ``Distribution`` objects, with some
additional behavior for managing the set as a whole.
.. doctest::
>>> from pkginfo import Distribution
>>> from pkginfo import Index
>>> index = Index()
>>> list(index)
[]
>>> d1 = Distribution()
>>> d1.name = 'foo'
>>> d1.version = '1.0'
>>> index.add(d1)
>>> list(index)
['foo-1.0']
>>> d2 = Distribution()
>>> d2.name = 'foo'
>>> d2.version = '1.1'
>>> index.add(d2)
>>> sorted(list(index))
['foo-1.0', 'foo-1.1']
|