[Python-Dev] API for the new sysconfig module

Raymond Hettinger raymond.hettinger at gmail.com
Fri Dec 10 01:18:14 CET 2010


Does anyone know why this needed a separate module and so many accessor functions?
ISTM it mostly could have been reduced to single call returning a nested dictionary.

Raymond



from sysconfig import *
import json

def sysconf():
    return dict(paths = get_paths(),
                config_vars = get_config_vars(),
                platform = get_platform(),
                version = get_python_version(),
                scheme_names = get_scheme_names(),
                )

print(json.dumps(sysconf(), indent=2))

{
  "config_vars": {
    "EXE": ".exe", 
    "VERSION": "32", 
    "py_version_nodot": "32", 
    "exec_prefix": "C:\\Python32", 
    "platbase": "C:\\Python32", 
    "userbase": "C:\\Documents and Settings\\Raymond\\Application Data\\Python", 
    "LIBDEST": "C:\\Python32\\Lib", 
    "py_version_short": "3.2", 
    "prefix": "C:\\Python32", 
    "base": "C:\\Python32", 
    "SO": ".pyd", 
    "projectbase": "C:\\Python32", 
    "BINLIBDEST": "C:\\Python32\\Lib", 
    "srcdir": "C:\\Python32", 
    "py_version": "3.2b1", 
    "abiflags": "", 
    "INCLUDEPY": "C:\\Python32\\Include", 
    "BINDIR": "C:\\Python32"
  }, 
  "platform": "win32", 
  "version": "3.2", 
  "scheme_names": [
    "nt", 
    "nt_user", 
    "os2", 
    "os2_home", 
    "osx_framework_user", 
    "posix_home", 
    "posix_prefix", 
    "posix_user"
  ], 
  "paths": {
    "platinclude": "C:\\Python32\\Include", 
    "platstdlib": "C:\\Python32\\Lib", 
    "platlib": "C:\\Python32\\Lib\\site-packages", 
    "purelib": "C:\\Python32\\Lib\\site-packages", 
    "stdlib": "C:\\Python32\\Lib", 
    "scripts": "C:\\Python32\\Scripts", 
    "include": "C:\\Python32\\Include", 
    "data": "C:\\Python32"
  }
}



More information about the Python-Dev mailing list