
    z#g                     X    S SK Jr  SSKJr  SSKJr  S SKJr  Sr " S S\5      r	SS
 jr
g	)    )
HTMLParser   )utils)open_url)	NoNetworkz2https://buildd.debian.org/build.php?arch=%s&pkg=%sc                   <    \ rS rSrS rS rS rS
S jrS rS r	Sr
g	)BuilddParser$   c                 Z    [         R                  " U 5        0 U l        S U l        SU l        g )NF)r   __init__versionssavedatafound_succeededselfs    7/usr/lib/python3/dist-packages/reportbug/checkbuildd.pyr   BuilddParser.__init__%   s&    D!$    c                 H    U R                   b  U R                   U-   U l         g g )Nr   )r   datas     r   handle_dataBuilddParser.handle_data.   s!    ==$ MMD0DM %r   c                     SU l         g )N r   r   s    r   save_bgnBuilddParser.save_bgn3   s	    r   c                 ~    U R                   nS U l         U(       d"  Ub  SR                  UR                  5       5      nU$ )N )r   joinsplit)r   moder   s      r   save_endBuilddParser.save_end6   s3    }}(88DJJL)Dr   c                 2    US:X  a  U R                  5         g g )Ntd)r   )r   tagattrss      r   handle_starttagBuilddParser.handle_starttag=   s    $;MMO r   c                 z    US:X  a5  U R                  5       nU(       a  SUR                  5       ;   a  SU l        g g g g )Nr&   
successfulT)r#   lowerr   )r   r'   r   s      r   handle_endtagBuilddParser.handle_endtagA   s8    $;==?D

4'+$ 5t r   )r   r   r   N)r   )__name__
__module____qualname____firstlineno__r   r   r   r#   r)   r.   __static_attributes__ r   r   r	   r	   $   s     %1
,r   r	   Nc                     U(       d  [         R                  " 5       n [        [        X 4-  X15      nU(       d  g[        5       nUR                  U5        UR                  $ ! [         a     gf = f)a  
Check if a source package was built successfully on a buildd

The check is not about a specific package version. If `arch` is not
given and there is evidence that any version of the package once
built sucessfully on any architecture, this function returns True.

If `arch` is given, the check is restricted to that architecture.

Parameters
----------
src_package : str
    name of a source package
timeout : int
    connection timeout in seconds
arch : str, optional
    the arch to be checked
http_proxy : str, optional
    Http proxy url to use for connection

Returns
-------
bool
    True if the connection succeeded and the package was found to
    have built successfully, otherwise False
F)r   get_archr   
BUILDD_URLr   r	   feedr   )src_packagetimeoutarch
http_proxypageparsers         r   check_builtr@   H   sg    6 ~~
d%88*N ^F
KK!!!  s   A! !
A.-A.)NN)html.parserr   r   r   urlutilsr   reportbug.exceptionsr   r8   r	   r@   r5   r   r   <module>rD      s/   0 #   B
!,: !,H)"r   