Merge ~jugmac00/launchpad:improve-readability-of-distribution.rst into launchpad:master

Proposed by Jürgen Gmach
Status: Merged
Approved by: Jürgen Gmach
Approved revision: 49620c0571a41549276cee94b820881e03bb9abe
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~jugmac00/launchpad:improve-readability-of-distribution.rst
Merge into: launchpad:master
Diff against target: 269 lines (+41/-41)
1 file modified
lib/lp/registry/doc/distribution.rst (+41/-41)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+429694@code.launchpad.net

Commit message

Improve readability of `distribution.rst`

Description of the change

- explain abbreviation
- use double quotes in doctests

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/lib/lp/registry/doc/distribution.rst b/lib/lp/registry/doc/distribution.rst
index e21f674..b57b1ed 100644
--- a/lib/lp/registry/doc/distribution.rst
+++ b/lib/lp/registry/doc/distribution.rst
@@ -44,15 +44,15 @@ can be used to look up distributions by their aliases too.
44 gentoo44 gentoo
4545
46 # Need to login as an LP admin to set a project's aliases.46 # Need to login as an LP admin to set a project's aliases.
47 >>> login('foo.bar@canonical.com')47 >>> login("foo.bar@canonical.com")
48 >>> gentoo.setAliases(['jackass'])48 >>> gentoo.setAliases(["jackass"])
49 >>> for alias in gentoo.aliases:49 >>> for alias in gentoo.aliases:
50 ... print(alias)50 ... print(alias)
51 jackass51 jackass
52 >>> login(ANONYMOUS)52 >>> login(ANONYMOUS)
53 >>> print(distroset['jackass'].name)53 >>> print(distroset["jackass"].name)
54 gentoo54 gentoo
55 >>> print(distroset.getByName('jackass').name)55 >>> print(distroset.getByName("jackass").name)
56 gentoo56 gentoo
5757
58Let's make sure a distribution object properly implements its interfaces.58Let's make sure a distribution object properly implements its interfaces.
@@ -87,7 +87,7 @@ have a SourcePackageName object for it.
87 >>> from lp.soyuz.model.sourcepackagerelease import (87 >>> from lp.soyuz.model.sourcepackagerelease import (
88 ... SourcePackageRelease)88 ... SourcePackageRelease)
89 >>> sourcepackagerelease = SourcePackageRelease.selectOneBy(89 >>> sourcepackagerelease = SourcePackageRelease.selectOneBy(
90 ... sourcepackagenameID=evo.id, version='1.0')90 ... sourcepackagenameID=evo.id, version="1.0")
91 >>> print(sourcepackagerelease.name)91 >>> print(sourcepackagerelease.name)
92 evolution92 evolution
9393
@@ -181,9 +181,9 @@ Searching for DistributionSourcePackages
181........................................181........................................
182182
183The distribution also allows you to look for source packages that match183The distribution also allows you to look for source packages that match
184a certain string through the magic of fti. For instance:184a certain string through the magic of full text indexing (fti). For instance:
185185
186 >>> packages = ubuntu.searchSourcePackageCaches(u"mozilla")186 >>> packages = ubuntu.searchSourcePackageCaches("mozilla")
187 >>> for distro_source_package_cache, source_name, rank in packages:187 >>> for distro_source_package_cache, source_name, rank in packages:
188 ... print("%-17s rank:%s" % (188 ... print("%-17s rank:%s" % (
189 ... distro_source_package_cache.name,189 ... distro_source_package_cache.name,
@@ -193,10 +193,10 @@ a certain string through the magic of fti. For instance:
193The search also matches on exact package names which fti doesn't like,193The search also matches on exact package names which fti doesn't like,
194and even on substrings:194and even on substrings:
195195
196 >>> packages = ubuntu.searchSourcePackageCaches(u"linux-source-2.6.15")196 >>> packages = ubuntu.searchSourcePackageCaches("linux-source-2.6.15")
197 >>> print(packages.count())197 >>> print(packages.count())
198 1198 1
199 >>> packages = ubuntu.searchSourcePackageCaches(u'a')199 >>> packages = ubuntu.searchSourcePackageCaches("a")
200 >>> for distro_source_package_cache, source_name, rank in packages:200 >>> for distro_source_package_cache, source_name, rank in packages:
201 ... print("%s: %-17s rank:%s" % (201 ... print("%s: %-17s rank:%s" % (
202 ... distro_source_package_cache.__class__.__name__,202 ... distro_source_package_cache.__class__.__name__,
@@ -211,7 +211,7 @@ and even on substrings:
211The searchSourcePackages() method just returns a decorated version211The searchSourcePackages() method just returns a decorated version
212of the results from searchSourcePackageCaches():212of the results from searchSourcePackageCaches():
213213
214 >>> packages = ubuntu.searchSourcePackages(u'a')214 >>> packages = ubuntu.searchSourcePackages("a")
215 >>> for dsp in packages:215 >>> for dsp in packages:
216 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))216 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
217 DistributionSourcePackage: alsa-utils217 DistributionSourcePackage: alsa-utils
@@ -225,13 +225,13 @@ it just passes on to searchSourcePackageCaches(), and it restricts
225the results based on whether the source package has an entry225the results based on whether the source package has an entry
226in the Packaging table linking it to an upstream project.226in the Packaging table linking it to an upstream project.
227227
228 >>> packages = ubuntu.searchSourcePackages(u'a', has_packaging=True)228 >>> packages = ubuntu.searchSourcePackages("a", has_packaging=True)
229 >>> for dsp in packages:229 >>> for dsp in packages:
230 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))230 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
231 DistributionSourcePackage: alsa-utils231 DistributionSourcePackage: alsa-utils
232 DistributionSourcePackage: mozilla-firefox232 DistributionSourcePackage: mozilla-firefox
233 DistributionSourcePackage: netapplet233 DistributionSourcePackage: netapplet
234 >>> packages = ubuntu.searchSourcePackages(u'a', has_packaging=False)234 >>> packages = ubuntu.searchSourcePackages("a", has_packaging=False)
235 >>> for dsp in packages:235 >>> for dsp in packages:
236 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))236 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
237 DistributionSourcePackage: commercialpackage237 DistributionSourcePackage: commercialpackage
@@ -243,7 +243,7 @@ results based on whether the source package has an entry in the
243SourcePackagePublishingHistory table for the given distroseries.243SourcePackagePublishingHistory table for the given distroseries.
244244
245 >>> packages = ubuntu.searchSourcePackages(245 >>> packages = ubuntu.searchSourcePackages(
246 ... u'a', publishing_distroseries=ubuntu.currentseries)246 ... "a", publishing_distroseries=ubuntu.currentseries)
247 >>> for dsp in packages:247 >>> for dsp in packages:
248 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))248 ... print("%s: %s" % (dsp.__class__.__name__, dsp.name))
249 DistributionSourcePackage: alsa-utils249 DistributionSourcePackage: alsa-utils
@@ -262,7 +262,7 @@ Searching for an exact match on a valid binary name returns the
262expected results:262expected results:
263263
264 >>> results = ubuntu.searchBinaryPackages(264 >>> results = ubuntu.searchBinaryPackages(
265 ... u"mozilla-firefox", exact_match=True)265 ... "mozilla-firefox", exact_match=True)
266 >>> for result in results:266 >>> for result in results:
267 ... print(result.name)267 ... print(result.name)
268 mozilla-firefox268 mozilla-firefox
@@ -270,13 +270,13 @@ expected results:
270An exact match search with no matches on any package name returns270An exact match search with no matches on any package name returns
271an empty result set:271an empty result set:
272272
273 >>> results = ubuntu.searchBinaryPackages(u"mozilla", exact_match=True)273 >>> results = ubuntu.searchBinaryPackages("mozilla", exact_match=True)
274 >>> results.count()274 >>> results.count()
275 0275 0
276276
277Loosening to substring matches gives another result:277Loosening to substring matches gives another result:
278278
279 >>> results = ubuntu.searchBinaryPackages(u"mozilla", exact_match=False)279 >>> results = ubuntu.searchBinaryPackages("mozilla", exact_match=False)
280 >>> print(results[0])280 >>> print(results[0])
281 <...DistributionSourcePackageCache instance ...281 <...DistributionSourcePackageCache instance ...
282282
@@ -290,7 +290,7 @@ Loosening to substring matches gives another result:
290The results of searchBinaryPackages() are simply ordered alphabetically290The results of searchBinaryPackages() are simply ordered alphabetically
291for the moment until we have a better FTI rank to order with.291for the moment until we have a better FTI rank to order with.
292292
293 >>> results = ubuntu.searchBinaryPackages(u"m")293 >>> results = ubuntu.searchBinaryPackages("m")
294 >>> for result in results:294 >>> for result in results:
295 ... print(result.name)295 ... print(result.name)
296 mozilla-firefox296 mozilla-firefox
@@ -307,14 +307,14 @@ we need some way to decompose that into the distroseries and the pocket.
307Distribution can do that for us.307Distribution can do that for us.
308308
309If we ask for a totally unknown distroseries, we raise NotFoundError309If we ask for a totally unknown distroseries, we raise NotFoundError
310 >>> ubuntu.getDistroSeriesAndPocket('unknown')310 >>> ubuntu.getDistroSeriesAndPocket("unknown")
311 Traceback (most recent call last):311 Traceback (most recent call last):
312 ...312 ...
313 lp.app.errors.NotFoundError: ...'unknown'313 lp.app.errors.NotFoundError: ...'unknown'
314314
315If we ask for a plain distroseries, it should come back with the RELEASE315If we ask for a plain distroseries, it should come back with the RELEASE
316pocket as the pocket.316pocket as the pocket.
317 >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary')317 >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary")
318 >>> print(dr.name)318 >>> print(dr.name)
319 hoary319 hoary
320 >>> print(pocket.name)320 >>> print(pocket.name)
@@ -322,14 +322,14 @@ pocket as the pocket.
322322
323If we ask for a security pocket in a known distroseries it should come out323If we ask for a security pocket in a known distroseries it should come out
324on the other side.324on the other side.
325 >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary-security')325 >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary-security")
326 >>> print(dr.name)326 >>> print(dr.name)
327 hoary327 hoary
328 >>> print(pocket.name)328 >>> print(pocket.name)
329 SECURITY329 SECURITY
330330
331Find the backports pocket, too:331Find the backports pocket, too:
332 >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary-backports')332 >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary-backports")
333 >>> print(dr.name)333 >>> print(dr.name)
334 hoary334 hoary
335 >>> print(pocket.name)335 >>> print(pocket.name)
@@ -337,7 +337,7 @@ Find the backports pocket, too:
337337
338If we ask for a valid distroseries which doesn't have a given pocket it should338If we ask for a valid distroseries which doesn't have a given pocket it should
339raise NotFoundError for us339raise NotFoundError for us
340 >>> ubuntu.getDistroSeriesAndPocket('hoary-bullshit')340 >>> ubuntu.getDistroSeriesAndPocket("hoary-bullshit")
341 Traceback (most recent call last):341 Traceback (most recent call last):
342 ...342 ...
343 lp.app.errors.NotFoundError: ...'hoary-bullshit'343 lp.app.errors.NotFoundError: ...'hoary-bullshit'
@@ -444,7 +444,7 @@ Gentoo only uses Malone
444Launchpad admins and the distro owner can set these fields.444Launchpad admins and the distro owner can set these fields.
445445
446 >>> from lp.app.enums import ServiceUsage446 >>> from lp.app.enums import ServiceUsage
447 >>> login('mark@example.com')447 >>> login("mark@example.com")
448 >>> debian = getUtility(ILaunchpadCelebrities).debian448 >>> debian = getUtility(ILaunchpadCelebrities).debian
449 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD449 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
450 >>> print(debian.blueprints_usage.name)450 >>> print(debian.blueprints_usage.name)
@@ -465,7 +465,7 @@ Launchpad admins and the distro owner can set these fields.
465465
466But others can't.466But others can't.
467467
468 >>> login('no-priv@canonical.com')468 >>> login("no-priv@canonical.com")
469 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD469 >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD
470 Traceback (most recent call last):470 Traceback (most recent call last):
471 zope.security.interfaces.Unauthorized:471 zope.security.interfaces.Unauthorized:
@@ -549,23 +549,23 @@ And if we ask just for specs, we get the incomplete ones.
549549
550We can filter for specifications that contain specific text:550We can filter for specifications that contain specific text:
551551
552 >>> for spec in kubuntu.specifications(None, filter=[u'package']):552 >>> for spec in kubuntu.specifications(None, filter=["package"]):
553 ... print(spec.name)553 ... print(spec.name)
554 revu554 revu
555555
556We can get only valid specs (those that are not obsolete or superseded):556We can get only valid specs (those that are not obsolete or superseded):
557557
558 >>> from lp.blueprints.enums import SpecificationDefinitionStatus558 >>> from lp.blueprints.enums import SpecificationDefinitionStatus
559 >>> login('mark@example.com')559 >>> login("mark@example.com")
560 >>> for spec in kubuntu.specifications(None):560 >>> for spec in kubuntu.specifications(None):
561 ... # Do this here, otherwise, the change will be flush before561 ... # Do this here, otherwise, the change will be flush before
562 ... # updateLifecycleStatus() acts and an IntegrityError will be562 ... # updateLifecycleStatus() acts and an IntegrityError will be
563 ... # raised.563 ... # raised.
564 ... owner = spec.owner564 ... owner = spec.owner
565 ... if spec.name in ['cluster-installation', 'revu']:565 ... if spec.name in ["cluster-installation", "revu"]:
566 ... spec.definition_status = (566 ... spec.definition_status = (
567 ... SpecificationDefinitionStatus.OBSOLETE)567 ... SpecificationDefinitionStatus.OBSOLETE)
568 ... if spec.name in ['krunch-desktop-plan']:568 ... if spec.name in ["krunch-desktop-plan"]:
569 ... spec.definition_status = (569 ... spec.definition_status = (
570 ... SpecificationDefinitionStatus.SUPERSEDED)570 ... SpecificationDefinitionStatus.SUPERSEDED)
571 ... shim = spec.updateLifecycleStatus(owner)571 ... shim = spec.updateLifecycleStatus(owner)
@@ -586,26 +586,26 @@ series of a distribution.
586 3.1586 3.1
587 3.1-rc1587 3.1-rc1
588588
589 >>> woody = debian['woody']589 >>> woody = debian["woody"]
590590
591Milestones for distros can only be created by distro owners or admins.591Milestones for distros can only be created by distro owners or admins.
592592
593 >>> login('no-priv@canonical.com')593 >>> login("no-priv@canonical.com")
594 >>> woody.newMilestone(594 >>> woody.newMilestone(
595 ... name='impossible', dateexpected=datetime(2028, 10, 1))595 ... name="impossible", dateexpected=datetime(2028, 10, 1))
596 Traceback (most recent call last):596 Traceback (most recent call last):
597 ...597 ...
598 zope.security.interfaces.Unauthorized:598 zope.security.interfaces.Unauthorized:
599 (<DistroSeries ...'woody'>, 'newMilestone', 'launchpad.Edit')599 (<DistroSeries ...'woody'>, 'newMilestone', 'launchpad.Edit')
600 >>> login('mark@example.com')600 >>> login("mark@example.com")
601 >>> debian_milestone = woody.newMilestone(601 >>> debian_milestone = woody.newMilestone(
602 ... name='woody-rc1', dateexpected=datetime(2028, 10, 1))602 ... name="woody-rc1", dateexpected=datetime(2028, 10, 1))
603603
604They're ordered by dateexpected.604They're ordered by dateexpected.
605605
606 >>> for milestone in debian.milestones:606 >>> for milestone in debian.milestones:
607 ... print('%s: %s' % (607 ... print("%s: %s" % (
608 ... milestone.name, milestone.dateexpected.strftime('%Y-%m-%d')))608 ... milestone.name, milestone.dateexpected.strftime("%Y-%m-%d")))
609 3.1: 2056-05-16609 3.1: 2056-05-16
610 3.1-rc1: 2056-02-16610 3.1-rc1: 2056-02-16
611 woody-rc1: 2028-10-01611 woody-rc1: 2028-10-01
@@ -635,13 +635,13 @@ A distribution archive (primary, partner, debug or copy) can be retrieved
635by name using IDistribution.getArchive.635by name using IDistribution.getArchive.
636636
637 >>> def display_archive(archive):637 >>> def display_archive(archive):
638 ... print('%s %s %s' % (638 ... print("%s %s %s" % (
639 ... archive.distribution.name, archive.owner.name, archive.name))639 ... archive.distribution.name, archive.owner.name, archive.name))
640 >>> display_archive(ubuntu.getArchive('primary'))640 >>> display_archive(ubuntu.getArchive("primary"))
641 ubuntu ubuntu-team primary641 ubuntu ubuntu-team primary
642 >>> display_archive(ubuntu.getArchive('partner'))642 >>> display_archive(ubuntu.getArchive("partner"))
643 ubuntu ubuntu-team partner643 ubuntu ubuntu-team partner
644 >>> display_archive(debian.getArchive('primary'))644 >>> display_archive(debian.getArchive("primary"))
645 debian mark primary645 debian mark primary
646 >>> ubuntu.getArchive('ppa')646 >>> ubuntu.getArchive("ppa")
647 >>> debian.getArchive('partner')647 >>> debian.getArchive("partner")

Subscribers

People subscribed via source and target branches

to status/vote changes: