ó
@K7]c           @` sw  d  d l  m Z m Z m Z d  d l Z d  d l m Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l j Z d  d l j Z d  d l j Z d  d l m Z m Z m Z d  d l m Z d  d l j Z d  d l m Z d  d l m Z m Z d  d l m Z m Z m  Z  e	 j! d	 k Z" e j# d
 e j$ ƒ d „  Z% d „  Z& d „  Z' d „  Z( d „  Z) d „  Z* d „  Z+ d S(   i    (   t   absolute_importt   divisiont   print_functionN(   t   glob(   t   add_parser_channelst   binstar_uploadt   cc_conda_build(   t   get_render_parser(   t   LoggingContext(   t   Configt   get_channel_urls(   t   abspatht
   expandusert
   expandvarst   win32t   levelc         C` sL  t  ƒ  } d | _ | j d d d d d ƒ| j d d d d d	 d
 d d t ƒ| j d d d d t j d
 d d t ƒ| j d d d d d d
 d d t j d d ƒ j ƒ  d k ƒ| j d d d d d d ƒ| j d d d d d d ƒ| j d d d d
 d d d ƒ| j d d d d d d ƒ| j d d d d d d  ƒ| j d! d" d# d$ d% d d& ƒ| j d' d d d d( d t j d) d* ƒ j ƒ  d k ƒ| j d+ d d d
 d, d d- ƒ| j d. d d d d/ ƒ| j d0 d1 d d d d2 d t j d3 d* ƒ j ƒ  d k ƒ| j d4 d d d d5 ƒ| j d6 d d7 d t j d8 ƒ ƒ| j d9 d d: d t j d; ƒ ƒ| j d< d d= d
 d> d g  d d? ƒ| j d@ d dA d
 dB d t	 d d ƒ| j
 dC ƒ } | j dD d dE ƒ| j dF d t d dG ƒ| j dH d dI d
 dJ d dK ƒ| j dL d dM ƒ| j dN d dO d t j dP ƒ rbt t t t j dP ƒ ƒ ƒ ƒ n t j dP ƒ ƒ| j dQ dR d dS d t j dT dU ƒ ƒ| j dV d d d dW d
 dX d t j dX d ƒ j ƒ  d k ƒ| j dY d d d dZ d
 d[ d t j d[ d ƒ j ƒ  d k ƒ| j d\ d d] ƒ| j d^ d d d d_ d t j d` d ƒ j ƒ  d k ƒ| j da d d d
 d` d db d t j d` d ƒ j ƒ  d k ƒ| j dc d d d
 dd d de d t j dd d* ƒ j ƒ  d k ƒ| j df d dg d t j dh ƒ ƒ| j di d
 dj d d d dk d t	 ƒ| j dl d
 dj d d d dk d t	 ƒ| j dm d
 dn d do d dp dq t ƒ| j dr d
 ds d t	 d d d dt ƒ| j du d
 dv d t	 d d d dw ƒ| j dx d
 dy d d d dz d t j dy d* ƒ j ƒ  d k ƒ| j d{ d
 dy d d d d| d t j dy d* ƒ j ƒ  d k ƒ| j d} d
 d~ d d d d d t j d~ d* ƒ j ƒ  d k ƒ| j d€ d
 d~ d d d d d t j d~ d* ƒ j ƒ  d k ƒ| j d‚ d d d dƒ d t j d„ d ƒ j ƒ  d k ƒ| j d… d
 d„ d d d d† d t j d„ d ƒ j ƒ  d k ƒ| j d‡ dˆ d d d d‰ ƒ| j dŠ d d‹ d t j dŒ ƒ ryt t t t j dŒ ƒ ƒ ƒ ƒ n t j dŒ ƒ ƒ| j d d
 dŽ d d d t j dŽ d ƒ j ƒ  d k d d ƒ| j d d d d d‘ d t j d’ d* ƒ j ƒ  d k ƒ| j d“ d d” ƒ| j d• d$ d% d d– ƒt | ƒ | j |  ƒ }  | |  f S(—   Ns?  
Tool for building conda packages. A conda package is a binary tarball
containing system-level libraries, Python modules, executable programs, or
other components. conda keeps track of dependencies between packages and
platform specifics, making it simple to create working environments from
different sets of packages.s   --checkt   actiont
   store_truet   helps!   Only check (validate) the recipe.s   --no-anaconda-uploadt   store_falses1   Do not ask to upload the package to anaconda.org.t   destt   anaconda_uploadt   defaults   --no-binstar-uploads   --no-include-recipes2   Don't include the recipe inside the built package.t   include_recipet   trues   -ss   --sources)   Only obtain the source (but don't build).s   -ts   --testst   Test package (assumes package is already built).  RECIPE_DIR argument must be a path to built package .tar.bz2 file.s	   --no-testt   notests   Do not test the package.s   -bs   --build-onlyso   Only run the build, without any post processing or
        testing. Implies --no-test and --no-anaconda-upload.s   -ps   --postsE   Run the post-build logic. Implies --no-test and --no-anaconda-upload.t   recipet   metavart   RECIPE_PATHt   nargst   +s‘   Path to recipe directory.  Pass 'purge' here to clean the work and test intermediates. Pass 'purge-all' to also remove previously built packages.s   --skip-existings[   Skip recipes for which there already exists an existing build (locally or in the channels).t   skip_existingt   falses   --keep-old-workt   keep_old_worksN   Do not remove anything from environment, even after successful build and test.s   --dirtysv   Do not remove work directory or _build environment, to speed up debugging.  Does not apply patches or download source.s   -qs   --quiets   do not display progress bart   quiets   --debugs1   Show debug output from source checkouts and condas   --tokens(   Token to pass through to anaconda uploadt   anaconda_tokens   --users?   User/organization to upload packages to on anaconda.org or pypit   users   --labelt   appendt   labelss1   Label argument to pass through to anaconda uploads   --no-force-uploadsR   Disable force upload to anaconda.org, preventing overwriting any existing packagest   force_uploads   PyPI upload parameters (twine)s
   --passwords/   password to use when uploading packages to pypis   --signs!   sign files when uploading to pypis   --sign-witht   gpgt	   sign_withs3   program to use to sign files when uploading to pypis
   --identitys8   GPG identity to use to sign files when uploading to pypis   --config-files2   path to .pypirc file to use when uploading to pypit   pypircs   --repositorys   -rs   PyPI repository to upload tot   pypi_repositoryt   pypitests   --no-activates=   do not activate the build and test envs; just prepend to PATHt   activates   --no-build-ids[   do not generate unique build folder names.  Use if having issues with paths being too long.t   set_build_ids   --croots_   Build root folder.  Equivalent to CONDA_BLD_PATH, but applies only to this call of conda-build.s   --verifys5   run verification on recipes or packages when buildingt   verifys   --no-verifys<   do not run verification on recipes or packages when buildings   --strict-verifyt   exit_on_verify_errorsB   Exit if any conda-verify check fail, instead of only printing thems   --output-foldersˆ   folder to dump output package to.  Package are moved here if build or test succeeds.  Destination folder must exist prior to using this.t   output_folders   --no-prefix-length-fallbackt   prefix_length_fallbacks‹   Disable fallback to older 80 character prefix length if environment creation fails due to insufficient prefix length in dependency packagess   --prefix-length-fallbacks   --prefix-lengtht   _prefix_lengthsx  length of build prefix.  For packages with binaries that embed the path, this is critical to ensuring that your package can run as many places as possible.  Notethat this value can be altered by the OS below conda-build (e.g. encrypted filesystems on Linux), and you should prefer to set --croot to a non-encrypted location instead, so that you maintain a known prefix length.iÿ   t   types   --no-lockingt   lockings   Disable locking, to avoid unresolved race condition issues.  Unsafe to run multiple builds at once on one system with this set.s   --no-remove-work-dirt   remove_work_dirsÕ   Disable removal of the work dir before testing.  Be careful using this option, as you package may depend on files that are not included in the package, and may pass tests, but ultimately fail on installed systems.s   --error-overlinkingt   error_overlinkingsÞ   Enable error when shared libraries from transitive dependencies are directly linked to any executables or shared libraries in built packages.  This is disabled by default, but will be enabled by default in conda-build 4.0.s   --no-error-overlinkingsÛ   Disable error when shared libraries from transitive dependencies are directly linked to any executables or shared libraries in built packages.  This is currently the default behavior, but will change in conda-build 4.0.s   --error-overdependingt   error_overdependings¬   Enable error when packages with names beginning `lib` or which have `run_exports` are not auto-loaded by the OSes DSO loading mechanism by any of the files in this package.s   --no-error-overdependings­   Disable error when packages with names beginning `lib` or which have `run_exports` are not auto-loaded by the OSes DSO loading mechanism by any of the files in this package.s   --long-test-prefixs¼   Use a long prefix for the test prefix, as well as the build prefix.  Affects only Linux and Mac.  Prefix length matches the --prefix-length flag.  This is on by default in conda-build 3.0+t   long_test_prefixs   --no-long-test-prefixsš   Do not use a long prefix for the test prefix, as well as the build prefix.  Affects only Linux and Mac.  Prefix length matches the --prefix-length flag.  s   --keep-goings   -ks\   When running tests, keep going after each failure.  Default is to stop on the first failure.s   --cache-dirsM   Path to store the source files (archives, git clones, etc.) during the build.t	   cache_dirs   --no-copy-test-source-filest   copy_test_source_filess1  Disables copying the files necessary for testing the package into the info/test folder.  Passing this argument means it may not be possible to test the package without internet access.  There is also a danger that the source archive(s) containing the files could become unavailable sometime in the future.s   --merge-build-hostsZ   Merge the build and host directories, even when host section or compiler jinja2 is presentt   merge_build_hosts   --stats-files@   File path to save build statistics to.  Stats are in JSON formats   --extra-depss¨   Extra dependencies to add to all environment creation steps.  This is only enabled for testing with the -t or --test flag.  Change meta.yaml or use templates otherwise.(   R   t   descriptiont   add_argumentR   t   argparset   SUPPRESSR   t   gett   lowert   Truet   add_argument_groupt   FalseR   R   R   t   intR   t
   parse_args(   t   argst   pt   pypi_grp(    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyRG   "   s¬   								00
c         C` s^   t  t j d ƒ E t | _ t | _ t j |  d | ƒ} t d j	 t
 | ƒ ƒ ƒ Wd  QXd  S(   Ni   t   configs   
(   R   t   loggingt   CRITICALRE   t   verboset   debugt   apit   get_output_file_pathst   printt   joint   sorted(   R   RK   t   paths(    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyt   output_action_  s
    		c         C` sA   t  j |  d | ƒd d } t j | ƒ t d | j j ƒ d  S(   NRK   i    s   Source tree in:(   RP   t   rendert   sourcet   provideRR   RK   t   work_dir(   R   RK   t   metadata(    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyt   source_actiong  s    c         C` s   t  j |  d t d | ƒS(   Nt   move_brokenRK   (   RP   t   testRE   (   R   RK   (    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyt   test_actionm  s    c         C` s   t  j |  d | ƒS(   NRK   (   RP   t   check(   R   RK   (    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyt   check_actionq  s    c   
      C` så  t  |  ƒ \ } }  t |  j   } t j ƒ  t |  j ƒ | _ |  j | _ |  j pY |  j	 | _
 d |  j k r t j | ƒ d  Sd |  j k r© t j | ƒ | j ƒ  d  Sd  } d  } |  j râ t } t | _
 t | _ t | _	 n6 |  j rô t } n$ |  j rt } n |  j rt } n  | t k r0g  } g  g  |  j D]3 } d | k rat t j j | ƒ ƒ n | g ^ q7D] } | D] } | ^ qxqn}	 xH |	 D]@ } y | | | ƒ Wq”|  j sÀ‚  qÔ| j | ƒ q”q”Xq”W| rt d ƒ x | D] } t d | ƒ qïWt  j! t" | ƒ ƒ n
 t d ƒ g  } ny | r^g  |  j D] } | | | ƒ ^ q@} nK t# j |  j d |  j$ d |  j% d	 |  j& d
 d  d | d |  j' d |  j( ƒ} |  j rát" t) j* | j+ ƒ ƒ d k rát j, | ƒ n  | S(   Nt   purges	   purge-allt   *s   Failed recipes:s     - %ss   All tests passedt   postt
   build_onlyR   t   already_builtRK   R/   t   variantsi    (-   RG   R	   t   __dict__t   buildt   check_externalR
   t   channel_urlst   override_channelsR"   RO   RN   R   t   clean_buildt
   clean_pkgst   Nonet   outputRV   RE   RC   R^   R_   RX   R\   R`   Ra   R   t   ost   pathR   t
   keep_goingR%   RR   t   syst   exitt   lenRP   Rd   Re   R   R/   Rg   t   utilst   get_build_folderst   croott    print_build_intermediate_warning(
   RH   t   _parserRK   R   t   outputst   failed_recipesR   t   sublistt   itemt   recipes(    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyt   executeu  sn    

									D	

	(!(c          C` s„   y t  t j d ƒ Wnh t k
 rG }  t t |  ƒ ƒ t j d ƒ n9 t j k
 r }  t d j	 |  j
 ƒ ƒ t j d ƒ n Xd  S(   Ni   sw   File lock on {0} could not be obtained.  You might need to try fewer builds at once.  Otherwise, run conda clean --lock(   R   Rt   t   argvt   RuntimeErrorRR   t   strRu   t   filelockt   Timeoutt   formatt	   lock_file(   t   e(    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyt   main»  s    	(,   t
   __future__R    R   R   R?   t   glob2R   RL   Rq   Rt   R…   t   conda_build.apiRP   t   conda_build.buildRi   t   conda_build.utilsRw   t   conda_build.conda_interfaceR   R   R   t   conda_build.cli.main_renderR   t   conda_build.sourceRX   R   t   conda_build.configR	   R
   t   os.pathR   R   R   t   platformt   on_wint   basicConfigt   INFORG   RV   R\   R_   Ra   R   RŠ   (    (    (    s9   lib/python2.7/site-packages/conda_build/cli/main_build.pyt   <module>   s2   	ÿ >					F