ó
’wÛjc           @   sî   d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m	 Z	 d d l
 m Z d d l m Z d d l m Z m Z d e j e j f d „  ƒ  YZ d	 „  Z e d
 k rê e j j e ƒ  ƒ n  d S(   s   Tests for distutils.sysconfig.iÿÿÿÿN(   t	   sysconfig(   t   get_default_compiler(   t   support(   t   TESTFNt	   swap_itemt   SysconfigTestCasec           B   sª   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e j	 e
 ƒ  d k d ƒ d „  ƒ Z d	 „  Z d
 „  Z d „  Z e j e j d ƒ d ƒ d „  ƒ Z d „  Z RS(   c         C   s    t  t |  ƒ j ƒ  d  |  _ d  S(   N(   t   superR   t   setUpt   Nonet   makefile(   t   self(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyR      s    c         C   sC   |  j  d  k	 r" t j |  j  ƒ n  |  j ƒ  t t |  ƒ j ƒ  d  S(   N(   R	   R   t   ost   unlinkt   cleanup_testfnR   R   t   tearDown(   R
   (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyR      s    
c         C   sT   t  j j } t j j | ƒ r. t j | ƒ n" t j j | ƒ rP t j	 | ƒ n  d  S(   N(
   t   testt   test_supportR   R   t   patht   isfilet   removet   isdirt   shutilt   rmtree(   R
   R   (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyR      s
    c         C   si   t  j ƒ  } |  j t  j ƒ  t  j d t ƒ ƒ t d ƒ } t  j t t ƒ } |  j | j d ƒ | ƒ d  S(   Nt   prefixR    t
   platstdlib(   R    t   get_python_libt   assertNotEqualR   t
   __import__t   Truet   assertEqualt   get_path(   R
   t   lib_dirt
   _sysconfigt   res(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   test_get_python_lib"   s    c         C   s]   t  j ƒ  } |  j t j j | ƒ | ƒ t j j | d ƒ } |  j t j j | ƒ | ƒ d  S(   Ns   Python.h(   R    t   get_python_inct
   assertTrueR   R   R   t   joinR   (   R
   t   inc_dirt   python_h(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   test_get_python_inc-   s    c         C   sÖ   d d d „  ƒ  Y} i d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6} | ƒ  } t  t j ƒ } zH d t j d <x' | j ƒ  D] \ } } | t j | <q† Wt j | ƒ Wd  t j j ƒ  t j j | ƒ X| S(   Nt   compilerc           B   s   e  Z d  Z d „  Z RS(   t   unixc         [   s   | |  _  d  S(   N(   t   exes(   R
   t   kw(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   set_executables;   s    (   t   __name__t
   __module__t   compiler_typeR-   (    (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyR)   8   s   t   sc_art   ARt   sc_cct   CCt   sc_cxxt   CXXs   --sc-arflagst   ARFLAGSs   --sc-cflagst   CFLAGSs   --sc-ccsharedt   CCSHAREDt   sc_ldsharedt   LDSHAREDt   sc_shutil_suffixt   SOR   t   CUSTOMIZED_OSX_COMPILER(    (   t   dictR    t   _config_varst   itemst   customize_compilert   cleart   update(   R
   R)   t   sysconfig_varst   compt   old_varst   keyt   value(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyRB   6   s(    
	R*   s+   not testing if default compiler is not unixc         C   s]  t  j ƒ  d t j d <d t j d <d t j d <d t j d <d	 t j d
 <d t j d <d t j d <d t j d <d t j d <|  j ƒ  } |  j | j d d ƒ |  j | j d d ƒ |  j | j d d ƒ |  j | j d d ƒ |  j | j d d ƒ |  j | j d d ƒ |  j | j d d ƒ |  j | j d ƒ t j d =t j d =t j d =t j d =t j d
 =t j d =t j d =t j d =t j d =|  j ƒ  } |  j | j d d  ƒ |  j | j d d! ƒ |  j | j d d" ƒ |  j | j d d# ƒ |  j | j d d$ ƒ |  j | j d d% ƒ |  j | j d d& ƒ |  j | j d ƒ d  S('   Nt   env_arR2   t   env_ccR4   t   env_cppt   CPPs   env_cxx --env-cxx-flagsR6   t   env_ldsharedR;   s   --env-ldflagst   LDFLAGSs   --env-arflagsR7   s   --env-cflagsR8   s   --env-cppflagst   CPPFLAGSt   archivers   env_ar --env-arflagst   preprocessors   env_cpp --env-cppflagsR)   s.   env_cc --sc-cflags --env-cflags --env-cppflagst   compiler_sos<   env_cc --sc-cflags --env-cflags --env-cppflags --sc-ccsharedt   compiler_cxxt
   linker_exet	   linker_sos6   env_ldshared --env-ldflags --env-cflags --env-cppflagsR<   s   sc_ar --sc-arflagss   sc_cc -Es   sc_cc --sc-cflagss   sc_cc --sc-cflags --sc-ccsharedR5   R3   R:   (   R    t   get_config_varsR   t   environRB   R   R+   t   shared_lib_extension(   R
   RF   (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   test_customize_compilerX   sf    









c         C   s�   t  j j |  _ t |  j d ƒ } z | j d ƒ | j d ƒ Wd  | j ƒ  Xt j |  j ƒ } |  j	 | i d d 6d d 6ƒ d  S(   Nt   ws)   CONFIG_ARGS=  '--arg1=optarg1' 'ENV=LIB'
s   VAR=$OTHER
OTHER=foos   '--arg1=optarg1' 'ENV=LIB't   CONFIG_ARGSt   foot   OTHER(
   R   R   R   R	   t   opent   writet   closeR    t   parse_makefileR   (   R
   t   fdt   d(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   test_parse_makefile_base–   s    c         C   s�   t  j j |  _ t |  j d ƒ } z | j d ƒ | j d ƒ Wd  | j ƒ  Xt j |  j ƒ } |  j	 | i d d 6d d 6ƒ d  S(   NR[   s,   CONFIG_ARGS=  '--arg1=optarg1' 'ENV=\$$LIB'
s   VAR=$OTHER
OTHER=foos   '--arg1=optarg1' 'ENV=\$LIB'R\   R]   R^   (
   R   R   R   R	   R_   R`   Ra   R    Rb   R   (   R
   Rc   Rd   (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt"   test_parse_makefile_literal_dollar¢   s    c         C   sT   d d  l  } |  j | j d ƒ t  j d ƒ ƒ |  j | j d ƒ t  j d ƒ ƒ d  S(   NiÿÿÿÿR8   RO   (   R    R   t   get_config_var(   R
   t   global_sysconfig(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   test_sysconfig_module¯   s    "R>   s   compiler flags customizedc         C   ss   d d  l  } t  j d ƒ r+ |  j d ƒ n  |  j | j d ƒ t  j d ƒ ƒ |  j | j d ƒ t  j d ƒ ƒ d  S(   NiÿÿÿÿR>   s   compiler flags customizedR;   R4   (   R    Rg   t   skipTestR   (   R
   Rh   (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   test_sysconfig_compiler_vars´   s
    "c      	   C   s”   t  t d ƒ � } | j t j d ƒ ƒ Wd  QXt j t t j	 ƒ t g d t j
 d t j d t ƒ} | j ƒ  \ } } |  j d | j d | ƒ d  S(   NR[   sB                  from distutils.core import Distribution
                config = Distribution().get_command_obj('config')
                # try_compile may pass or it may fail if no compiler
                # is found but it should not raise an exception.
                rc = config.try_compile('int x;')
                t   stdoutt   stderrt   universal_newlinesi    s   Subprocess failed: (   R_   R   t
   writelinest   textwrapt   dedentt
   subprocesst   Popent   strt   syst
   executablet   PIPEt   STDOUTR   t   communicateR   t
   returncode(   R
   t   ft   pt   outst   errs(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt.   test_customize_compiler_before_get_config_varsÊ   s    			(   R.   R/   R   R   R   R"   R(   RB   t   unittestt
   skipUnlessR   RZ   Re   Rf   Ri   t   skipIfR    Rg   Rk   R   (    (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyR      s   							"=			$c          C   s&   t  j ƒ  }  |  j t  j t ƒ ƒ |  S(   N(   R€   t	   TestSuitet   addTestt	   makeSuiteR   (   t   suite(    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt
   test_suiteÞ   s    t   __main__(   t   __doc__R   R   R€   R   Rr   Ru   Rp   t	   distutilsR    t   distutils.ccompilerR   t   distutils.testsR   t   test.test_supportR   R   t   EnvironGuardt   TestCaseR   R‡   R.   R   t   run_unittest(    (    (    s”   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/distutils/tests/test_sysconfig.pyt   <module>   s    	Î	