B
    ž3Rc—  ã               @   s0   d Z ddlZddlZejZddd„Zdd„ ZdS )a  
$Id$

Original author:  Thorsten Henninger <henni@brainbot.com>
Info about this file: http://mail.python.org/pipermail/python-win32/2003-December/001453.html

Use this in confuction with McMillan-Installer, if you need COM-Support in your application.
McMillan Installer as well as PythonCOM do overwrite the import Method for their needs.

_myimport advises the imports to either PythonCOM-Import or McMillan Import.

set_gen_path: use this method to specify the gencache-path, where all Python-COMObjects will be
              automatically generated in.

One needs to Patch the McMillan Installer such that the Python-nativ import has to be saved as
__oldimport__

Use this hack in your application with

import comhack
set_gen_path(mypath)

Then everything will work ...
é    Nc          
   C   sR   yt | |||ƒS  tk
rL } z |  d¡r8t| |||ƒS |‚W dd}~X Y nX dS )zš
    Tell all modules to imported by McMillan's (or Python's) import.method,
    besides win32com modules automatically genrated by win32com.gencache
    zwin32com.gen_pyN)ÚmcimportÚImportErrorÚ
startswithZ__oldimport__)ÚnameÚglobalsÚlocalsÚfromlistÚerr© r
   ú2lib/python3.7/site-packages/rdkit/utils/comhack.pyÚ	_myimport!   s    
r   c             C   sj   ddl }ddl}ddl}|j | ¡} |j | ¡s:| | ¡ tj 	dd¡}| g|j
_| |_|s`dS tt_dS )z
    Set the gencache Path
    If not set, all Modules (win32com) will be generated to support/gen_py of your apllication.
    r   NÚfrozen)ÚosÚwin32comZwin32com.gen_pyÚpathÚabspathÚexistsÚmakedirsÚsysÚ__dict__ÚgetZgen_pyÚ__path__Z__gen_path__r   Ú__builtin__Ú
__import__)r   r   r   r   r
   r
   r   Úset_gen_path3   s    

r   )NNN)Ú__doc__r   r   r   r   r   r   r
   r
   r
   r   Ú<module>   s
   
