How to tell if python instance was compiled as framework?
Question: How can one tell if a given instance of Python (on OS X) was compiled with the
`--enable-framework` flag?

The one thing I tried is not entirely conclusive:

    
    
    % python -c 'import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())' | grep -i framework
     'LIBS': '-ldl  -framework CoreFoundation',
     'PYTHONFRAMEWORK': '',
     'PYTHONFRAMEWORKDIR': 'no-framework',
     'PYTHONFRAMEWORKINSTALLDIR': '',
     'PYTHONFRAMEWORKPREFIX': '',
     'RESSRCDIR': 'Mac/Resources/framework',
     'SHLIBS': '-ldl  -framework CoreFoundation',
     'WITH_NEXT_FRAMEWORK': 0,
    


Answer: The definitive test for an OS X framework build:

    
    
    ./configure --enable-framework ...
    

is the presence of `PYTHONFRAMEWORK` in the Python build config variables.
This idiom is used throughout the Python standard library:

    
    
    if get_config_var("PYTHONFRAMEWORK"):
        # framework build
    

See for example, [this
test](http://hg.python.org/cpython/file/v3.3.0/Lib/sysconfig.py) at line 221
in the `sysconfig` module itself.

