
 Qc           @   s   d  Z  d d l Z d d l m Z m Z d d l m Z m Z m Z m	 Z	 d Z
 d Z d Z d Z d	 Z d
   Z e d f f Z e d  Z d d d     YZ d   Z d e e e e e e g  d e d d g  d d g  d  Z d S(   sH   
Automatically build spec files containing a description of the project
iN(   t   HOMEPATHt   DEFAULT_SPECPATH(   t   expand_patht   is_wint	   is_cygwint	   is_darwins  # -*- mode: python -*-
a = Analysis(%(scripts)s,
             pathex=%(pathex)s,
             hiddenimports=%(hiddenimports)r,
             hookspath=%(hookspath)r,
             runtime_hooks=%(runtime_hooks)r)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='%(exename)s',
          debug=%(debug)s,
          strip=%(strip)s,
          upx=%(upx)s,
          console=%(console)s %(exe_options)s)
s  # -*- mode: python -*-
a = Analysis(%(scripts)s,
             pathex=%(pathex)s,
             hiddenimports=%(hiddenimports)r,
             hookspath=%(hookspath)r,
             runtime_hooks=%(runtime_hooks)r)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='%(exename)s',
          debug=%(debug)s,
          strip=%(strip)s,
          upx=%(upx)s,
          console=%(console)s %(exe_options)s)
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=%(strip)s,
               upx=%(upx)s,
               name='%(name)s')
s  # -*- mode: python -*-
a = Analysis(%(scripts)s,
             pathex=%(pathex)s,
             hiddenimports=%(hiddenimports)r,
             hookspath=%(hookspath)r,
             runtime_hooks=%(runtime_hooks)r)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='%(exename)s',
          debug=%(debug)s,
          strip=%(strip)s,
          upx=%(upx)s,
          console=%(console)s %(exe_options)s)
dll = DLL(pyz,
          a.scripts,
          exclude_binaries=True,
          name='%(dllname)s',
          debug=%(debug)s)
coll = COLLECT(exe, dll,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=%(strip)s,
               upx=%(upx)s,
               name='%(name)s')
s7   app = BUNDLE(exe,
             name='%(exename)s.app')
s5   app = BUNDLE(coll,
             name='%(name)s.app')
