U
    rf&                     @   s   d Z ddlZddlZejdZedkr0edejeddZ	ej
e	 ddlT ddlmZ dd	lmZ dd
lmZmZmZ eeZdd Zdd Zedkre  dS )z
build cice library
    NCIMEROOTz-ERROR: must set CIMEROOT environment variablescriptsTools)*)parse_input)Case)expectrun_bld_cmd_ensure_logging	safe_copyc           	   	   C   st   | d}| d}| d}| d}| d}|d|||7 }ttj|ddd	}|| W 5 Q R X d S )
N	CASEBUILDZ
CICE_BLCKXZ
CICE_BLCKYZCICE_MXBLCKSZCICE_CPPDEFSz$ -DBLCKX={} -DBLCKY={} -DMXBLCKS={}
ZciceconfCIME_cppdefsw)	get_valueformatopenospathjoinwrite)	bldrootinstallpathcase	casebuildZ
cice_blckxZ
cice_blckyZcice_mxblcksZcppdefsfd r   S/global/u1/q/qinyi/eagles_code/eaglesrrm/components/cice/cime_config/buildlib_cmakebuildlib   s    




r   c               	   C   s8   t tj\} }}t| dd}t||| W 5 Q R X d S )NF)	read_only)r   sysargvr   r   )caserootlibrootr   r   r   r   r   
_main_func(   s    r"   __main__)__doc__r   r   environget	_CIMEROOT
SystemExitr   r   _LIBDIRappendstandard_script_setupCIME.buildlibr   	CIME.caser   
CIME.utilsr   r	   r
   logging	getLogger__name__loggerr   r"   r   r   r   r   <module>   s   
