• 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 
51 extern PyStatus _PyPathConfig_Calculate(
52     _PyPathConfig *pathconfig,
53     const PyConfig *config);
54 extern int _PyPathConfig_ComputeSysPath0(
55     const PyWideStringList *argv,
56     PyObject **path0);
57 extern PyStatus _Py_FindEnvConfigValue(
58     FILE *env_file,
59     const wchar_t *key,
60     wchar_t **value_p);
61 
62 #ifdef MS_WINDOWS
63 extern wchar_t* _Py_GetDLLPath(void);
64 #endif
65 
66 extern PyStatus _PyConfig_WritePathConfig(const PyConfig *config);
67 extern void _Py_DumpPathConfig(PyThreadState *tstate);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 #endif /* !Py_INTERNAL_PATHCONFIG_H */
73