Merge ~jugmac00/launchpad:improve-readability-of-distribution.rst into launchpad:master
- Git
- lp:~jugmac00/launchpad
- improve-readability-of-distribution.rst
- Merge into 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) |
Related bugs: |
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
1 | diff --git a/lib/lp/registry/doc/distribution.rst b/lib/lp/registry/doc/distribution.rst | |||
2 | index e21f674..b57b1ed 100644 | |||
3 | --- a/lib/lp/registry/doc/distribution.rst | |||
4 | +++ b/lib/lp/registry/doc/distribution.rst | |||
5 | @@ -44,15 +44,15 @@ can be used to look up distributions by their aliases too. | |||
6 | 44 | gentoo | 44 | gentoo |
7 | 45 | 45 | ||
8 | 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. |
11 | 47 | >>> login('foo.bar@canonical.com') | 47 | >>> login("foo.bar@canonical.com") |
12 | 48 | >>> gentoo.setAliases(['jackass']) | 48 | >>> gentoo.setAliases(["jackass"]) |
13 | 49 | >>> for alias in gentoo.aliases: | 49 | >>> for alias in gentoo.aliases: |
14 | 50 | ... print(alias) | 50 | ... print(alias) |
15 | 51 | jackass | 51 | jackass |
16 | 52 | >>> login(ANONYMOUS) | 52 | >>> login(ANONYMOUS) |
18 | 53 | >>> print(distroset['jackass'].name) | 53 | >>> print(distroset["jackass"].name) |
19 | 54 | gentoo | 54 | gentoo |
21 | 55 | >>> print(distroset.getByName('jackass').name) | 55 | >>> print(distroset.getByName("jackass").name) |
22 | 56 | gentoo | 56 | gentoo |
23 | 57 | 57 | ||
24 | 58 | Let's make sure a distribution object properly implements its interfaces. | 58 | Let's make sure a distribution object properly implements its interfaces. |
25 | @@ -87,7 +87,7 @@ have a SourcePackageName object for it. | |||
26 | 87 | >>> from lp.soyuz.model.sourcepackagerelease import ( | 87 | >>> from lp.soyuz.model.sourcepackagerelease import ( |
27 | 88 | ... SourcePackageRelease) | 88 | ... SourcePackageRelease) |
28 | 89 | >>> sourcepackagerelease = SourcePackageRelease.selectOneBy( | 89 | >>> sourcepackagerelease = SourcePackageRelease.selectOneBy( |
30 | 90 | ... sourcepackagenameID=evo.id, version='1.0') | 90 | ... sourcepackagenameID=evo.id, version="1.0") |
31 | 91 | >>> print(sourcepackagerelease.name) | 91 | >>> print(sourcepackagerelease.name) |
32 | 92 | evolution | 92 | evolution |
33 | 93 | 93 | ||
34 | @@ -181,9 +181,9 @@ Searching for DistributionSourcePackages | |||
35 | 181 | ........................................ | 181 | ........................................ |
36 | 182 | 182 | ||
37 | 183 | The distribution also allows you to look for source packages that match | 183 | The distribution also allows you to look for source packages that match |
39 | 184 | a certain string through the magic of fti. For instance: | 184 | a certain string through the magic of full text indexing (fti). For instance: |
40 | 185 | 185 | ||
42 | 186 | >>> packages = ubuntu.searchSourcePackageCaches(u"mozilla") | 186 | >>> packages = ubuntu.searchSourcePackageCaches("mozilla") |
43 | 187 | >>> for distro_source_package_cache, source_name, rank in packages: | 187 | >>> for distro_source_package_cache, source_name, rank in packages: |
44 | 188 | ... print("%-17s rank:%s" % ( | 188 | ... print("%-17s rank:%s" % ( |
45 | 189 | ... distro_source_package_cache.name, | 189 | ... distro_source_package_cache.name, |
46 | @@ -193,10 +193,10 @@ a certain string through the magic of fti. For instance: | |||
47 | 193 | The search also matches on exact package names which fti doesn't like, | 193 | The search also matches on exact package names which fti doesn't like, |
48 | 194 | and even on substrings: | 194 | and even on substrings: |
49 | 195 | 195 | ||
51 | 196 | >>> packages = ubuntu.searchSourcePackageCaches(u"linux-source-2.6.15") | 196 | >>> packages = ubuntu.searchSourcePackageCaches("linux-source-2.6.15") |
52 | 197 | >>> print(packages.count()) | 197 | >>> print(packages.count()) |
53 | 198 | 1 | 198 | 1 |
55 | 199 | >>> packages = ubuntu.searchSourcePackageCaches(u'a') | 199 | >>> packages = ubuntu.searchSourcePackageCaches("a") |
56 | 200 | >>> for distro_source_package_cache, source_name, rank in packages: | 200 | >>> for distro_source_package_cache, source_name, rank in packages: |
57 | 201 | ... print("%s: %-17s rank:%s" % ( | 201 | ... print("%s: %-17s rank:%s" % ( |
58 | 202 | ... distro_source_package_cache.__class__.__name__, | 202 | ... distro_source_package_cache.__class__.__name__, |
59 | @@ -211,7 +211,7 @@ and even on substrings: | |||
60 | 211 | The searchSourcePackages() method just returns a decorated version | 211 | The searchSourcePackages() method just returns a decorated version |
61 | 212 | of the results from searchSourcePackageCaches(): | 212 | of the results from searchSourcePackageCaches(): |
62 | 213 | 213 | ||
64 | 214 | >>> packages = ubuntu.searchSourcePackages(u'a') | 214 | >>> packages = ubuntu.searchSourcePackages("a") |
65 | 215 | >>> for dsp in packages: | 215 | >>> for dsp in packages: |
66 | 216 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) | 216 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) |
67 | 217 | DistributionSourcePackage: alsa-utils | 217 | DistributionSourcePackage: alsa-utils |
68 | @@ -225,13 +225,13 @@ it just passes on to searchSourcePackageCaches(), and it restricts | |||
69 | 225 | the results based on whether the source package has an entry | 225 | the results based on whether the source package has an entry |
70 | 226 | in the Packaging table linking it to an upstream project. | 226 | in the Packaging table linking it to an upstream project. |
71 | 227 | 227 | ||
73 | 228 | >>> packages = ubuntu.searchSourcePackages(u'a', has_packaging=True) | 228 | >>> packages = ubuntu.searchSourcePackages("a", has_packaging=True) |
74 | 229 | >>> for dsp in packages: | 229 | >>> for dsp in packages: |
75 | 230 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) | 230 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) |
76 | 231 | DistributionSourcePackage: alsa-utils | 231 | DistributionSourcePackage: alsa-utils |
77 | 232 | DistributionSourcePackage: mozilla-firefox | 232 | DistributionSourcePackage: mozilla-firefox |
78 | 233 | DistributionSourcePackage: netapplet | 233 | DistributionSourcePackage: netapplet |
80 | 234 | >>> packages = ubuntu.searchSourcePackages(u'a', has_packaging=False) | 234 | >>> packages = ubuntu.searchSourcePackages("a", has_packaging=False) |
81 | 235 | >>> for dsp in packages: | 235 | >>> for dsp in packages: |
82 | 236 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) | 236 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) |
83 | 237 | DistributionSourcePackage: commercialpackage | 237 | DistributionSourcePackage: commercialpackage |
84 | @@ -243,7 +243,7 @@ results based on whether the source package has an entry in the | |||
85 | 243 | SourcePackagePublishingHistory table for the given distroseries. | 243 | SourcePackagePublishingHistory table for the given distroseries. |
86 | 244 | 244 | ||
87 | 245 | >>> packages = ubuntu.searchSourcePackages( | 245 | >>> packages = ubuntu.searchSourcePackages( |
89 | 246 | ... u'a', publishing_distroseries=ubuntu.currentseries) | 246 | ... "a", publishing_distroseries=ubuntu.currentseries) |
90 | 247 | >>> for dsp in packages: | 247 | >>> for dsp in packages: |
91 | 248 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) | 248 | ... print("%s: %s" % (dsp.__class__.__name__, dsp.name)) |
92 | 249 | DistributionSourcePackage: alsa-utils | 249 | DistributionSourcePackage: alsa-utils |
93 | @@ -262,7 +262,7 @@ Searching for an exact match on a valid binary name returns the | |||
94 | 262 | expected results: | 262 | expected results: |
95 | 263 | 263 | ||
96 | 264 | >>> results = ubuntu.searchBinaryPackages( | 264 | >>> results = ubuntu.searchBinaryPackages( |
98 | 265 | ... u"mozilla-firefox", exact_match=True) | 265 | ... "mozilla-firefox", exact_match=True) |
99 | 266 | >>> for result in results: | 266 | >>> for result in results: |
100 | 267 | ... print(result.name) | 267 | ... print(result.name) |
101 | 268 | mozilla-firefox | 268 | mozilla-firefox |
102 | @@ -270,13 +270,13 @@ expected results: | |||
103 | 270 | An exact match search with no matches on any package name returns | 270 | An exact match search with no matches on any package name returns |
104 | 271 | an empty result set: | 271 | an empty result set: |
105 | 272 | 272 | ||
107 | 273 | >>> results = ubuntu.searchBinaryPackages(u"mozilla", exact_match=True) | 273 | >>> results = ubuntu.searchBinaryPackages("mozilla", exact_match=True) |
108 | 274 | >>> results.count() | 274 | >>> results.count() |
109 | 275 | 0 | 275 | 0 |
110 | 276 | 276 | ||
111 | 277 | Loosening to substring matches gives another result: | 277 | Loosening to substring matches gives another result: |
112 | 278 | 278 | ||
114 | 279 | >>> results = ubuntu.searchBinaryPackages(u"mozilla", exact_match=False) | 279 | >>> results = ubuntu.searchBinaryPackages("mozilla", exact_match=False) |
115 | 280 | >>> print(results[0]) | 280 | >>> print(results[0]) |
116 | 281 | <...DistributionSourcePackageCache instance ... | 281 | <...DistributionSourcePackageCache instance ... |
117 | 282 | 282 | ||
118 | @@ -290,7 +290,7 @@ Loosening to substring matches gives another result: | |||
119 | 290 | The results of searchBinaryPackages() are simply ordered alphabetically | 290 | The results of searchBinaryPackages() are simply ordered alphabetically |
120 | 291 | for the moment until we have a better FTI rank to order with. | 291 | for the moment until we have a better FTI rank to order with. |
121 | 292 | 292 | ||
123 | 293 | >>> results = ubuntu.searchBinaryPackages(u"m") | 293 | >>> results = ubuntu.searchBinaryPackages("m") |
124 | 294 | >>> for result in results: | 294 | >>> for result in results: |
125 | 295 | ... print(result.name) | 295 | ... print(result.name) |
126 | 296 | mozilla-firefox | 296 | mozilla-firefox |
127 | @@ -307,14 +307,14 @@ we need some way to decompose that into the distroseries and the pocket. | |||
128 | 307 | Distribution can do that for us. | 307 | Distribution can do that for us. |
129 | 308 | 308 | ||
130 | 309 | If we ask for a totally unknown distroseries, we raise NotFoundError | 309 | If we ask for a totally unknown distroseries, we raise NotFoundError |
132 | 310 | >>> ubuntu.getDistroSeriesAndPocket('unknown') | 310 | >>> ubuntu.getDistroSeriesAndPocket("unknown") |
133 | 311 | Traceback (most recent call last): | 311 | Traceback (most recent call last): |
134 | 312 | ... | 312 | ... |
135 | 313 | lp.app.errors.NotFoundError: ...'unknown' | 313 | lp.app.errors.NotFoundError: ...'unknown' |
136 | 314 | 314 | ||
137 | 315 | If we ask for a plain distroseries, it should come back with the RELEASE | 315 | If we ask for a plain distroseries, it should come back with the RELEASE |
138 | 316 | pocket as the pocket. | 316 | pocket as the pocket. |
140 | 317 | >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary') | 317 | >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary") |
141 | 318 | >>> print(dr.name) | 318 | >>> print(dr.name) |
142 | 319 | hoary | 319 | hoary |
143 | 320 | >>> print(pocket.name) | 320 | >>> print(pocket.name) |
144 | @@ -322,14 +322,14 @@ pocket as the pocket. | |||
145 | 322 | 322 | ||
146 | 323 | If we ask for a security pocket in a known distroseries it should come out | 323 | If we ask for a security pocket in a known distroseries it should come out |
147 | 324 | on the other side. | 324 | on the other side. |
149 | 325 | >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary-security') | 325 | >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary-security") |
150 | 326 | >>> print(dr.name) | 326 | >>> print(dr.name) |
151 | 327 | hoary | 327 | hoary |
152 | 328 | >>> print(pocket.name) | 328 | >>> print(pocket.name) |
153 | 329 | SECURITY | 329 | SECURITY |
154 | 330 | 330 | ||
155 | 331 | Find the backports pocket, too: | 331 | Find the backports pocket, too: |
157 | 332 | >>> dr, pocket = ubuntu.getDistroSeriesAndPocket('hoary-backports') | 332 | >>> dr, pocket = ubuntu.getDistroSeriesAndPocket("hoary-backports") |
158 | 333 | >>> print(dr.name) | 333 | >>> print(dr.name) |
159 | 334 | hoary | 334 | hoary |
160 | 335 | >>> print(pocket.name) | 335 | >>> print(pocket.name) |
161 | @@ -337,7 +337,7 @@ Find the backports pocket, too: | |||
162 | 337 | 337 | ||
163 | 338 | If we ask for a valid distroseries which doesn't have a given pocket it should | 338 | If we ask for a valid distroseries which doesn't have a given pocket it should |
164 | 339 | raise NotFoundError for us | 339 | raise NotFoundError for us |
166 | 340 | >>> ubuntu.getDistroSeriesAndPocket('hoary-bullshit') | 340 | >>> ubuntu.getDistroSeriesAndPocket("hoary-bullshit") |
167 | 341 | Traceback (most recent call last): | 341 | Traceback (most recent call last): |
168 | 342 | ... | 342 | ... |
169 | 343 | lp.app.errors.NotFoundError: ...'hoary-bullshit' | 343 | lp.app.errors.NotFoundError: ...'hoary-bullshit' |
170 | @@ -444,7 +444,7 @@ Gentoo only uses Malone | |||
171 | 444 | Launchpad admins and the distro owner can set these fields. | 444 | Launchpad admins and the distro owner can set these fields. |
172 | 445 | 445 | ||
173 | 446 | >>> from lp.app.enums import ServiceUsage | 446 | >>> from lp.app.enums import ServiceUsage |
175 | 447 | >>> login('mark@example.com') | 447 | >>> login("mark@example.com") |
176 | 448 | >>> debian = getUtility(ILaunchpadCelebrities).debian | 448 | >>> debian = getUtility(ILaunchpadCelebrities).debian |
177 | 449 | >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD | 449 | >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD |
178 | 450 | >>> print(debian.blueprints_usage.name) | 450 | >>> print(debian.blueprints_usage.name) |
179 | @@ -465,7 +465,7 @@ Launchpad admins and the distro owner can set these fields. | |||
180 | 465 | 465 | ||
181 | 466 | But others can't. | 466 | But others can't. |
182 | 467 | 467 | ||
184 | 468 | >>> login('no-priv@canonical.com') | 468 | >>> login("no-priv@canonical.com") |
185 | 469 | >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD | 469 | >>> debian.blueprints_usage = ServiceUsage.LAUNCHPAD |
186 | 470 | Traceback (most recent call last): | 470 | Traceback (most recent call last): |
187 | 471 | zope.security.interfaces.Unauthorized: | 471 | zope.security.interfaces.Unauthorized: |
188 | @@ -549,23 +549,23 @@ And if we ask just for specs, we get the incomplete ones. | |||
189 | 549 | 549 | ||
190 | 550 | We can filter for specifications that contain specific text: | 550 | We can filter for specifications that contain specific text: |
191 | 551 | 551 | ||
193 | 552 | >>> for spec in kubuntu.specifications(None, filter=[u'package']): | 552 | >>> for spec in kubuntu.specifications(None, filter=["package"]): |
194 | 553 | ... print(spec.name) | 553 | ... print(spec.name) |
195 | 554 | revu | 554 | revu |
196 | 555 | 555 | ||
197 | 556 | We can get only valid specs (those that are not obsolete or superseded): | 556 | We can get only valid specs (those that are not obsolete or superseded): |
198 | 557 | 557 | ||
199 | 558 | >>> from lp.blueprints.enums import SpecificationDefinitionStatus | 558 | >>> from lp.blueprints.enums import SpecificationDefinitionStatus |
201 | 559 | >>> login('mark@example.com') | 559 | >>> login("mark@example.com") |
202 | 560 | >>> for spec in kubuntu.specifications(None): | 560 | >>> for spec in kubuntu.specifications(None): |
203 | 561 | ... # Do this here, otherwise, the change will be flush before | 561 | ... # Do this here, otherwise, the change will be flush before |
204 | 562 | ... # updateLifecycleStatus() acts and an IntegrityError will be | 562 | ... # updateLifecycleStatus() acts and an IntegrityError will be |
205 | 563 | ... # raised. | 563 | ... # raised. |
206 | 564 | ... owner = spec.owner | 564 | ... owner = spec.owner |
208 | 565 | ... if spec.name in ['cluster-installation', 'revu']: | 565 | ... if spec.name in ["cluster-installation", "revu"]: |
209 | 566 | ... spec.definition_status = ( | 566 | ... spec.definition_status = ( |
210 | 567 | ... SpecificationDefinitionStatus.OBSOLETE) | 567 | ... SpecificationDefinitionStatus.OBSOLETE) |
212 | 568 | ... if spec.name in ['krunch-desktop-plan']: | 568 | ... if spec.name in ["krunch-desktop-plan"]: |
213 | 569 | ... spec.definition_status = ( | 569 | ... spec.definition_status = ( |
214 | 570 | ... SpecificationDefinitionStatus.SUPERSEDED) | 570 | ... SpecificationDefinitionStatus.SUPERSEDED) |
215 | 571 | ... shim = spec.updateLifecycleStatus(owner) | 571 | ... shim = spec.updateLifecycleStatus(owner) |
216 | @@ -586,26 +586,26 @@ series of a distribution. | |||
217 | 586 | 3.1 | 586 | 3.1 |
218 | 587 | 3.1-rc1 | 587 | 3.1-rc1 |
219 | 588 | 588 | ||
221 | 589 | >>> woody = debian['woody'] | 589 | >>> woody = debian["woody"] |
222 | 590 | 590 | ||
223 | 591 | Milestones for distros can only be created by distro owners or admins. | 591 | Milestones for distros can only be created by distro owners or admins. |
224 | 592 | 592 | ||
226 | 593 | >>> login('no-priv@canonical.com') | 593 | >>> login("no-priv@canonical.com") |
227 | 594 | >>> woody.newMilestone( | 594 | >>> woody.newMilestone( |
229 | 595 | ... name='impossible', dateexpected=datetime(2028, 10, 1)) | 595 | ... name="impossible", dateexpected=datetime(2028, 10, 1)) |
230 | 596 | Traceback (most recent call last): | 596 | Traceback (most recent call last): |
231 | 597 | ... | 597 | ... |
232 | 598 | zope.security.interfaces.Unauthorized: | 598 | zope.security.interfaces.Unauthorized: |
233 | 599 | (<DistroSeries ...'woody'>, 'newMilestone', 'launchpad.Edit') | 599 | (<DistroSeries ...'woody'>, 'newMilestone', 'launchpad.Edit') |
235 | 600 | >>> login('mark@example.com') | 600 | >>> login("mark@example.com") |
236 | 601 | >>> debian_milestone = woody.newMilestone( | 601 | >>> debian_milestone = woody.newMilestone( |
238 | 602 | ... name='woody-rc1', dateexpected=datetime(2028, 10, 1)) | 602 | ... name="woody-rc1", dateexpected=datetime(2028, 10, 1)) |
239 | 603 | 603 | ||
240 | 604 | They're ordered by dateexpected. | 604 | They're ordered by dateexpected. |
241 | 605 | 605 | ||
242 | 606 | >>> for milestone in debian.milestones: | 606 | >>> for milestone in debian.milestones: |
245 | 607 | ... print('%s: %s' % ( | 607 | ... print("%s: %s" % ( |
246 | 608 | ... milestone.name, milestone.dateexpected.strftime('%Y-%m-%d'))) | 608 | ... milestone.name, milestone.dateexpected.strftime("%Y-%m-%d"))) |
247 | 609 | 3.1: 2056-05-16 | 609 | 3.1: 2056-05-16 |
248 | 610 | 3.1-rc1: 2056-02-16 | 610 | 3.1-rc1: 2056-02-16 |
249 | 611 | woody-rc1: 2028-10-01 | 611 | woody-rc1: 2028-10-01 |
250 | @@ -635,13 +635,13 @@ A distribution archive (primary, partner, debug or copy) can be retrieved | |||
251 | 635 | by name using IDistribution.getArchive. | 635 | by name using IDistribution.getArchive. |
252 | 636 | 636 | ||
253 | 637 | >>> def display_archive(archive): | 637 | >>> def display_archive(archive): |
255 | 638 | ... print('%s %s %s' % ( | 638 | ... print("%s %s %s" % ( |
256 | 639 | ... archive.distribution.name, archive.owner.name, archive.name)) | 639 | ... archive.distribution.name, archive.owner.name, archive.name)) |
258 | 640 | >>> display_archive(ubuntu.getArchive('primary')) | 640 | >>> display_archive(ubuntu.getArchive("primary")) |
259 | 641 | ubuntu ubuntu-team primary | 641 | ubuntu ubuntu-team primary |
261 | 642 | >>> display_archive(ubuntu.getArchive('partner')) | 642 | >>> display_archive(ubuntu.getArchive("partner")) |
262 | 643 | ubuntu ubuntu-team partner | 643 | ubuntu ubuntu-team partner |
264 | 644 | >>> display_archive(debian.getArchive('primary')) | 644 | >>> display_archive(debian.getArchive("primary")) |
265 | 645 | debian mark primary | 645 | debian mark primary |
268 | 646 | >>> ubuntu.getArchive('ppa') | 646 | >>> ubuntu.getArchive("ppa") |
269 | 647 | >>> debian.getArchive('partner') | 647 | >>> debian.getArchive("partner") |