/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/launchpad/lp_api.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-01-28 22:51:17 UTC
  • mfrom: (7254.1.2 lp-imports)
  • Revision ID: breezy.the.bot@gmail.com-20190128225117-pwtq0jjseq9pdn0e
Delay importing launchpadlib, so brz works for users without it.

Merged from https://code.launchpad.net/~jelmer/brz/lp-imports/+merge/362354

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
# needed by a command that uses it.
24
24
 
25
25
 
26
 
import httplib2
27
26
import re
28
27
try:
29
28
    from urllib.parse import (
52
51
    raise errors.DependencyNotPresent('launchpadlib', e)
53
52
 
54
53
from launchpadlib.launchpad import (
55
 
    STAGING_SERVICE_ROOT,
56
54
    Launchpad,
57
55
    )
58
56
from launchpadlib import uris
122
120
    :return: The root `Launchpad` object from launchpadlib.
123
121
    """
124
122
    if proxy_info is None:
 
123
        import httplib2
125
124
        proxy_info = httplib2.proxy_info_from_environment('https')
126
125
    cache_directory = get_cache_directory()
127
126
    return Launchpad.login_with(
196
195
    @staticmethod
197
196
    def tweak_url(url, launchpad):
198
197
        """Adjust a URL to work with staging, if needed."""
199
 
        if str(launchpad._root_uri) == STAGING_SERVICE_ROOT:
 
198
        if str(launchpad._root_uri) == uris.STAGING_SERVICE_ROOT:
200
199
            return url.replace('bazaar.launchpad.net',
201
200
                               'bazaar.staging.launchpad.net')
202
201
        elif str(launchpad._root_uri) == lookup_service_root('qastaging'):