3 \ÂJ ã @ s¾ d Z ddlZddlZddlZddddgZd1Zd2ZdZd3dd„Zdd„ Z dd„ Z dadd„ Zdd„ Z dd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d„ Zd.d„ Zd/d„ Zd0d„ ZdS )4zShared OS X support functions.é NÚcompiler_fixupÚcustomize_config_varsÚcustomize_compilerÚget_platform_osxÚCFLAGSÚLDFLAGSÚCPPFLAGSÚ BASECFLAGSÚ BLDSHAREDÚLDSHAREDÚCCÚCXXÚ PY_CFLAGSÚ PY_LDFLAGSÚPY_CPPFLAGSÚPY_CORE_CFLAGSÚPY_CORE_LDFLAGSZ_OSX_SUPPORT_INITIAL_c C sŒ |dkrt jd }|jt jƒ}t jj| ƒ\}}tjdkrH|dkrH| d } t jj| ƒs„x*|D ]"}t jj || ƒ}t jj|ƒrZ|S qZW dS | S dS )zÚTries to find 'executable' in the directories listed in 'path'. A string listing directories separated by 'os.pathsep'; defaults to os.environ['PATH']. Returns the complete filename or None if not found. NÚPATHZwin32z.exe) ÚosÚenvironÚsplitÚpathsepÚpathÚsplitextÚsysÚplatformÚisfileÚjoin)Ú executabler ÚpathsÚbaseZextÚpÚf© r# ú$/usr/lib64/python3.6/_osx_support.pyÚ_find_executable s r% c C sŠ ddl }yddl}|jƒ }W n( tk rD tdtjƒ f dƒ}Y nX |j|ƒ�0}d| |jf }tj |ƒs||j ƒ jdƒjƒ S dS Q R X dS )z0Output from successful command execution or Noner Nz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8) Ú contextlibÚtempfileZNamedTemporaryFileÚImportErrorÚopenr ÚgetpidÚclosingÚnameÚsystemÚreadÚdecodeÚstrip)Z commandstringr&