-=[ Mr. Bumblebee ]=-
_Indonesia_
:Nc @@ s d Z d d l m Z y d d l Z Wn; e k
rc y d d l Z Wqd e k
r_ d Z qd Xn Xd d l Z d d l Z d d l Z d d l
m Z m Z d e
f d YZ d Z d Z d Z d
Z d Z d S( s6 Tools for dealing with the Launchpad API without using launchpadlib.
The api itself is a RESTful interface, so we can make HTTP queries directly.
loading launchpadlib itself has a fairly high overhead (just calling
Launchpad.login_anonymously() takes a 500ms once the WADL is cached, and 5+s to
get the WADL.
i ( t absolute_importN( t revisiont tracet LatestPublicationc B@ sn e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z
d Z d
Z d Z
RS( sC Encapsulate how to find the latest publication for a given project.s https://api.launchpad.net/1.0c C@ s# | | _ | | _ | j | d S( N( t _archivet _projectt _setup_series_and_pocket( t selft archivet seriest project( ( sH /usr/lib/python2.7/dist-packages/bzrlib/plugins/launchpad/lp_api_lite.pyt __init__5 s c C@ ss | | _ d | _ | j d k rf d | j k rf | j j d d \ | _ | _ | j j | _ n d | _ d S( s Parse the 'series' info into a series and a pocket.
eg::
_setup_series_and_pocket('natty-proposed')
=> _series == 'natty'
_pocket == 'Proposed'
t -i t ReleaseN( t _seriest Nonet _pockett splitt title( R R ( ( sH /usr/lib/python2.7/dist-packages/bzrlib/plugins/launchpad/lp_api_lite.pyR : s !c C@ s d | j | j f S( s Return the Launchpad 'Archive' URL that we will query.
This is everything in the URL except the query parameters.
s %s/%s/+archive/primary( t LP_API_ROOTR ( R ( ( sH /usr/lib/python2.7/dist-packages/bzrlib/plugins/launchpad/lp_api_lite.pyt _archive_URLJ s c C@ s | j d k r d Sd S( s Handle the 'status' field.
It seems that Launchpad tracks all 'debian' packages as 'Pending', while
for 'ubuntu' we care about the 'Published' packages.
t debiant Pendingt Published( R ( R ( ( sH /usr/lib/python2.7/dist-packages/bzrlib/plugins/launchpad/lp_api_lite.pyt _publication_statusP s c C@ s i d d 6d d 6d | j f d 6| j d 6d d 6} | j d
k re d
| j | j f | d <n | j d
k r | j | d <n | S( s Get the parameters defining our query.
This defines the actions we are making against the archive.
:return: A dict of query parameters.
t getPublishedSourcess ws.opt truet exact_matchs "%s"t source_namet statust 1s ws.sizes /%s/%st
distro_seriest pocketN( R R R R R R ( R t params( ( sH /usr/lib/python2.7/dist-packages/bzrlib/plugins/launchpad/lp_api_lite.pyt
_query_params[ s
c C@ s; | j } t j t | j } d | j | f S( s@ Create the full URL that we need to query, including parameters.s %s?%s( R"