Ñò
Ó4¶Qc           @   sÿ   d  Z  d d k Z d d k Z e i i d ƒ Z e i i e ƒ d d k l	 Z	 d Z
 d Z e	 e
 e ƒ Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z e d j oV e i ƒ  p d e i j o qû e i i d ƒ Z e i i d ƒ Z e e e ƒ n d S(   sÐ  
Aug 26th 2010, Dale Hamel, University of Manitoba
 Description: Determines whether the system is OS X or linux, and 
 creates a symbolic link to the appropriate launcher

 Note: this script is partnered with creatlauncher.py 
 createlauncher.py makes the launchers at installtime, and 
 linklauncher.py creates the links whenever newuser is run.

 Synopsis: python linklauncher.py


@modified: May 14, 2011
@author: Dale Hamel
@contact: umhameld@cc.umanitoba.ca

iÿÿÿÿNt   BIRCHLIB(   t   Birchmods   linklauncher.py: s   
	USAGE: linklauncher.pyc          C   sa   t  i i d ƒ }  t  i i |  ƒ o8 |  d } t  i i | ƒ o t d | GHq] d } n | S(   sÀ   
        Returns the location of the current user's desktop directory
        by reading the environment variable "HOME", and assuming that there
        is a "HOME/Desktop" directory
        t   HOMEs   /Desktops   Found desktop at: N(   t   ost   environt   gett   patht   existst   PROGRAMt   None(   t   home_dirt   desktop_dir(    (    s6   /home/psgendb/BIRCHDEV/install-scripts/linklauncher.pyt   get_desktop#   s    

c         C   sF   |  d } |  d j o+ t i | ƒ t i d | d ƒ d GHn d S(   sE  
        Creates a launcher of the form biolegato.desktop for use on
        linux desktops such as GNOME (v2+) and KDE (v3.5+). May also work
        on other desktops such as qt, etc, but not yet tested

        @desktop_dir: the location of the user's desktop directory,
        where the launcher will be placed

        s   /admin/launchers/birch.desktops   ln -s s    .s)   Made symbolic link to launcher on desktopN(   R	   R   t   chdirt   system(   t	   birch_dirR   t	   file_name(    (    s6   /home/psgendb/BIRCHDEV/install-scripts/linklauncher.pyt   link_gnome_launcher6   s
    
c         C   s@   |  d j o/ t i | ƒ t i d |  d ƒ t d GHn d S(   sk  
        Makes a launcher application for OS X (tested on 10.5.8) of the format
        biolegato.app. The launcher is just a wrapper for an apple script
        that calls the system biolegato, and should use system paths.

        The this method copies a template launcher called "biolegato.app"
        to the desktop that is assumed to be in the current working directory
        in adirectory called "osx_launcher", if this changes then this method
        will need to be updated.

        Once the launcher is copied, all the contents of the BIRCH directory
        specified by the environment variable $BIRCH will be symbolically
        linked into the applications resource directory under:
        
        ~/biolegato.app/Contents/Resources"

        @desktop_dir: the location of the user's desktop directory,
        where the launcher will be placed
        s   ln -s s    /admin/launchers/biolegato.app .s)   Made symbolic link to launcher on desktopN(   R	   R   R   R   R   (   R   R   (    (    s6   /home/psgendb/BIRCHDEV/install-scripts/linklauncher.pyt   link_apple_launcherI   s    c         C   s†   t  i i d ƒ t  i i d ƒ } t  i | d ƒ t  i ƒ  GH|  d } |  d } d } t  i d | d | ƒ t  i d	 | ƒ d
 S(   sS   
	Creates a shortcut to the windows launcher script to run biolegato (birch)
	
    t	   HOMEDRIVEt   HOMEPATHs   /Desktops   /java/bioLegato/biolegato.bats!   /public_html/birch_black_ico.icnss   /cygwin.bats   mkshortcut -n bioLegato -i t    s   mkshortcut -n birchTerm N(   R   R   R   R   t   getcwdR   (   R   t   windirt	   biolegatot
   birch_icont
   cygwin_bat(    (    s6   /home/psgendb/BIRCHDEV/install-scripts/linklauncher.pyt   link_win_launchere   s    "

c         C   sœ   t  ƒ  } | d  j oW | d j o' | i d ƒ d j  o t |  | ƒ q | d j o t |  | ƒ q n# | d j o t |  ƒ n t ƒ  t d GHd  S(   Ns
   osx-x86_64t   wini    s   winxp-32s   Completed execution normally.(   R   R	   t   findR   R   R   t   exitR   (   t   BIRCHt   PLATFORMR   (    (    s6   /home/psgendb/BIRCHDEV/install-scripts/linklauncher.pyt   mainz   s    	$t   __main__s   -testt   BIRCH_PLATFORMR   (   t   __doc__R   t   sysR   R   t   blibR   t   appendt   birchlibR   R   t   USAGEt   BMR   R   R   R   R!   t   __name__t
   documentort   argvR    R   (    (    (    s6   /home/psgendb/BIRCHDEV/install-scripts/linklauncher.pyt   <module>   s&   					