pycore_pathconfig.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef Py_INTERNAL_PATHCONFIG_H
  2. #define Py_INTERNAL_PATHCONFIG_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #ifndef Py_BUILD_CORE
  7. # error "this header requires Py_BUILD_CORE define"
  8. #endif
  9. typedef struct _PyPathConfig {
  10. /* Full path to the Python program */
  11. wchar_t *program_full_path;
  12. wchar_t *prefix;
  13. wchar_t *exec_prefix;
  14. /* Set by Py_SetPath(), or computed by _PyConfig_InitPathConfig() */
  15. wchar_t *module_search_path;
  16. /* Python program name */
  17. wchar_t *program_name;
  18. /* Set by Py_SetPythonHome() or PYTHONHOME environment variable */
  19. wchar_t *home;
  20. #ifdef MS_WINDOWS
  21. /* isolated and site_import are used to set Py_IsolatedFlag and
  22. Py_NoSiteFlag flags on Windows in read_pth_file(). These fields
  23. are ignored when their value are equal to -1 (unset). */
  24. int isolated;
  25. int site_import;
  26. /* Set when a venv is detected */
  27. wchar_t *base_executable;
  28. #endif
  29. } _PyPathConfig;
  30. #ifdef MS_WINDOWS
  31. # define _PyPathConfig_INIT \
  32. {.module_search_path = NULL, \
  33. .isolated = -1, \
  34. .site_import = -1}
  35. #else
  36. # define _PyPathConfig_INIT \
  37. {.module_search_path = NULL}
  38. #endif
  39. /* Note: _PyPathConfig_INIT sets other fields to 0/NULL */
  40. PyAPI_DATA(_PyPathConfig) _Py_path_config;
  41. #ifdef MS_WINDOWS
  42. PyAPI_DATA(wchar_t*) _Py_dll_path;
  43. #endif
  44. extern void _PyPathConfig_ClearGlobal(void);
  45. extern PyStatus _PyPathConfig_SetGlobal(
  46. const struct _PyPathConfig *pathconfig);
  47. extern PyStatus _PyPathConfig_Calculate(
  48. _PyPathConfig *pathconfig,
  49. const PyConfig *config);
  50. extern int _PyPathConfig_ComputeSysPath0(
  51. const PyWideStringList *argv,
  52. PyObject **path0);
  53. extern int _Py_FindEnvConfigValue(
  54. FILE *env_file,
  55. const wchar_t *key,
  56. wchar_t *value,
  57. size_t value_size);
  58. #ifdef MS_WINDOWS
  59. extern wchar_t* _Py_GetDLLPath(void);
  60. #endif
  61. extern PyStatus _PyConfig_WritePathConfig(const PyConfig *config);
  62. extern void _Py_DumpPathConfig(PyThreadState *tstate);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* !Py_INTERNAL_PATHCONFIG_H */