launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01821
[Merge] lp:~sinzui/launchpad/apocalypse-interface-imports-9 into lp:launchpad/devel
Curtis Hovey has proposed merging lp:~sinzui/launchpad/apocalypse-interface-imports-9 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This is my branch to remove miscellaneous imports from
canonical.launchpad.interfaces.
lp:~sinzui/launchpad/apocalypse-interface-imports-9
Diff size: 370
Launchpad bug: none
Test command: The entire test suite.
Pre-implementation: no one
Target release: 10.11
Remove miscellaneous imports from canonical.launchpad.interfaces
-----------------------------------------------------------------
Update all but soyuz and registry in the lp package to import from the
true location.
ADDENDUM: lp.archiveuploader is also problematic and cannot be fixed
using deglob.
Rules
-----
* Refactor deglob to accept command line arguments so that
python packages can be updated without further hacking.
* Run deglob over several packages in lp to remove the bad imports
* Avoid Soyuz and Registry, they are problematic
* Run the format imports utility to sort the changes.
QA
--
None
Lint
----
Linting changed files:
lib/lp/bugs/mail/bugnotificationrecipients.py
lib/lp/bugs/scripts/checkwatches/core.py
lib/lp/bugs/scripts/checkwatches/scheduler.py
lib/lp/coop/answersbugs/model.py
lib/lp/scripts/garbo.py
lib/lp/services/fields/__init__.py
lib/lp/services/mail/incoming.py
lib/lp/services/mail/mailbox.py
lib/lp/services/mail/notificationrecipientset.py
lib/lp/services/mail/signedmessage.py
lib/lp/services/mailman/testing/sync.py
lib/lp/services/scripts/base.py
lib/lp/services/scripts/model/scriptactivity.py
lib/lp/services/worlddata/model/language.py
lib/lp/testing/_webservice.py
lib/lp/testing/factory.py
lib/lp/testing/mail.py
utilities/migrater/deglob.py
^ There is some lint in some of these files that I can fix before submitting.
Test
----
No tests change. I ran the entire test suite.
Implementation
--------------
All scripted changes.
--
https://code.launchpad.net/~sinzui/launchpad/apocalypse-interface-imports-9/+merge/40139
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/apocalypse-interface-imports-9 into lp:launchpad/devel.
=== modified file 'lib/lp/bugs/mail/bugnotificationrecipients.py'
--- lib/lp/bugs/mail/bugnotificationrecipients.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/mail/bugnotificationrecipients.py 2010-11-04 19:16:11 +0000
@@ -10,7 +10,7 @@
from zope.interface import implements
-from canonical.launchpad.interfaces import INotificationRecipientSet
+from canonical.launchpad.interfaces.launchpad import INotificationRecipientSet
from lp.services.mail.basemailer import RecipientReason
from lp.services.mail.notificationrecipientset import NotificationRecipientSet
=== modified file 'lib/lp/bugs/scripts/checkwatches/core.py'
--- lib/lp/bugs/scripts/checkwatches/core.py 2010-10-26 15:47:24 +0000
+++ lib/lp/bugs/scripts/checkwatches/core.py 2010-11-04 19:16:11 +0000
@@ -36,15 +36,7 @@
from zope.component import getUtility
from canonical.database.sqlbase import flush_database_updates
-from canonical.launchpad.interfaces import (
- CreateBugParams,
- IBugTrackerSet,
- IBugWatchSet,
- IDistribution,
- ILaunchpadCelebrities,
- IPersonSet,
- PersonCreationRationale,
- )
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.scripts.logger import log as default_log
from lp.bugs import externalbugtracker
from lp.bugs.externalbugtracker import (
@@ -52,6 +44,9 @@
BugWatchUpdateError,
UnknownBugTrackerTypeError,
)
+from lp.bugs.interfaces.bug import CreateBugParams
+from lp.bugs.interfaces.bugtracker import IBugTrackerSet
+from lp.bugs.interfaces.bugwatch import IBugWatchSet
from lp.bugs.scripts.checkwatches.base import (
commit_before,
with_interaction,
@@ -61,6 +56,11 @@
from lp.bugs.scripts.checkwatches.utilities import (
get_bugwatcherrortype_for_error,
)
+from lp.registry.interfaces.distribution import IDistribution
+from lp.registry.interfaces.person import (
+ IPersonSet,
+ PersonCreationRationale,
+ )
from lp.services.database.bulk import reload
from lp.services.scripts.base import LaunchpadCronScript
=== modified file 'lib/lp/bugs/scripts/checkwatches/scheduler.py'
--- lib/lp/bugs/scripts/checkwatches/scheduler.py 2010-10-03 15:30:06 +0000
+++ lib/lp/bugs/scripts/checkwatches/scheduler.py 2010-11-04 19:16:11 +0000
@@ -11,7 +11,7 @@
import transaction
from canonical.database.sqlbase import sqlvalues
-from canonical.launchpad.interfaces import IMasterStore
+from canonical.launchpad.interfaces.lpstorm import IMasterStore
from canonical.launchpad.utilities.looptuner import TunableLoop
from lp.bugs.interfaces.bugwatch import BUG_WATCH_ACTIVITY_SUCCESS_STATUSES
from lp.bugs.model.bugwatch import BugWatch
=== modified file 'lib/lp/coop/answersbugs/model.py'
--- lib/lp/coop/answersbugs/model.py 2010-10-03 15:30:06 +0000
+++ lib/lp/coop/answersbugs/model.py 2010-11-04 19:16:11 +0000
@@ -13,7 +13,7 @@
from zope.interface import implements
from canonical.database.sqlbase import SQLBase
-from canonical.launchpad.interfaces import IQuestionBug
+from lp.coop.answersbugs.interfaces import IQuestionBug
class QuestionBug(SQLBase):
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py 2010-10-17 22:51:50 +0000
+++ lib/lp/scripts/garbo.py 2010-11-04 19:16:11 +0000
@@ -43,8 +43,8 @@
)
from canonical.launchpad.database.oauth import OAuthNonce
from canonical.launchpad.database.openidconsumer import OpenIDConsumerNonce
-from canonical.launchpad.interfaces import IMasterStore
from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus
+from canonical.launchpad.interfaces.lpstorm import IMasterStore
from canonical.launchpad.utilities.looptuner import TunableLoop
from canonical.launchpad.webapp.interfaces import (
IStoreSelector,
=== modified file 'lib/lp/services/fields/__init__.py'
--- lib/lp/services/fields/__init__.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/fields/__init__.py 2010-11-04 19:16:11 +0000
@@ -340,7 +340,7 @@
def _get_schema(self):
"""Get the schema here to avoid circular imports."""
- from canonical.launchpad.interfaces import IBug
+ from lp.bugs.interfaces.bug import IBug
return IBug
def _set_schema(self, schema):
@@ -809,7 +809,7 @@
def is_public_person(person):
"""Return True if the person is public."""
- from canonical.launchpad.interfaces import IPerson, PersonVisibility
+ from lp.registry.interfaces.person import IPerson, PersonVisibility
if not IPerson.providedBy(person):
return False
return person.visibility == PersonVisibility.PUBLIC
=== modified file 'lib/lp/services/mail/incoming.py'
--- lib/lp/services/mail/incoming.py 2010-10-15 19:29:58 +0000
+++ lib/lp/services/mail/incoming.py 2010-11-04 19:16:11 +0000
@@ -27,15 +27,14 @@
directlyProvides,
)
-from canonical.launchpad.interfaces import (
- AccountStatus,
+from canonical.launchpad.interfaces.account import AccountStatus
+from canonical.launchpad.interfaces.gpghandler import (
GPGVerificationError,
IGPGHandler,
- ILibraryFileAliasSet,
- IMailBox,
- IPerson,
- IWeaklyAuthenticatedPrincipal,
)
+from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
+from canonical.launchpad.interfaces.mail import IWeaklyAuthenticatedPrincipal
+from canonical.launchpad.interfaces.mailbox import IMailBox
from canonical.launchpad.mail.commands import get_error_message
from canonical.launchpad.mail.handlers import mail_handlers
from canonical.launchpad.mailnotification import (
@@ -51,6 +50,7 @@
)
from canonical.launchpad.webapp.interfaces import IPlacelessAuthUtility
from canonical.librarian.interfaces import UploadFailed
+from lp.registry.interfaces.person import IPerson
from lp.services.mail.sendmail import do_paranoid_envelope_to_validation
from lp.services.mail.signedmessage import signed_message_from_string
=== modified file 'lib/lp/services/mail/mailbox.py'
--- lib/lp/services/mail/mailbox.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/mail/mailbox.py 2010-11-04 19:16:11 +0000
@@ -10,7 +10,7 @@
from zope.interface import implements
-from canonical.launchpad.interfaces import (
+from canonical.launchpad.interfaces.mailbox import (
IMailBox,
MailBoxError,
)
=== modified file 'lib/lp/services/mail/notificationrecipientset.py'
--- lib/lp/services/mail/notificationrecipientset.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/mail/notificationrecipientset.py 2010-11-04 19:16:11 +0000
@@ -15,7 +15,7 @@
from zope.security.proxy import isinstance as zope_isinstance
from canonical.launchpad.helpers import emailPeople
-from canonical.launchpad.interfaces import (
+from canonical.launchpad.interfaces.launchpad import (
INotificationRecipientSet,
UnknownRecipientError,
)
=== modified file 'lib/lp/services/mail/signedmessage.py'
--- lib/lp/services/mail/signedmessage.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/mail/signedmessage.py 2010-11-04 19:16:11 +0000
@@ -15,7 +15,7 @@
from zope.interface import implements
-from canonical.launchpad.interfaces import ISignedMessage
+from canonical.launchpad.interfaces.mail import ISignedMessage
clearsigned_re = re.compile(
=== modified file 'lib/lp/services/mailman/testing/sync.py'
--- lib/lp/services/mailman/testing/sync.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/mailman/testing/sync.py 2010-11-04 19:16:11 +0000
@@ -30,10 +30,8 @@
login,
logout,
)
-from canonical.launchpad.interfaces import (
- IEmailAddressSet,
- IPersonSet,
- )
+from canonical.launchpad.interfaces.emailaddress import IEmailAddressSet
+from lp.registry.interfaces.person import IPersonSet
class SyncDetails:
=== modified file 'lib/lp/services/scripts/base.py'
--- lib/lp/services/scripts/base.py 2010-11-01 12:56:23 +0000
+++ lib/lp/services/scripts/base.py 2010-11-04 19:16:11 +0000
@@ -16,7 +16,11 @@
from optparse import OptionParser
import os.path
import sys
-from urllib2 import urlopen, HTTPError, URLError
+from urllib2 import (
+ HTTPError,
+ URLError,
+ urlopen,
+ )
from contrib.glock import (
GlobalLock,
@@ -28,7 +32,6 @@
from canonical.config import config
from canonical.database.sqlbase import ISOLATION_LEVEL_DEFAULT
from canonical.launchpad import scripts
-from canonical.launchpad.interfaces import IScriptActivitySet
from canonical.launchpad.scripts.logger import OopsHandler
from canonical.launchpad.webapp.errorlog import globalErrorUtility
from canonical.launchpad.webapp.interaction import (
@@ -36,6 +39,7 @@
setupInteractionByEmail,
)
from canonical.lp import initZopeless
+from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
LOCK_PATH = "/var/lock/"
=== modified file 'lib/lp/services/scripts/model/scriptactivity.py'
--- lib/lp/services/scripts/model/scriptactivity.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/scripts/model/scriptactivity.py 2010-11-04 19:16:11 +0000
@@ -17,7 +17,7 @@
from canonical.database.datetimecol import UtcDateTimeCol
from canonical.database.sqlbase import SQLBase
-from canonical.launchpad.interfaces import (
+from lp.services.scripts.interfaces.scriptactivity import (
IScriptActivity,
IScriptActivitySet,
)
=== modified file 'lib/lp/services/worlddata/model/language.py'
--- lib/lp/services/worlddata/model/language.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/worlddata/model/language.py 2010-11-04 19:16:11 +0000
@@ -26,7 +26,7 @@
SQLBase,
sqlvalues,
)
-from canonical.launchpad.interfaces import ISlaveStore
+from canonical.launchpad.interfaces.lpstorm import ISlaveStore
from lp.app.errors import NotFoundError
from lp.services.worlddata.interfaces.language import (
ILanguage,
=== modified file 'lib/lp/testing/_webservice.py'
--- lib/lp/testing/_webservice.py 2010-10-03 15:30:06 +0000
+++ lib/lp/testing/_webservice.py 2010-11-04 19:16:11 +0000
@@ -26,13 +26,11 @@
from zope.component import getUtility
import zope.testing.cleanup
-from canonical.launchpad.interfaces import (
- IOAuthConsumerSet,
- IPersonSet,
- )
+from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
from canonical.launchpad.webapp.adapter import get_request_statements
from canonical.launchpad.webapp.interaction import ANONYMOUS
from canonical.launchpad.webapp.interfaces import OAuthPermission
+from lp.registry.interfaces.person import IPersonSet
from lp.testing._login import (
login,
logout,
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2010-11-03 23:44:56 +0000
+++ lib/lp/testing/factory.py 2010-11-04 19:16:11 +0000
@@ -67,10 +67,6 @@
Message,
MessageChunk,
)
-from canonical.launchpad.interfaces import (
- IMasterStore,
- IStore,
- )
from canonical.launchpad.interfaces.account import (
AccountCreationRationale,
AccountStatus,
@@ -83,6 +79,10 @@
from canonical.launchpad.interfaces.gpghandler import IGPGHandler
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
+from canonical.launchpad.interfaces.lpstorm import (
+ IMasterStore,
+ IStore,
+ )
from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
from canonical.launchpad.interfaces.temporaryblobstorage import (
ITemporaryStorageManager,
=== modified file 'lib/lp/testing/mail.py'
--- lib/lp/testing/mail.py 2010-10-03 15:30:06 +0000
+++ lib/lp/testing/mail.py 2010-11-04 19:16:11 +0000
@@ -10,7 +10,7 @@
from zope.component import getUtility
-from canonical.launchpad.interfaces import IMailBox
+from canonical.launchpad.interfaces.mailbox import IMailBox
from canonical.launchpad.mail import (
get_msgid,
MailController,
=== modified file 'utilities/migrater/deglob.py'
--- utilities/migrater/deglob.py 2010-10-20 20:45:23 +0000
+++ utilities/migrater/deglob.py 2010-11-04 19:16:11 +0000
@@ -5,6 +5,9 @@
#find true path
#replace all occurences.
+import os
+import sys
+
from find import find_matches
@@ -228,10 +231,8 @@
print " %(lineno)4s: %(text)s" % line
-def update_multi_python_globs_to_interfaces():
- root = 'lib'
- types = r'tests'
- pattern = r'from canonical\.launchpad\.interfaces import'
+def update_multi_python_globs_to_interfaces(root='lib', types='tests'):
+ pattern=r'from canonical\.launchpad\.interfaces import'
substitution = True
for summary in find_matches(
root, types, pattern, substitution=substitution,
@@ -241,9 +242,8 @@
print " %(lineno)4s: %(text)s" % line
-def update_python_globs_to_interfaces():
- root = 'lib'
- types = r'tests'
+def update_python_globs_to_interfaces(root='lib', types='tests'):
+ update_multi_python_globs_to_interfaces(root=root, types=types)
globs = r'from \bcanonical\.launchpad\.interfaces import (\w+)$'
interfaces = get_interfaces(types=types, globs=globs)
interface_modules = get_interface_modules(interfaces)
@@ -259,8 +259,12 @@
def main():
- update_multi_python_globs_to_interfaces()
- update_python_globs_to_interfaces()
+ if len(sys.argv) != 3:
+ print 'Usage: %s root_path file_test', os.path.basename(sys.argv[0])
+ sys.exit(1)
+ root = sys.argv[1]
+ types = sys.argv[2]
+ update_python_globs_to_interfaces(root, types)
if __name__ == '__main__':