launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21199
[Merge] lp:~cjwatson/launchpad/no-circular-enums into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/no-circular-enums into lp:launchpad.
Commit message:
Stop avoiding circular imports of lp.*.enums.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/no-circular-enums/+merge/310707
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/no-circular-enums into lp:launchpad.
=== modified file 'lib/lp/_schema_circular_imports.py'
--- lib/lp/_schema_circular_imports.py 2016-10-12 23:24:24 +0000
+++ lib/lp/_schema_circular_imports.py 2016-11-12 20:25:17 +0000
@@ -23,7 +23,6 @@
IHasSpecifications,
ISpecificationTarget,
)
-from lp.bugs.enums import BugNotificationLevel
from lp.bugs.interfaces.bug import (
IBug,
IFrontPageBugAddForm,
@@ -51,7 +50,6 @@
IStructuralSubscription,
IStructuralSubscriptionTarget,
)
-from lp.buildmaster.enums import BuildStatus
from lp.buildmaster.interfaces.builder import (
IBuilder,
IBuilderSet,
@@ -94,10 +92,6 @@
IHWSubmissionDevice,
IHWVendorID,
)
-from lp.registry.enums import (
- DistroSeriesDifferenceStatus,
- DistroSeriesDifferenceType,
- )
from lp.registry.interfaces.commercialsubscription import (
ICommercialSubscription,
)
@@ -182,11 +176,6 @@
ILanguage,
ILanguageSet,
)
-from lp.soyuz.enums import (
- PackagePublishingStatus,
- PackageUploadCustomFormat,
- PackageUploadStatus,
- )
from lp.soyuz.interfaces.archive import IArchive
from lp.soyuz.interfaces.archivedependency import IArchiveDependency
from lp.soyuz.interfaces.archivepermission import IArchivePermission
@@ -324,8 +313,6 @@
patch_choice_parameter_type(
IHasBuildRecords, 'getBuildRecords', 'pocket', PackagePublishingPocket)
-patch_choice_parameter_type(
- IHasBuildRecords, 'getBuildRecords', 'build_state', BuildStatus)
patch_collection_return_type(
IHasBuildRecords, 'getBuildRecords', IBinaryPackageBuild)
@@ -434,8 +421,6 @@
patch_collection_return_type(
IArchive, 'api_getPublishedSources', ISourcePackagePublishingHistory)
patch_choice_parameter_type(
- IArchive, 'api_getPublishedSources', 'status', PackagePublishingStatus)
-patch_choice_parameter_type(
IArchive, 'api_getPublishedSources', 'pocket', PackagePublishingPocket)
patch_plain_parameter_type(
IArchive, 'getAllPublishedBinaries', 'distroarchseries',
@@ -443,8 +428,6 @@
patch_collection_return_type(
IArchive, 'getAllPublishedBinaries', IBinaryPackagePublishingHistory)
patch_choice_parameter_type(
- IArchive, 'getAllPublishedBinaries', 'status', PackagePublishingStatus)
-patch_choice_parameter_type(
IArchive, 'getAllPublishedBinaries', 'pocket', PackagePublishingPocket)
patch_plain_parameter_type(
IArchive, 'isSourceUploadAllowed', 'distroseries', IDistroSeries)
@@ -486,7 +469,6 @@
IArchive, '_addArchiveDependency', IArchiveDependency)
# IBuildFarmJob
-patch_choice_property(IBuildFarmJob, 'status', BuildStatus)
patch_reference_property(IBuildFarmJob, 'buildqueue_record', IBuildQueue)
# IComment
@@ -520,12 +502,7 @@
IDistroSeries, 'enabled_architectures', IDistroArchSeries)
patch_reference_property(IDistroSeries, 'distribution', IDistribution)
patch_choice_parameter_type(
- IDistroSeries, 'getPackageUploads', 'status', PackageUploadStatus)
-patch_choice_parameter_type(
IDistroSeries, 'getPackageUploads', 'pocket', PackagePublishingPocket)
-patch_choice_parameter_type(
- IDistroSeries, 'getPackageUploads', 'custom_type',
- PackageUploadCustomFormat)
patch_plain_parameter_type(
IDistroSeries, 'getPackageUploads', 'archive', IArchive)
patch_collection_return_type(
@@ -537,11 +514,6 @@
patch_collection_return_type(IDistroSeries, 'getParentSeries', IDistroSeries)
patch_plain_parameter_type(
IDistroSeries, 'getDifferencesTo', 'parent_series', IDistroSeries)
-patch_choice_parameter_type(
- IDistroSeries, 'getDifferencesTo', 'status', DistroSeriesDifferenceStatus)
-patch_choice_parameter_type(
- IDistroSeries, 'getDifferencesTo', 'difference_type',
- DistroSeriesDifferenceType)
patch_collection_return_type(
IDistroSeries, 'getDifferencesTo', IDistroSeriesDifference)
patch_collection_return_type(
@@ -687,8 +659,6 @@
patch_collection_property(IBug, 'linked_merge_proposals', IBranchMergeProposal)
patch_plain_parameter_type(
IBug, 'linkMergeProposal', 'merge_proposal', IBranchMergeProposal)
-patch_choice_parameter_type(
- IBug, 'subscribe', 'level', BugNotificationLevel)
patch_plain_parameter_type(
IBug, 'unlinkMergeProposal', 'merge_proposal', IBranchMergeProposal)
=== modified file 'lib/lp/bugs/interfaces/bug.py'
--- lib/lp/bugs/interfaces/bug.py 2016-07-29 16:13:36 +0000
+++ lib/lp/bugs/interfaces/bug.py 2016-11-12 20:25:17 +0000
@@ -22,7 +22,6 @@
'IProjectGroupBugAddForm',
]
-from lazr.enum import DBEnumeratedType
from lazr.lifecycle.snapshot import doNotSnapshot
from lazr.restful.declarations import (
accessor_for,
@@ -809,13 +808,6 @@
file_alias.restricted.
"""
- def linkMergeProposal(merge_proposal, user, check_permissions=True):
- """Ensure that this MP is linked to this bug."""
-
- def unlinkMergeProposal(merge_proposal, user, check_permissions=True):
- """Ensure that any links between this bug and the given MP are removed.
- """
-
@call_with(user=REQUEST_USER)
@operation_parameters(
# Really IBranchMergeProposal, patched in _schema_circular_imports.py.
@@ -971,13 +963,10 @@
def newMessage(owner, subject, content):
"""Create a new message, and link it to this object."""
- # The level actually uses BugNotificationLevel as its vocabulary,
- # but due to circular import problems we fix that in
- # _schema_circular_imports.py rather than here.
@operation_parameters(
person=Reference(IPerson, title=_('Person'), required=True),
level=Choice(
- vocabulary=DBEnumeratedType, required=False,
+ vocabulary=BugNotificationLevel, required=False,
title=_('Level')))
@call_with(subscribed_by=REQUEST_USER, suppress_notify=False)
@export_write_operation()
=== modified file 'lib/lp/buildmaster/interfaces/buildfarmjob.py'
--- lib/lp/buildmaster/interfaces/buildfarmjob.py 2016-01-08 13:15:02 +0000
+++ lib/lp/buildmaster/interfaces/buildfarmjob.py 2016-11-12 20:25:17 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Interface for Soyuz build farm jobs."""
@@ -14,7 +14,6 @@
'ISpecificBuildFarmJobSource',
]
-from lazr.enum import DBEnumeratedType
from lazr.restful.declarations import (
export_as_webservice_entry,
exported,
@@ -34,7 +33,10 @@
)
from lp import _
-from lp.buildmaster.enums import BuildFarmJobType
+from lp.buildmaster.enums import (
+ BuildFarmJobType,
+ BuildStatus,
+ )
from lp.buildmaster.interfaces.builder import IBuilder
from lp.buildmaster.interfaces.processor import IProcessor
from lp.services.librarian.interfaces import ILibraryFileAlias
@@ -137,10 +139,7 @@
status = exported(
Choice(
- title=_('Status'), required=True,
- # Really BuildStatus, patched in
- # _schema_circular_imports.py
- vocabulary=DBEnumeratedType,
+ title=_('Status'), required=True, vocabulary=BuildStatus,
description=_("The current status of the job.")),
("1.0", dict(exported_as="buildstate")),
as_of="beta",
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2016-04-06 00:48:53 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2016-11-12 20:25:17 +0000
@@ -68,6 +68,10 @@
from lp.bugs.interfaces.structuralsubscription import (
IStructuralSubscriptionTarget,
)
+from lp.registry.enums import (
+ DistroSeriesDifferenceStatus,
+ DistroSeriesDifferenceType,
+ )
from lp.registry.errors import NoSuchDistroSeries
from lp.registry.interfaces.milestone import (
IHasMilestones,
@@ -91,7 +95,11 @@
UniqueField,
)
from lp.services.webservice.apihelpers import patch_plain_parameter_type
-from lp.soyuz.enums import IndexCompressionType
+from lp.soyuz.enums import (
+ IndexCompressionType,
+ PackageUploadCustomFormat,
+ PackageUploadStatus,
+ )
from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
from lp.translations.interfaces.hastranslationimports import (
IHasTranslationImports,
@@ -533,9 +541,7 @@
"Return items that are more recent than this timestamp."),
required=False),
status=Choice(
- # Really PackageUploadCustomFormat, patched in
- # _schema_circular_imports.py
- vocabulary=DBEnumeratedType,
+ vocabulary=PackageUploadStatus,
title=_("Package Upload Status"),
description=_("Return only items that have this status."),
required=False),
@@ -553,9 +559,7 @@
description=_("Return only items targeted to this pocket"),
required=False),
custom_type=Choice(
- # Really PackageUploadCustomFormat, patched in
- # _schema_circular_imports.py
- vocabulary=DBEnumeratedType,
+ vocabulary=PackageUploadCustomFormat,
title=_("Custom Type"),
description=_("Return only items with custom files of this "
"type."),
@@ -838,14 +842,14 @@
title=_("The parent series to consider."),
required=False),
difference_type=Choice(
- vocabulary=DBEnumeratedType, # DistroSeriesDifferenceType
+ vocabulary=DistroSeriesDifferenceType,
title=_("Only return differences of this type."), required=False),
source_package_name_filter=TextLine(
title=_("Only return differences for packages matching this "
"name."),
required=False),
status=Choice(
- vocabulary=DBEnumeratedType, # DistroSeriesDifferenceStatus
+ vocabulary=DistroSeriesDifferenceStatus,
title=_("Only return differences of this status."),
required=False),
child_version_higher=Bool(
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2016-10-20 11:49:45 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2016-11-12 20:25:17 +0000
@@ -110,7 +110,10 @@
PublicPersonChoice,
StrippedTextLine,
)
-from lp.soyuz.enums import ArchivePurpose
+from lp.soyuz.enums import (
+ ArchivePurpose,
+ PackagePublishingStatus,
+ )
from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
from lp.soyuz.interfaces.component import IComponent
@@ -474,8 +477,7 @@
status=Choice(
title=_('Package Publishing Status'),
description=_('The status of this publishing record'),
- # Really PackagePublishingStatus, circular import fixed below.
- vocabulary=DBEnumeratedType,
+ vocabulary=PackagePublishingStatus,
required=False),
distroseries=Reference(
# Really IDistroSeries, fixed below to avoid circular import.
@@ -1166,8 +1168,7 @@
status=Choice(
title=_("Package Publishing Status"),
description=_("The status of this publishing record"),
- # Really PackagePublishingStatus, circular import fixed below.
- vocabulary=DBEnumeratedType,
+ vocabulary=PackagePublishingStatus,
required=False),
distroarchseries=Reference(
# Really IDistroArchSeries, circular import fixed below.
=== modified file 'lib/lp/soyuz/interfaces/buildrecords.py'
--- lib/lp/soyuz/interfaces/buildrecords.py 2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/interfaces/buildrecords.py 2016-11-12 20:25:17 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""IHasBuildRecords interface.
@@ -32,6 +32,7 @@
)
from lp import _
+from lp.buildmaster.enums import BuildStatus
@error_status(httplib.BAD_REQUEST)
@@ -48,8 +49,7 @@
build_state=Choice(
title=_('Build status'), required=False,
description=_('The status of this build record'),
- # Really a BuildStatus see _schema_circular_imports.
- vocabulary=DBEnumeratedType),
+ vocabulary=BuildStatus),
pocket=Choice(
title=_("Pocket"), required=False, readonly=True,
description=_("The pocket into which this entry is published"),
Follow ups