c         C   s   t  j j |   j d d  S(   Ns   \s   \\(   t   ost   patht   normpatht   replace(   R   (    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyt   quote_win_filepathh   s    R    c         C   s   x | D] \ } } t  j j |  | k s; t d |   |  t |   | k r |  t |  } | d d k r~ | d } n  | | f Sq Wd  |  f S(   Ns$   path '%s' should already be absolutei    s   \/i   (   R   R   t   abspatht   AssertionErrort   lent   None(   t   filenamet   conversionst	   from_patht   to_namet   rest(    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyt   make_variable_pathw   s    t   Pathc           B   s   e  Z d    Z d   Z RS(   c         G   s,   t  t j j |  |  _ d  |  _ |  _ d  S(   N(   t   applyR   R   t   joinR   t   variable_prefixt   filename_suffix(   t   selft   parts(    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyt   __init__   s    c         C   si   |  j  d  k r- t |  j  \ |  _ |  _  n  |  j d  k rI t |  j  Sd |  j d t |  j   d S(   Ns   os.path.join(t   ,t   )(   R   R   R   R   R   t   repr(   R   (    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyt   __repr__   s
    (   t   __name__t
   __module__R   R    (    (    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyR      s   	c         C   s  |  j  d  } | j d d d d d d d t d	 d
 | j d d d d d d d	 d | j d d d d dL d	 d | j d d d	 d |  j  d  } | j d d d g  d d d d d d d	 d t t j  | j d d d d d d d d	 d | j d  d d d d! d	 d" | j d# d d d d$ d	 d% |  j  d&  } | j d' d( d d d t d	 d) | j d* d+ d d d	 d, | j d- d d d t d	 d. |  j  d/  } | j d0 d1 d2 d d3 d d d t d	 d4 | j d5 d6 d7 d d3 d d d	 d8 | j d9 d: d d; d d< d	 d= |  j  d>  } | j d? d d@ d dA d	 dB | j dC dD d dE d	 dF | j dG dH d g  d dI d dJ d d d	 dK dL S(M   sW   
    Add the `Makespec` options to a option-parser instance or a
    option group.
    s   What to generates   -Fs	   --onefilet   destt   onefilet   actiont
   store_truet   defaultt   helps%   Create a one-file bundled executable.s   -Ds   --onedirt   store_falses=   Create a one-folder bundle containing an executable (default)s
   --specpatht   metavart   DIRsD   Folder to store the generated spec file (default: current directory)s   -ns   --namesR   Name to assign to the bundled app and spec file (default: first script's basename)s   What to bundle, where to searchs   -ps   --pathst   pathext   appends   A path to search for imports (like using PYTHONPATH). Multiple paths are allowed, separated by %s, or use this option multiple timess   --hidden-importt
   MODULENAMEt   hiddenimportss`   Name an import not visible in the code of the script(s). This option can be used multiple times.s   --additional-hooks-dirt	   hookspathsO   An additional path to search for hooks. This option can be used multiple times.s   --runtime-hookt   runtime_hookss   Path to a custom runtime hook file. A runtime hook is code that is bundled with the executable and is executed before any other code or module to set up special features of the runtime environment. This option can be used multiple times.s   How to generates   -ds   --debugs   Tell the bootloader to issue progress messages while initializing and starting the bundled app. Used to diagnose problems with missing imports.s   -ss   --stripsZ   Apply a symbol-table strip to the executable and shared libs (not recommended for Windows)s   --noupxsS   Do not use UPX even if it is available (works differently between Windows and *nix)s%   Windows and Mac OS X specific optionss   -cs	   --consoles   --nowindowedt   consoles0   Open a console window for standard i/o (default)s   -ws
   --windoweds   --noconsoles   Windows and Mac OS X: do not provide a console window for standard i/o. On Mac OS X this also triggers building an OS X .app bundle.This option is ignored in *NIX systems.s   -is   --icont	   icon_files$   FILE.ico or FILE.exe,ID or FILE.icnss   FILE.ico: apply that icon to a Windows executable. FILE.exe,ID, extract the icon with ID from an exe. FILE.icns: apply the icon to the .app bundle on Mac OS X (not yet implemented)s   Windows specific optionss   --version-filet   version_filet   FILEs+   add a version resource from FILE to the exes   -ms
   --manifests   FILE or XMLs#   add manifest FILE or XML to the exes   -rs
   --resourcet	   resourcess   FILE[,TYPE[,NAME[,LANGUAGE]]]s  Add or update a resource of the given type, name and language from FILE to a Windows executable. FILE can be a data file or an exe/dll. For data files, at least TYPE and NAME must be specified. LANGUAGE defaults to 0 or may be specified as wildcard * to update all resources of the given TYPE and NAME. For exe/dll files, all resources from FILE will be added/updated to the final executable if TYPE, NAME and LANGUAGE are omitted or specified as wildcard *.This option can be used multiple times.N(   t   add_option_groupt
   add_optiont   FalseR   R   R   t   pathsept   True(   t   parsert   g(    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyt   __add_options   sd    c         K   s  | d  k r5 t j j t j j |  d   d } n  |
 d  k rJ t }
 n t |
  }
 |
 t k rz t j j t |  }
 n  t j j	 |
  s t j
 |
  n  | } | j |
  d } |	 r d | t |	  f } n  | r d | t |  f } n  | r>d | k r%d | | j d d  f } q>d | t |  f } n  | rlt t |  } d	 | t |  f } n  | pug  } t t |   }  i |  d
 6| d 6| d 6| d 6| d 6| d 6| d 6| d 6| d 6| d 6| d 6} t st r| d | d <| d | d <n
 | | d <t j j |
 | d  } t | d  } | rR| j t |  nm | r| j t |  t r| r| j t |  qn2 | j t |  t r| r| j t |  n  | j   | S(   Ni    t    s   %s, version='%s's   %s, icon='%s't   <s   %s, manifest='%s't   's   \'s   %s, resources=%st   scriptsR,   R/   t   namet   debugt   stript   upxt   exe_optionsR0   R1   R2   s   .exet   exenames   .dllt   dllnames   .spect   w(   R   R   R   t   splitextt   basenameR   R   R    R   t   existst   makedirsR-   R
   R	   t   mapR   R   R   R   t   opent   writet   comsrvrtmpltt   onefiletmpltR   t   bundleexetmpltt   onedirtmpltt   bundletmpltt   close(   RB   RC   R$   R2   RD   RE   t   noupxt	   comserverR,   R4   t   specpathR3   t   manifestR6   R/   R0   R1   t   kwargsRG   t   dt   specfnmt   specfile(    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyt   main   sj    )	



(    (   t   __doc__R   t   PyInstallerR    R   t   PyInstaller.compatR   R   R   R   RS   RU   RR   RT   RV   R
   t   path_conversionsR   R   R>   R   R9   R;   R`   (    (    (    sW   C:\Users\Salopaasi\My Documents\pyinstaller-pyinstaller-275d4c9\PyInstaller\makespec.pyt   <module>   s$   "		Z		