/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 bzrlib/plugins/launchpad/lp_api.py

  • Committer: Max Bowsher
  • Date: 2011-02-03 05:13:46 UTC
  • mfrom: (5609.2.7 2.3)
  • mto: This revision was merged to the branch mainline in revision 5642.
  • Revision ID: maxb@f2s.com-20110203051346-r2yxauojo6b2umqi
Merge 2.3 into trunk including fix for lp:707075.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    STAGING_SERVICE_ROOT,
48
48
    Launchpad,
49
49
    )
50
 
try:
51
 
    from launchpadlib import uris
52
 
except ImportError:
53
 
    # Create a minimal object so the getattr() calls below fail gently and
54
 
    # provide default values
55
 
    uris = object()
56
50
 
57
 
LPNET_SERVICE_ROOT = getattr(uris, 'LPNET_SERVICE_ROOT',
58
 
                             'https://api.launchpad.net/beta/')
59
 
QASTAGING_SERVICE_ROOT = getattr(uris, 'QASTAGING_SERVICE_ROOT',
60
 
                                 'https://api.qastaging.launchpad.net/')
61
51
 
62
52
# Declare the minimum version of launchpadlib that we need in order to work.
63
53
# 1.5.1 is the version of launchpadlib packaged in Ubuntu 9.10, the most
84
74
            installed_version, installed_version)
85
75
 
86
76
 
 
77
# The older versions of launchpadlib only provided service root constants for
 
78
# edge and staging, whilst newer versions drop edge. Therefore service root
 
79
# URIs for which we do not always have constants are derived from the staging
 
80
# one, which does always exist.
 
81
#
 
82
# It is necessary to derive, rather than use hardcoded URIs because
 
83
# launchpadlib <= 1.5.4 requires service root URIs that end in a path of
 
84
# /beta/, whilst launchpadlib >= 1.5.5 requires service root URIs with no path
 
85
# info.
 
86
#
 
87
# Once we have a hard dependency on launchpadlib >= 1.5.4 we can replace all of
 
88
# bzr's local knowledge of individual Launchpad instances with use of the
 
89
# launchpadlib.uris module.
87
90
LAUNCHPAD_API_URLS = {
88
 
    'production': LPNET_SERVICE_ROOT,
89
 
    'qastaging': QASTAGING_SERVICE_ROOT,
 
91
    'production': STAGING_SERVICE_ROOT.replace('api.staging.launchpad.net',
 
92
        'api.launchpad.net'),
 
93
    'qastaging': STAGING_SERVICE_ROOT.replace('api.staging.launchpad.net',
 
94
        'api.qastaging.launchpad.net'),
90
95
    'staging': STAGING_SERVICE_ROOT,
91
 
    'dev': 'https://api.launchpad.dev/beta/',
 
96
    'dev': STAGING_SERVICE_ROOT.replace('api.staging.launchpad.net',
 
97
        'api.launchpad.dev'),
92
98
    }
93
99
 
94
100
 
199
205
        if str(launchpad._root_uri) == STAGING_SERVICE_ROOT:
200
206
            return url.replace('bazaar.launchpad.net',
201
207
                               'bazaar.staging.launchpad.net')
202
 
        elif str(launchpad._root_uri) == QASTAGING_SERVICE_ROOT:
 
208
        elif str(launchpad._root_uri) == LAUNCHPAD_API_URLS['qastaging']:
203
209
            return url.replace('bazaar.launchpad.net',
204
210
                               'bazaar.qastaging.launchpad.net')
205
211
        return url