launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01841
[Merge] lp:~sinzui/launchpad/apocalypse-interface-imports-10 into lp:launchpad/devel
Curtis Hovey has proposed merging lp:~sinzui/launchpad/apocalypse-interface-imports-10 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This is my branch to remove all the import from canonical.launchapd.interfaces
in lp.*.
lp:~sinzui/launchpad/apocalypse-interface-imports-10
Diff size: 358
Launchpad bug: https://bugs.launchpad.net/bugs/671568
Test command: the whole test suite, but I ran this first:
bin/test -vv -t person-bug-views -t doc/bugtask.txt \
-t xx-bug-contacts-reports -t xx-bugwatch-errors \
-t bugs-emailinterface
Pre-implementation: no one
Target release: 10.11
Remove all the import from canonical.launchapd.interfaces in lp.*
-----------------------------------------------------------------
I am not sure I believe this is happening. This branch removes the last
of the bad imports. I inlined imports from soyuz in
lib/lp/archiveuploader/nascentupload.py to resolve cyclic import issues.
While there remains a lot of bad imports in canonica.launchpad, we might
be able to delete a lot of canonical/launchpad/interfaces/__init__.py
next week/
Rules
-----
* use utilities/migrater/deglob to fix the imports in lib/lp
* Use utilities/format-new-modified-imports to clean up the changes
* Move cyclic imports statements into methods as needed.
QA
--
None.
Lint
----
Linting changed files:
lib/lp/shipit.py
lib/lp/archiveuploader/dscfile.py
lib/lp/archiveuploader/nascentupload.py
lib/lp/archiveuploader/uploadpolicy.py
lib/lp/bugs/browser/tests/person-bug-views.txt
lib/lp/bugs/doc/bugtask.txt
lib/lp/bugs/stories/bugs/xx-bug-contacts-reports.txt
lib/lp/bugs/stories/bugwatches/xx-bugwatch-errors.txt
lib/lp/bugs/tests/bugs-emailinterface.txt
lib/lp/codehosting/branchdistro.py
lib/lp/codehosting/scanner/buglinks.py
lib/lp/registry/browser/person.py
lib/lp/soyuz/model/distroarchseriesbinarypackage.py
lib/lp/translations/browser/pofile.py
^ There is lint in many of these files that I can fix before I land the branch.
--
https://code.launchpad.net/~sinzui/launchpad/apocalypse-interface-imports-10/+merge/40227
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/apocalypse-interface-imports-10 into lp:launchpad/devel.
=== modified file 'lib/lp/archiveuploader/dscfile.py'
--- lib/lp/archiveuploader/dscfile.py 2010-10-20 13:33:24 +0000
+++ lib/lp/archiveuploader/dscfile.py 2010-11-05 19:06:16 +0000
@@ -17,23 +17,21 @@
'find_copyright',
]
-import apt_pkg
from cStringIO import StringIO
-from debian.deb822 import Deb822Dict
import errno
import glob
import os
import shutil
import tempfile
+import apt_pkg
+from debian.deb822 import Deb822Dict
from zope.component import getUtility
from canonical.encoding import guess as guess_encoding
-from canonical.launchpad.interfaces import (
+from canonical.launchpad.interfaces.gpghandler import (
GPGVerificationError,
IGPGHandler,
- IGPGKeySet,
- ISourcePackageNameSet,
)
from canonical.librarian.utils import copy_and_close
from lp.app.errors import NotFoundError
@@ -48,8 +46,8 @@
TagFileParseError,
)
from lp.archiveuploader.utils import (
+ determine_source_file_type,
DpkgSourceError,
- determine_source_file_type,
extract_dpkg_source,
get_source_file_extension,
ParseMaintError,
@@ -59,18 +57,18 @@
re_valid_version,
safe_fix_maintainer,
)
+from lp.registry.interfaces.gpg import IGPGKeySet
from lp.registry.interfaces.person import (
IPersonSet,
PersonCreationRationale,
)
from lp.registry.interfaces.sourcepackage import SourcePackageFileType
+from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
from lp.soyuz.enums import (
ArchivePurpose,
SourcePackageFormat,
)
-from lp.soyuz.interfaces.archive import (
- IArchiveSet,
- )
+from lp.soyuz.interfaces.archive import IArchiveSet
def unpack_source(dsc_filepath):
=== modified file 'lib/lp/archiveuploader/nascentupload.py'
--- lib/lp/archiveuploader/nascentupload.py 2010-10-06 11:46:51 +0000
+++ lib/lp/archiveuploader/nascentupload.py 2010-11-05 19:06:16 +0000
@@ -23,13 +23,7 @@
import apt_pkg
from zope.component import getUtility
-from canonical.launchpad.interfaces import (
- IBinaryPackageNameSet,
- IDistributionSet,
- ILibraryFileAliasSet,
- ISourcePackageNameSet,
- QueueInconsistentStateError,
- )
+from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
from lp.app.errors import NotFoundError
from lp.archiveuploader.changesfile import ChangesFile
from lp.archiveuploader.dscfile import DSCFile
@@ -43,11 +37,11 @@
UploadWarning,
)
from lp.archiveuploader.utils import determine_source_file_type
+from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.registry.interfaces.sourcepackage import SourcePackageFileType
-from lp.soyuz.interfaces.archive import (
- MAIN_ARCHIVE_PURPOSES,
- )
+from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
+from lp.soyuz.interfaces.archive import MAIN_ARCHIVE_PURPOSES
PARTNER_COMPONENT_NAME = 'partner'
@@ -595,6 +589,9 @@
else:
ancestry_name = uploaded_file.package
+ # Avoid cyclic import.
+ from lp.soyuz.interfaces.binarypackagename import (
+ IBinaryPackageNameSet)
binary_name = getUtility(
IBinaryPackageNameSet).queryByName(ancestry_name)
@@ -892,6 +889,8 @@
if not self.queue_root:
self.queue_root = self._createQueueEntry()
+ # Avoid cyclic imports.
+ from lp.soyuz.interfaces.queue import QueueInconsistentStateError
try:
self.queue_root.setRejected()
except QueueInconsistentStateError:
=== modified file 'lib/lp/archiveuploader/uploadpolicy.py'
--- lib/lp/archiveuploader/uploadpolicy.py 2010-10-06 11:46:51 +0000
+++ lib/lp/archiveuploader/uploadpolicy.py 2010-11-05 19:06:16 +0000
@@ -16,6 +16,10 @@
from textwrap import dedent
+from lazr.enum import (
+ EnumeratedType,
+ Item,
+ )
from zope.component import (
getGlobalSiteManager,
getUtility,
@@ -25,14 +29,11 @@
Interface,
)
-from canonical.launchpad.interfaces import ILaunchpadCelebrities
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.registry.interfaces.series import SeriesStatus
-from lazr.enum import EnumeratedType, Item
-
-
# Number of seconds in an hour (used later)
HOURS = 3600
=== modified file 'lib/lp/bugs/browser/tests/person-bug-views.txt'
--- lib/lp/bugs/browser/tests/person-bug-views.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/browser/tests/person-bug-views.txt 2010-11-05 19:06:16 +0000
@@ -310,8 +310,8 @@
Adding another bug will update the totals returned by
packagebugs_search_view.total_bug_counts.
- >>> from canonical.launchpad.interfaces import (CreateBugParams,
- ... BugTaskImportance)
+ >>> from lp.bugs.interfaces.bug import CreateBugParams
+ >>> from lp.bugs.interfaces.bugtask import BugTaskImportance
>>> import transaction
>>> bug_params = CreateBugParams(
... owner=name16,
=== modified file 'lib/lp/bugs/doc/bugtask.txt'
--- lib/lp/bugs/doc/bugtask.txt 2010-11-03 18:43:07 +0000
+++ lib/lp/bugs/doc/bugtask.txt 2010-11-05 19:06:16 +0000
@@ -27,8 +27,12 @@
methods some other objects to create a task, so lets get the utilities we need
to access those other objects:
- >>> from canonical.launchpad.interfaces import (IBugSet, IPersonSet,
- ... IProductSet, IDistributionSet, IDistroSeriesSet,
+ >>> from lp.bugs.interfaces.bug import IBugSet
+ >>> from lp.registry.interfaces.distribution import IDistributionSet
+ >>> from lp.registry.interfaces.distroseries import IDistroSeriesSet
+ >>> from lp.registry.interfaces.person import IPersonSet
+ >>> from lp.registry.interfaces.product import IProductSet
+ >>> from lp.registry.interfaces.sourcepackagename import (
... ISourcePackageNameSet)
>>> productset = getUtility(IProductSet)
>>> distroset = getUtility(IDistributionSet)
=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-contacts-reports.txt'
--- lib/lp/bugs/stories/bugs/xx-bug-contacts-reports.txt 2010-10-03 15:30:06 +0000
+++ lib/lp/bugs/stories/bugs/xx-bug-contacts-reports.txt 2010-11-05 19:06:16 +0000
@@ -15,8 +15,9 @@
>>> import transaction
>>> from zope.component import getUtility
- >>> from canonical.launchpad.interfaces import (CreateBugParams,
- ... IDistributionSet, IPersonSet)
+ >>> from lp.bugs.interfaces.bug import CreateBugParams
+ >>> from lp.registry.interfaces.distribution import IDistributionSet
+ >>> from lp.registry.interfaces.person import IPersonSet
>>> from canonical.launchpad.ftests import login, logout
>>> from canonical.database.sqlbase import flush_database_updates
=== modified file 'lib/lp/bugs/stories/bugwatches/xx-bugwatch-errors.txt'
--- lib/lp/bugs/stories/bugwatches/xx-bugwatch-errors.txt 2010-10-09 16:36:22 +0000
+++ lib/lp/bugs/stories/bugwatches/xx-bugwatch-errors.txt 2010-11-05 19:06:16 +0000
@@ -33,8 +33,11 @@
We can now alter the bug watch manually to check that the correct error
messages are displayed.
- >>> from canonical.launchpad.interfaces import (BugWatchActivityStatus,
- ... BugTaskStatus, IBugTrackerSet, UNKNOWN_REMOTE_STATUS)
+ >>> from lp.bugs.interfaces.bugtask import BugTaskStatus
+ >>> from lp.bugs.interfaces.bugtracker import IBugTrackerSet
+ >>> from lp.bugs.interfaces.externalbugtracker import (
+ ... UNKNOWN_REMOTE_STATUS)
+ >>> from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus
>>> login('foo.bar@xxxxxxxxxxxxx')
>>> tracker = getUtility(IBugTrackerSet).getByName('mozilla.org')
=== modified file 'lib/lp/bugs/tests/bugs-emailinterface.txt'
--- lib/lp/bugs/tests/bugs-emailinterface.txt 2010-11-01 15:46:48 +0000
+++ lib/lp/bugs/tests/bugs-emailinterface.txt 2010-11-05 19:06:16 +0000
@@ -969,8 +969,8 @@
The 'cve' command associates a bug with a CVE reference.
- >>> from canonical.launchpad.interfaces import (CreateBugParams,
- ... IProductSet)
+ >>> from lp.bugs.interfaces.bug import CreateBugParams
+ >>> from lp.registry.interfaces.product import IProductSet
>>> def new_firefox_bug():
... firefox = getUtility(IProductSet).getByName('firefox')
... return firefox.createBug(CreateBugParams(
=== modified file 'lib/lp/codehosting/branchdistro.py'
--- lib/lp/codehosting/branchdistro.py 2010-10-04 13:55:16 +0000
+++ lib/lp/codehosting/branchdistro.py 2010-11-05 19:06:16 +0000
@@ -27,8 +27,12 @@
from zope.component import getUtility
from canonical.config import config
-from canonical.launchpad.interfaces import ILaunchpadCelebrities, IMasterStore
-from lp.code.enums import BranchLifecycleStatus, BranchType
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
+from canonical.launchpad.interfaces.lpstorm import IMasterStore
+from lp.code.enums import (
+ BranchLifecycleStatus,
+ BranchType,
+ )
from lp.code.errors import BranchExists
from lp.code.interfaces.branchcollection import IAllBranches
from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
=== modified file 'lib/lp/codehosting/scanner/buglinks.py'
--- lib/lp/codehosting/scanner/buglinks.py 2010-10-04 13:55:16 +0000
+++ lib/lp/codehosting/scanner/buglinks.py 2010-11-05 19:06:16 +0000
@@ -13,11 +13,9 @@
from bzrlib.errors import InvalidBugStatus
from zope.component import getUtility
-from canonical.launchpad.interfaces import (
- IBugSet,
- ILaunchpadCelebrities,
- )
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from lp.app.errors import NotFoundError
+from lp.bugs.interfaces.bug import IBugSet
class BugBranchLinker:
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2010-11-02 11:31:17 +0000
+++ lib/lp/registry/browser/person.py 2010-11-05 19:06:16 +0000
@@ -1711,7 +1711,7 @@
# Only the IPerson can be traversed to, so it provides the IAccount.
# It also means that permissions are checked on IAccount, not IPerson.
self.person = self.context
- from canonical.launchpad.interfaces import IMasterObject
+ from canonical.launchpad.interfaces.lpstorm import IMasterObject
self.context = IMasterObject(self.context.account)
# Set fields to be displayed.
self.field_names = ['status', 'status_comment']
=== modified file 'lib/lp/shipit.py'
--- lib/lp/shipit.py 2010-10-25 15:23:38 +0000
+++ lib/lp/shipit.py 2010-11-05 19:06:16 +0000
@@ -16,13 +16,6 @@
intOrZero,
shortlist,
)
-# From browser/configure.zcml.
-from canonical.launchpad.interfaces import (
- ILaunchpadRoot,
- IMasterObject,
- ISlaveStore,
- IStore,
- )
from canonical.launchpad.interfaces.account import (
AccountStatus,
IAccount,
@@ -31,6 +24,12 @@
from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
+# From browser/configure.zcml.
+from canonical.launchpad.interfaces.lpstorm import (
+ IMasterObject,
+ ISlaveStore,
+ IStore,
+ )
from canonical.launchpad.interfaces.openidconsumer import IOpenIDConsumerStore
from canonical.launchpad.layers import setFirstLayer
from canonical.launchpad.security import AuthorizationBase
@@ -65,6 +64,7 @@
from canonical.launchpad.webapp.interfaces import (
ILaunchBag,
ILaunchpadApplication,
+ ILaunchpadRoot,
IPlacelessLoginSource,
IStoreSelector,
UnexpectedFormData,
@@ -126,3 +126,5 @@
)
from lp.testing.factory import LaunchpadObjectFactory
from lp.testing.publication import get_request_and_publication
+
+
=== modified file 'lib/lp/soyuz/model/distroarchseriesbinarypackage.py'
--- lib/lp/soyuz/model/distroarchseriesbinarypackage.py 2010-10-03 15:30:06 +0000
+++ lib/lp/soyuz/model/distroarchseriesbinarypackage.py 2010-11-05 19:06:16 +0000
@@ -18,7 +18,7 @@
from zope.interface import implements
from canonical.database.sqlbase import sqlvalues
-from canonical.launchpad.interfaces import IStore
+from canonical.launchpad.interfaces.lpstorm import IStore
from lp.app.errors import NotFoundError
from lp.services.propertycache import cachedproperty
from lp.soyuz.enums import PackagePublishingStatus
=== modified file 'lib/lp/translations/browser/pofile.py'
--- lib/lp/translations/browser/pofile.py 2010-10-28 09:54:48 +0000
+++ lib/lp/translations/browser/pofile.py 2010-11-05 19:06:16 +0000
@@ -26,7 +26,6 @@
from canonical.config import config
from canonical.launchpad import _
-from canonical.launchpad.interfaces import ILaunchBag
from canonical.launchpad.webapp import (
canonical_url,
enabled_with_permission,
@@ -36,6 +35,7 @@
NavigationMenu,
)
from canonical.launchpad.webapp.batching import BatchNavigator
+from canonical.launchpad.webapp.interfaces import ILaunchBag
from canonical.launchpad.webapp.menu import structured
from canonical.lazr.utils import smartquote
from lp.app.errors import (