kjo
kjo

Reputation: 35331

How to tell if python instance was compiled as framework?

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,

Upvotes: 3

Views: 1017

Answers (1)

Ned Deily
Ned Deily

Reputation: 85095

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 at line 221 in the sysconfig module itself.

Upvotes: 2

Related Questions