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