U ��_W � @ sB d ddgZ dZddlmZmZ ddlmZ dd d�Zddd�Zd S )Zc_lexer�c_parserZc_astz2.14� )�Popen�PIPE� )�CParser�cpp� c C s� |g}t |t�r||7 }n|dkr,||g7 }|| g7 }zt|tdd�}|�� d }W n2 tk r� } ztdd| ��W 5 d}~X Y nX |S )ae Preprocess a file using cpp. filename: Name of the file you want to preprocess. cpp_path: cpp_args: Refer to the documentation of parse_file for the meaning of these arguments. When successful, returns the preprocessed file's contents. Errors from cpp will be printed out. r T)�stdoutZuniversal_newlinesr zAUnable to invoke 'cpp'. Make sure its path was passed correctly zOriginal error: %sN)� isinstance�listr r Zcommunicate�OSError�RuntimeError)�filename�cpp_path�cpp_args� path_list�pipe�text�e� r �/__init__.py�preprocess_file s"