locations.py 791 B

1234567891011121314151617181920212223242526272829303132
  1. __all__ = [
  2. 'get_python_inc',
  3. 'get_config_var',
  4. 'get_python_version',
  5. 'PREFIX',
  6. 'get_python_lib',
  7. 'get_config_vars',
  8. ]
  9. import sys
  10. if sys.version_info < (3, 12):
  11. from distutils.sysconfig import *
  12. else:
  13. from sysconfig import *
  14. PREFIX = get_config_var('prefix')
  15. def get_python_inc(plat_specific=False):
  16. path_name = 'platinclude' if plat_specific else 'include'
  17. return get_path(path_name)
  18. def get_python_lib(plat_specific=False, standard_lib=False):
  19. if standard_lib:
  20. path_name = 'stdlib'
  21. if plat_specific:
  22. path_name = 'plat' + path_name
  23. elif plat_specific:
  24. path_name = 'platlib'
  25. else:
  26. path_name = 'purelib'
  27. return get_path(path_name)