Ñò
U<•hc           @   së  d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z e i i d ƒ Z e i	 i
 e ƒ d d k l Z d d k l Z d d k l Z d Z d Z e e e ƒ Z g  Z h  Z h  Z h  Z h  Z e e e ƒ Z d	 Z d
 d! d „  ƒ  YZ d „  Z d d" d „  ƒ  YZ d „  Z d d# d „  ƒ  YZ d „  Z d d$ d „  ƒ  YZ d „  Z  d „  Z! d d% d „  ƒ  YZ" d „  Z# d „  Z$ d „  Z% d „  Z& d „  Z' d „  Z( e) d j o6 e i* ƒ  p d  e i+ j o qçe( ƒ  e i, ƒ  n d S(&   sØ   
   sql2htmldoc.py - Create web pages for BIRCH documentation from birchdocdb database

   Synopsis: sql2htmldoc.py

@modified: August 5, 2025
@author: Brian Fristensky and Dale Hamel
@contact: frist@cc.umanitoba.ca
iÿÿÿÿNt   BIRCHLIB(   t   Birchmod(   t	   Htmlutils(   t
   HTMLWriters   sql2htmldoc.py: s7   
	 USAGE: sql2htmldoc.py [currently takes no paramters]s   
t
   Parametersc           B   s   e  Z d  Z d „  Z RS(   s#   Wrapper class for global parametersc         C   sb  d } t  i i | ƒ o¤ d GHd |  _ d |  _ t | d ƒ } xm | D]e } | i d ƒ } | d d j o | d i ƒ  |  _ n | d d	 j o | d i ƒ  |  _ qF qF W| i ƒ  n d
 GHt  i	 d |  _ d } y t  i	 d } Wn n X| d j o | |  _ n d |  i GHd |  i GH|  i d |  _
 |  i d |  _ |  i d |  _ d |  _ d S(   s.  
          Get the location of the BIRCH home directory, BIRCHPATH
          Preferrably, we get it from the BIRCH.properties file,
          but if that isn't found, we get it from the BIRCH
          environment variable. The one catch is that since
          we don't already know the location of BIRCHPATH,
          the former will only work if the current working
          directory is install-scripts. Normally, this would
          only be used when installing or updating BIRCH
          Otherwise, the environment variable will be read.
          s   ../local/admin/BIRCH.propertiess4   sql2htmldoc.py: Reading $BIRCH from BIRCH.propertiest    t   rt   =i    s   BirchProps.homediri   s   BirchProps.platformsI   sql2htmldoc.py: Reading $BIRCH and $BIRCH_PLATFORM environment variables.t   BIRCHt   BIRCH_PLATFORMs"   sql2htmldoc.py: BIRCHPATH set to: s'   sql2htmldoc.py: BIRCH_PLATFORM set to: s   /public_htmls   /public_html/birchdocdbs   /local/public_html/birchdocdbN(   t   ost   patht   existst	   BIRCHPATHR	   t   opent   splitt   stript   closet   environt   BIRCHWEBPATHt   BIRCHDBPATHt   BIRCHLOCALDBPATHt   OUTFILE(   t   selft   FNt   FILEt   LINEt   TOKENSt   plat(    (    s   ./sql2htmldoc.pyt   __init__)   s:    		 (   t   __name__t
   __module__t   __doc__R   (    (    (    s   ./sql2htmldoc.pyR   &   s   c         C   s"   | |  j o n |  i  | ƒ d S(   sØ   
    If a list contains NAME, do nothing
    If it does not exist, append it to the list
    @param L: The list to check for name
    @type L: list
    @param NAME: The name to be checked for
    @type NAME: str
    N(   t   append(   t   Lt   NAME(    (    s   ./sql2htmldoc.pyt	   AddToList]   s    
t   Categoryc           B   s   e  Z d  „  Z RS(   c         C   s   d |  _  g  |  _ g  |  _ d S(   sv   
          Initializes arguments:
                name=""
                program=[]
                pkg=[]
          R   N(   t   namet   programt   pkg(   R   (    (    s   ./sql2htmldoc.pyR   o   s    		(   R   R   R   (    (    (    s   ./sql2htmldoc.pyR%   m   s   c   
         sÛ   ‡  f d †  } |  i  d ƒ i ƒ  } x° | D]¨ } | d } | | ƒ } |  i  d d | d ƒ i ƒ  } x" | D] } | i i | d ƒ qo W|  i  d d | d ƒ i ƒ  }	 x" |	 D] } | i i | d ƒ qµ Wq+ Wd S(	   sÂ   
    Read category.ace into a list of category objects
    @param cursor: The cursor pointing to the SQL database
    @param CATS: The categories object to be read into
    @type CATS: list
    c            s>   |  t  j o t  |  } n  t ƒ  } ˆ  i | ƒ |  | _ | S(   só   
        "If a category called NAME already exists, return a pointer"
        "If it does not exist, create a new category object and return a pointer"
        @param NAME: The name of the category to check for
        @type NAME: str
        (   t   CATDICTR%   R!   R&   (   R#   t   C(   t   CATS(    s   ./sql2htmldoc.pyt   AssignCategory„   s    		s   SELECT CatName from Category;i    s-   SELECT Program from ProgCat WHERE Category = t   's   ';s,   SELECT Package from PkgCat WHERE Category = N(   t   executet   fetchallR'   R!   R(   (
   t   cursorR+   R,   t   resultt   itemR&   R*   t   progst   pR(   (    (   R+   s   ./sql2htmldoc.pyt   ReadCategory{   s    	 
! ! t   Packagec           B   s   e  Z d  „  Z RS(   c         C   sL   d |  _  d |  _ g  |  _ g  |  _ g  |  _ g  |  _ g  |  _ d |  _ d S(   s  
          Initializes arguments:
                name=""
                description=""
                category=[]
                doc=[]
                program=[]
                data=[]
                platform=[]
                installation=[]
          R   N(   R&   t   descriptiont   categoryt   docR'   t   datat   platformt   installation(   R   (    (    s   ./sql2htmldoc.pyR   ¡   s    							(   R   R   R   (    (    (    s   ./sql2htmldoc.pyR6   Ÿ   s   c            sÇ  ‡  f d †  } |  i  d ƒ i ƒ  } xœ| D]”} | d } | | ƒ } | d | _ | d | _ |  i  d d | d ƒ i ƒ  } x" | D] } | i i | d ƒ q‰ W|  i  d	 d | d ƒ i ƒ  }	 x" |	 D] } | i i | d ƒ qÏ W|  i  d
 d | d ƒ i ƒ  }
 x" |
 D] } | i i | d ƒ qW|  i  d d | d ƒ i ƒ  } x" | D] } | i i | d ƒ q[W|  i  d d | d ƒ i ƒ  } x" | D] } | i	 i | d ƒ q¡Wq+ Wd S(   sÎ   
    Read package.ace into a list of Package objects
    @param FN: The name of the file to be read in
    @type FN: str
    @param PKGS: The list of package objects to be read into
    @type PKGS:list
    c            s>   |  t  j o t  |  } n  t ƒ  } ˆ  i | ƒ |  | _ | S(   sã   
        If a package called NAME already exists, return a pointer
        If it does not exist, create a new package object and return a pointer
        @param NAME:The name to attempt to assign
        @type NAME:str
        (   t   PKGDICTR6   R!   R&   (   R#   t   PK(   t   PKGS(    s   ./sql2htmldoc.pyt   AssignPackageÁ   s    		s2   SELECT Name,Description,Installation from Package;i    i   i   s,   SELECT Category from PkgCat WHERE Package = R-   s   ';s1   SELECT Documentation from PkgDoc WHERE Package = s,   SELECT Program from PkgProg WHERE Package = s(   SELECT Data from PkgDat WHERE Package = s-   SELECT Platform from PkgPlat WHERE Package = N(
   R.   R/   R7   R<   R8   R!   R9   R'   R:   R;   (   R0   R?   R@   R1   R2   R&   R*   t   catst   ct   docsR3   t   datR   (    (   R?   s   ./sql2htmldoc.pyt   ReadPackage·   s8    
 
! ! ! ! ! t   Programc           B   s   e  Z d  „  Z RS(   c         C   sg   d |  _  d |  _ g  |  _ g  |  _ d |  _ g  |  _ g  |  _ g  |  _ g  |  _ g  |  _	 d |  _
 d S(   sA  
          Initializes arguments:
                name=""
                description=""
                category=[]
                interface=[]
                package=""
                doc=[]
                data=[]
                sampleinput=[]
                sampleoutput=[]
                platform=[]
          R   N(   R&   R7   R8   t	   interfacet   packageR9   R:   t   sampleinputt   sampleoutputR;   R<   (   R   (    (    s   ./sql2htmldoc.pyR   ì   s    										(   R   R   R   (    (    (    s   ./sql2htmldoc.pyRF   ê   s   c            sŽ  ‡  f d †  } |  i  d ƒ i ƒ  } xc| D][} | d } | | ƒ } | d | _ | d | _ |  i  d d | d ƒ i ƒ  } x | D] } | i i | ƒ q‰ W|  i  d	 d | d ƒ i ƒ  }	 x" |	 D] }
 | i i |
 d ƒ qË W|  i  d
 d | d ƒ i ƒ  } x" | D] }
 | i i |
 d ƒ qW|  i  d d | d ƒ i ƒ  } x | D] }
 |
 d | _ qWW|  i  d d | d ƒ i ƒ  } x" | D] }
 | i	 i |
 d ƒ q–W|  i  d d | d ƒ i ƒ  } x" | D] }
 | i
 i |
 d ƒ qÜW|  i  d d | d ƒ i ƒ  } x" | D] }
 | i i |
 d ƒ q"W|  i  d d | d ƒ i ƒ  } x" | D] }
 | i i |
 d ƒ qhWq+ Wd S(   s×   
    Read program.ace into a list of Program objects
    @param FN: The name of the file to be read in
    @type FN: str
    @param PROGS: The list of Program objects to read the file into
    @type PROGS: list
    c            s>   |  t  j o t  |  } n  t ƒ  } ˆ  i | ƒ |  | _ | S(   så   
        If a program called NAME already exists, return a pointer
        If it does not exist, create a new program object and return a pointer
        @param NAME: The name to attempt to assign
        @type NAME: str
        (   t   PROGDICTRF   R!   R&   (   R#   t   PR(   t   PROGS(    s   ./sql2htmldoc.pyt   AssignProgram  s    		s2   SELECT Name,Description,Installation from Program;i    i   i   s7   SELECT ComType,Command from ProgLaunch WHERE Program = R-   s   ';s-   SELECT Category from ProgCat WHERE Program = s2   SELECT Documentation from ProgDoc WHERE Program = s,   SELECT Package from PkgProg WHERE Program = s)   SELECT Data from ProgDat WHERE Program = s6   SELECT SampleInput from ProgSampleInp WHERE Program = s7   SELECT SampleOutput from ProgSampleOut WHERE Program = s.   SELECT Platform from ProgPlat WHERE Program = N(   R.   R/   R7   R<   RG   R!   R8   R9   RH   R:   RI   RJ   R;   (   R0   RM   RN   R1   R2   R&   R*   RG   t   iRA   RB   RC   R(   RD   R   (    (   RM   s   ./sql2htmldoc.pyt   ReadProgram  sP     
! ! ! ! ! ! ! ! c   	      C   sB  d „  } t  |  d ƒ } t ƒ  } | i | d ƒ | i | d d ƒ | i | d d ƒ | i | d d ƒ t t i ƒ  ƒ } | i d d	 „  ƒ xu | D]m } t | } | | ƒ | i | d
 d ƒ | i d } | i d } | i	 | | d | ƒ | i
 | d
 ƒ q– W| i
 | d ƒ | i | ƒ | i ƒ  t i |  d ƒ d S(   sR   
            FIXME
            @param catfn:
            @type catfn:
            c      	   S   s”  |  i  d } t | d ƒ } t ƒ  } | i | d |  i  ƒ | i | d d ƒ | i | d d ƒ | i d ƒ | i | d ƒ | i | d d ƒ |  i i d	 d
 „  ƒ xž |  i D]“ } | i | d d ƒ d | d } y3 | d t	 | i
 d } | i | | d | ƒ Wq² t j
 o* d | GH| i | d d d | ƒ q² Xq² W| i | d ƒ | i | d ƒ | i | ƒ | i ƒ  t i | d ƒ d S(   s>   
         FIXME
         @param c:
         @type c:
         s   .htmlt   ws
   category: t   hrR   t   h1s	   programs:t   ult   keyc         S   s
   |  i  ƒ  S(    (   t   lower(   R&   (    (    s   ./sql2htmldoc.pyt   <lambda>^  s    t   lis   ../program/s    - s   
s   In writecat: KeyError: s
   KeyError: i´  N(   R&   R   R   t
   start_paget   startt   writet   endR'   t   sortRK   R7   t   linkt   KeyErrort   end_pageR   R
   t   chmod(   RB   t   catfnt   catpagefilet   ht   pnamet   urlt   text(    (    s   ./sql2htmldoc.pyt   writecatK  s2    	
 	#
RQ   s   programs by categoryRR   R   t   brRT   RU   c         S   s
   |  i  ƒ  S(    (   RV   (   R&   (    (    s   ./sql2htmldoc.pyRW     s    RX   s   .htmls   
i´  N(   R   R   RY   RZ   t   listR)   t   keysR]   R&   R^   R\   R`   R   R
   Ra   (	   Rb   Rh   t   catfileRd   t   catlistt   catkeyRB   Rf   Rg   (    (    s   ./sql2htmldoc.pyt   write_category_pageB  s,    		(	 


t   Filec           B   s   e  Z d  „  Z RS(   c         C   s(   d |  _  d |  _ d |  _ d |  _ d S(   s«   
          Initializes arguments:
                name=""
                description=""
                command='"$ACE_FILE_LAUNCHER" '
                path=""
          R   N(   R&   R7   t   commandR   (   R   (    (    s   ./sql2htmldoc.pyR     s    			(   R   R   R   (    (    (    s   ./sql2htmldoc.pyRp   Ž  s   c            sv   ‡  f d †  } |  i  d ƒ i ƒ  } xK | D]C } | d } | | ƒ } | d | _ | d | _ | d | _ q+ Wd S(   sÎ   
    Read file.ace into a list of file objects
    @param FN: The name of the file to be read in
    @type FN: str
    @param DOCFILES: the list of file objects to be read into
    @type DOCFILES: list
    c            s>   |  t  j o t  |  } n  t ƒ  } ˆ  i | ƒ |  | _ | S(   sß   
        If a file called NAME already exists, return a pointer
        If it does not exist, create a new file object and return a pointer
        @param NAME: The name to attempt to assign
        @type NAME: str
        (   t   DOCDICTRp   R!   R&   (   R#   t   FL(   t   DOCFILES(    s   ./sql2htmldoc.pyt
   AssignFile©  s    		s3   SELECT Name,Description,Action,PathOrURL from File;i    i   i   i   N(   R.   R/   R7   Rq   R   (   R0   Rt   Ru   R1   R2   R&   R*   (    (   Rt   s   ./sql2htmldoc.pyt   ReadDocFilesž  s     
c         C   sE   t  i i |  ƒ o t i |  ƒ n t  i |  ƒ t  i |  d ƒ d S(   s±   
    Delete an existing directory and create an empty directory
    with the same name.
    @param DIRNAME: The name of the directory to be refreshed
    @type DIRNAME: str
    iý  N(   R
   R   t   isdirt   shutilt   rmtreet   mkdirRa   (   t   DIRNAME(    (    s   ./sql2htmldoc.pyt   FreshDirÂ  s    c   
         sZ  ‡  f d †  } t  |  d ƒ } t ƒ  } | i | d ƒ | i | d d ƒ | i | d d ƒ | i | d d ƒ t t i ƒ  ƒ } | i d d	 „  ƒ x‡ | D] } t | } | | ƒ | i | d
 d ƒ | i d } | i d t | i i	 d }	 | i
 | | d |	 ƒ | i | d
 ƒ qœ W| i | d ƒ | i | ƒ | i ƒ  t i |  d ƒ d S(   sÓ   
    Write HTML page listing program packages.
    @param PKGFN: The name of the html page to be created
    @type PKGFN: str
    @param P: An instance of the Paramaters object
    @type P: Paramters object
    c   
         sî  |  i  d } t | d ƒ } t ƒ  } | i | d |  i  ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d	 | ƒ d } | i | d
 | ƒ | i |  i  d |  i ƒ | i | d
 ƒ | i | d	 ƒ | i | d ƒ t | | d |  i	 t
 ˆ  ƒ t | | d |  i t
 ˆ  ƒ d } | i | d | ƒ d } | i | d	 | ƒ d } | i | d
 | ƒ d } d } d } | i | | | | ƒ | i d ƒ | i | d
 ƒ d } xO |  i D]D } | i | ƒ | d } | t |  i ƒ j  o | i d ƒ qÜqÜW| i | d	 ƒ | i | d ƒ d } | i | d | ƒ d } | i | d	 | ƒ d } | i | d
 | ƒ d } d } d } | i | | | | ƒ | i d ƒ | i | d
 ƒ | i |  i ƒ | i | d	 ƒ | i | d ƒ d } | i | d | ƒ d } | i | d	 | ƒ d } | i | d
 | ƒ d } d } d } | i | | | | ƒ | i d ƒ | i | d
 ƒ | i | d	 ƒ | i | d ƒ d } | i | d | ƒ d } | i | d	 | ƒ | i | d d ƒ |  i i d d „  ƒ xq |  i D]f }	 | i | d d ƒ d |	 d } |	 d t |	 i d  } | i | | d | ƒ | i | d ƒ qW| i | d ƒ | i | d	 ƒ | i | d ƒ | i | d ƒ | i | ƒ | i ƒ  t i | d! ƒ d" S(#   ss   
        Write a page for a given package
        @param PK: The name of the package
        @type PK: str
        s   .htmlRQ   s	   Package: s1    style="font-family: helvetica,arial,sans-serif;"t   tableR   t   trsE    colspan="2" rowspan="1" style= "background-color: rgb(51, 255, 51);"t   tdt   bigs    - t   Documentationt   DatasG    colspan="2" rowspan="1" style= "background-color: rgb(204, 204, 204);"s!   ../Doc_definitions.html#Platformst	   Platformss   target="FrameWindow"s   : i    i   s   , s$   ../Doc_definitions.html#Installationt   Installations    ../Doc_definitions.html#Programst   ProgramssG    colspan="2" rowspan="1" style= "background-color: rgb(255, 255, 255);"RT   RU   c         S   s
   |  i  ƒ  S(    (   RV   (   R&   (    (    s   ./sql2htmldoc.pyRW   J  s    RX   s   ../program/s   
i´  N(   R&   R   R   RY   RZ   R[   R7   R\   t   DocRowsR9   Rr   R:   R^   R;   t   lenR<   R'   R]   RK   R`   R   R
   Ra   (
   R>   t   PKGFNt   PKGPAGEFILEt   Ht
   ATTRIBUTESt   URLt   TEXTt   It   PLATt   PNAME(   t   P(    s   ./sql2htmldoc.pyt   WritePkgÜ  s´    	
 

 
RQ   s   Programs by PackageRR   R   Ri   RT   RU   c         S   s
   |  i  ƒ  S(    (   RV   (   R&   (    (    s   ./sql2htmldoc.pyRW   h  s    RX   s   .htmls    - s   
i´  N(   R   R   RY   RZ   Rj   R=   Rk   R]   R&   R7   R^   R\   R`   R   R
   Ra   (
   Rˆ   R‘   R’   t   PKGFILERŠ   t   PKGLISTt   PKGKEYR>   RŒ   R   (    (   R‘   s   ./sql2htmldoc.pyt   WritePackagePageÑ  s,    	 


c         C   sÈ  d } | i  |  d | ƒ d } | i  |  d | ƒ d } | i  |  d | ƒ d | i d d ƒ } | } d	 } | i |  | | | ƒ | i |  d ƒ | i |  d ƒ | i |  d ƒ x| D]}	 d } |	 | j oí | |	 }
 t |
 i ƒ d
 j oÉ | i  |  d | ƒ d } | i  |  d | ƒ |
 i } | i |  | ƒ | i |  d ƒ d } | i  |  d | ƒ t i	 |
 i | i
 ƒ } |
 i } | i |  | d | ƒ | i |  d ƒ | i |  d ƒ qÀqº qº Wd S(   s&  
    Write rows for documentation lines:
    Documentation, Data, Sample input, Sample output

    @param OUTFILE: The name of the output file
    @type OUTFILE: str
    @param H: An instance of HTMLWriter
    @type H: HTMLWriter
    @param HEADING: The heading to place in each row
    @type HEADING: str
    @param FILELIST: The list of files to be documented
    @type FILELIST: list
    @param D: The dictionary to use for documentation
    @type D: dictionary
    @param P: An instance of the Parameters class
    @type P: Parameters object
    R   R~   sG    colspan="2" rowspan="1" style= "background-color: rgb(204, 204, 204);"R   R€   s   ../Doc_definitions.html#t    t   _s   target="FrameWindow"i    sR    border="0" colspan="1" rowspan="1" style= "background-color: rgb(255, 255, 255);"N(   RZ   t   replaceR^   R\   R‡   R   R7   t   indent_textt   HTt   name_to_urlt	   DOCPREFIX(   R   RŠ   t   HEADINGt   FILELISTt   DR‘   R‹   RŒ   R   t   DOCNAMEt   DOCUMENTt   DOCTYPE(    (    s   ./sql2htmldoc.pyR†   y  s@     
		c   
      C   sD  d „  } t  |  d ƒ } t ƒ  } | i | d ƒ | i | d d ƒ | i | d d ƒ t t i ƒ  ƒ } | i d d „  ƒ xŠ | D]‚ } t | } | | | ƒ | i | d	 d ƒ | i d
 } | i d t | i i	 d }	 | i
 | | d |	 ƒ | i | d	 ƒ qƒ W| i | d ƒ | i | ƒ | i ƒ  t i |  d ƒ d S(   sá   
    Write HTML page listing programs in alphabetical order.
    @param PROGFN: The basename of the page to be written
    @type PROGFN: str
    @param P: An instance of the Parameters class
    @type P: Paramters object
    c      	   S   s  |  i  d } t | d ƒ } t ƒ  } | i | |  i  ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d	 | ƒ | i |  i  d
 |  i ƒ | i | d	 ƒ | i | d ƒ | i | d ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d	 | ƒ d } d } d } | i | | | | ƒ | i | d	 ƒ | i | d ƒ | i | d ƒ xÚ |  i	 D]Ï } d } | i | d | ƒ d } | i | d | ƒ | i
 | | d ƒ | i | d ƒ d } | i | d | ƒ d } | i | d | ƒ | i | d ƒ | i | d ƒ | i | d ƒ | i | d ƒ q­Wt | | d |  i t | ƒ t | | d |  i t | ƒ t | | d |  i t | ƒ t | | d |  i t | ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d	 | ƒ d } d } d } | i | | | | ƒ | i d ƒ | i | d	 ƒ d |  i d } |  i } | i | | d | ƒ | i | d ƒ | i | d ƒ d } | i | d | ƒ d } | i | d | ƒ d } | i | d	 | ƒ d } d } d } | i | | | | ƒ | i d ƒ | i | d	 ƒ d }	 xO |  i D]D }
 | i |
 ƒ |	 d }	 |	 t |  i ƒ j  o | i d ƒ qpqpW| i | d ƒ | i | d ƒ | i | d ƒ | i | ƒ | i ƒ  t i | d ƒ d  S(!   sâ   
        Write a page for a given program
        @param PR: The name of the program to write the page for
        @type PR: str
        @param P: An instance of the Parameters class
        @type P: Parameters object
        s   .htmlRQ   s1    style="font-family: helvetica,arial,sans-serif;"R}   R   R~   sE    colspan="2" rowspan="1" style= "background-color: rgb(51, 255, 51);"R   R€   s    - sG    colspan="2" rowspan="1" style= "background-color: rgb(204, 204, 204);"s!   ../Doc_definitions.html#Launchings   Launching the programs   target="FrameWindow"sR    border="0" colspan="1" rowspan="1" style= "background-color: rgb(255, 255, 255);"i    s    face="Courier New,Courier"t   fonti   R   R‚   s   Sample inputs   Sample outputs   ../Doc_definitions.html#PackageR6   s   : s   ../package/s!   ../Doc_definitions.html#PlatformsRƒ   s   , i´  N(   R&   R   R   RY   RZ   R[   R7   R\   R^   RG   Rš   R†   R9   Rr   R:   RI   RJ   RH   R;   R‡   R`   R   R
   Ra   (   RL   R‘   t   PROGFNt   PROGPAGEFILERŠ   R‹   RŒ   R   t   COMMANDRŽ   R   (    (    s   ./sql2htmldoc.pyt	   WriteProg»  sº    		
 	
 

RQ   s   Program IndexRR   R   RT   RU   c         S   s
   |  i  ƒ  S(    (   RV   (   R&   (    (    s   ./sql2htmldoc.pyRW   D  s    RX   s   .htmls    - s   
i´  N(   R   R   RY   RZ   Rj   RK   Rk   R]   R&   R7   R^   R\   R`   R   R
   Ra   (
   R¥   R‘   R¨   t   PROGFILERd   t   PROGLISTt   PROGKEYRL   RŒ   R   (    (    s   ./sql2htmldoc.pyt   WriteProgramPage±  s*    
	~	 

c          C   s   d GHt  ƒ  }  d GHt i |  i d ƒ |  _ |  i i d d ƒ |  _ d |  i GH|  i d j o
 t } n t } t i	 t
 i i |  i d ƒ ƒ } | i ƒ  } g  } d GHt | | ƒ d	 t t | ƒ ƒ GHx | D] } | t | i <qÐ Wt
 i i t
 i i |  i d
 ƒ ƒ o\ t i	 t
 i i |  i d
 ƒ ƒ } | i ƒ  } t | | ƒ x | D] } | t | i <qMWn d t t t ƒ ƒ GHg  } d GHt | | ƒ d t t | ƒ ƒ GHx | D] }	 |	 t |	 i <q±Wt
 i i t
 i i |  i d
 ƒ ƒ o/ t | | ƒ x | D] }	 |	 t |	 i <qWn d t t t ƒ ƒ GHd GHt | t ƒ d t t t ƒ ƒ GHx t D] }
 |
 t |
 i <q_Wt
 i i t
 i i |  i d
 ƒ ƒ o/ t | t ƒ x t D] }
 |
 t |
 i <q¯Wn d t t t ƒ ƒ GHg  } d GHt | | ƒ x | D] } | t | i <qþWt
 i i t
 i i |  i d
 ƒ ƒ o/ t | | ƒ x | D] } | t | i <qNWn d GHt
 i |  i d ƒ t d ƒ t d ƒ t d ƒ | ou d GHd GHt
 i d ƒ d } t | ƒ d GHt
 i d ƒ d } t  | |  ƒ d GHt
 i d ƒ d  } t! | |  ƒ n d! S("   s0   
    Called when not in documentation mode.
    s   ***** obtaining parameterss   ***** reading BIRCH.propertiest   birchURLs   \R   s   P.DOCPREFIX: s   birchdocdb.sqlites   ***** reading categoriess   Categories:s   birchdocdb.local.sqlites   CATDICT size: s   ***** reading packagess	   Packages:s   PKGDICT size: s   ***** reading programss   Progs:s   PROGDICT size: s%   ***** reading documentation filenamess   ***** freshdirs   /public_html/birchdocdbR8   RH   R'   s   ***** read OK *****s   ***** writing category pagess   category.htmls   ***** writing program pagess
   ../programs   program.htmls   ***** writing package pagess
   ../packages   package.htmlN("   R   t   BMt   GetBIRCHPropertiesR   R   R™   t   Truet   Falset   sqlite3t   connectR
   R   t   joinR   R0   R5   t   strR‡   R)   R&   R   R   RE   R=   RP   RM   RK   Rv   Rr   t   chdirR|   Ro   R¬   R–   (   R‘   t   OKAYt
   Connectiont   CursorR+   R*   t   LocalConnectiont   LocalCursorR?   R>   RL   Rt   Rs   t   CATFNR¥   Rˆ   (    (    s   ./sql2htmldoc.pyt   mainV  s¢    	

! %!  %  %  % 	



t   __main__s   -test(    (    (    (    (    (-   R    R
   t   reRx   R²   t   sysR   t   gett   blibR   R!   t   birchlibR   R   R   t   PROGRAMt   USAGER®   RM   R)   RK   R=   Rr   R›   t   NLR   R$   R%   R5   R6   RE   RF   RP   Ro   Rp   Rv   R|   R–   R†   R¬   R½   R   t
   documentort   argvt   exit_success(    (    (    s   ./sql2htmldoc.pyt   <module>
   sR   7		$	3	;	L	$		¨	8	¥	…