
Tc           @   sc   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Td  d l j Z d e f d     YZ	 d S(   iN(   t   *t	   bugreportc           B   sz   e  Z d  Z d Z d d d d e e d e j d e d 
 Z	 d   Z
 d   Z e e e
  Z d   Z d	   Z d
   Z RS(   sF   Encapsulates a bug report into a convenient object we can pass around.s   utf-8t    t   debiant   debbugsc         K   s   | |  _  x* | j   D] \ } } t |  | |  q W| |  _ | |  _ | r t | t  r y | j |  _ Wq t	 j
 d  t  q Xn	 | |  _ | |  _ |	 |  _ | |  _ | |  _ | |  _ |
 |  _ | |  _ d  S(   NsS   Invalid value for followup, it must be a debianbts.Bugreport instance or an integer(   t   typet	   iteritemst   setattrt   packaget   subjectt
   isinstancet   intt   bug_numt   followupt   uit   long_messaget	   TypeErrort   bodyt   modet   systemt   incfilest   sysinfot   debsumsoutputt   issource(   t   selfR   R	   R   R   R   R   R   R   R   R   R   t   propst   kt   v(    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyt   __init__(   s&    										c         C   s6   | d k r) t  j d |  d |  _ n	 | |  _ d  S(   NR   t	   launchpads-   invalid report type %s, defaulting to debbugs(   s   debbugsR   (   R   R   t   _bugreport__type(   R   t   value(    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyt   tsetC   s
    	c         C   s   |  j  S(   N(   R   (   R   (    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyt   tgetK   s    c      	   C   s  t  j   } d } t j d  } t j   } g  } t  j j d d  } t  j j d d  } x d; D] } | d k r | }	 nS d t  j j | |  t j d	  f }	 | r |	 r d
 |	 | f }	 n | p |	 }	 | j	 d | |	 f  qd Wd j
 |  } t |  d d   }
 |
 r*d j
 |
  d } n d } t |  d d   } | rY| d | 7} n  t |  d d  } | j d  } |  j t j k  r|  j t j |  j j d i   j   k rt j d | } n | sd } n  |  j rd } n d } |  j s{xd t d d d d d d d d  j   D]; \ } } t |  | d   } | r#| d | | f 7} q#q#Wd  | |  j | f } n d! |  j | |  j | f } t j |  j j d" t j  } | r| |   7} n  | d# d$ k r| d% } n | d# } | j d&  r| d' } n  d( | | d) f } | d* k rg  } d+ | d% k rt j   } | d, k rq| d- | g 7} q| d, k r| d. g 7} qn  d/ | d% k r| d/ g 7} n  | rd0 | d1 j
 |  f } qn  | r| d2 | 7} n  | r| d3 | 7} n  | d k r | d4 | 7} n  | r7| d5 | 7} n  |  j r\d6 | | |  j | f } n d7 | | |  j f } t |  d8  r| |  j  7} n  t |  d9  r| |  j! 7} n  |  j" r| d: |  j" 7} n  | S(<   Nu    s   /bin/sht   LANGt   Ct   LC_ALLR   t   LC_CTYPEs   %s (charmap=%s)s   locale charmaps   %s (ignored: LC_ALL set to %s)s   %s=%ss   , t   pseudoheadersu   
t   versionu   Version: %s
R   t   utf8t   specialsu   

t   Sourcet   Packaget   severityt   Severityt   justificationt   Justificationt   tagst   Tagst   filenamet   Fileu   %s: %s
u
   %s: %s
%s
s    Followup-For: Bug #%d
%s: %s
%s
t   infofunci    t   GNUi   s   GNU/i   s   %s %si   t   Linuxt   SMPi   s   SMP w/%d CPU coress   SMP w/1 CPU coret   PREEMPTs   %s (%s)s   ; u   Kernel: %s
u   Locale: %s
u   Shell: /bin/sh linked to %s
u	   Init: %s
u    %s%s%s
-- System Information:
%su   %s%s%st   depinfot   confinfou   
-- debsums errors found:
%s
(   R"   s   LC_CTYPE(#   t   ost   unamet   utilst   realpatht   get_init_systemt   environt   gett   commandst	   getoutputt   appendt   joint   getattrt   Nonet   decodeR   t   MODE_ADVANCEDR   R   t   SYSTEMSR   t   keyst
   NEWBIELINER   R   t   dictR   t   generic_infofunct
   startswitht   get_cpu_coresR   R   t   hasattrR9   R:   R   (   R   t   unt   debinfot	   shellpatht   initt   locinfot   langsettingt
   allsettingt   settingt   envt   pht   headersR'   R   t   reporttot   attrt   namet   at   reportR4   t   uname_stringt   kernt   kinfot   cores(    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyt   __unicode__O   s    	(%				
		c         C   s   t  |   j t d  S(   Nt   replace(   t   unicodet   encodet   charset(   R   (    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyt   __str__   s    c         C   s=   g  t  |   D] } d | |  j f ^ q } d d j |  S(   Ns   %s=%ss   bugreport(%s)s   , (   t   dirR   RE   (   R   R   t   params(    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyt   __repr__   s    ,N(   t   __name__t
   __module__t   __doc__Rj   t   Truet   FalseR=   t   MODE_STANDARDRG   R   R    R!   t   propertyR   Rf   Rk   Rn   (    (    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyR   "   s   				w	(
   R;   R=   R   RB   t
   exceptionst
   ui.text_uit   text_uiR   t   objectR   (    (    (    s7   /usr/lib/python2.7/dist-packages/reportbug/bugreport.pyt   <module>   s   
