forked from RustPython/RustPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
150 lines (144 loc) · 4.09 KB
/
Copy pathmod.rs
File metadata and controls
150 lines (144 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
mod _abc;
#[cfg(feature = "ast")]
pub(crate) mod _ast;
mod _codecs;
mod _collections;
mod _functools;
mod _imp;
pub mod _io;
mod _operator;
mod _sre;
mod _stat;
mod _string;
#[cfg(feature = "compiler")]
mod _symtable;
mod _sysconfig;
mod _sysconfigdata;
mod _types;
pub mod _typing;
pub mod _warnings;
mod _weakref;
pub mod atexit;
pub mod builtins;
pub mod errno;
mod gc;
mod itertools;
mod marshal;
pub mod time;
mod typevar;
#[cfg(feature = "host_env")]
#[macro_use]
pub mod os;
#[cfg(all(feature = "host_env", windows))]
pub mod nt;
#[cfg(all(feature = "host_env", unix))]
pub mod posix;
#[cfg(all(feature = "host_env", not(any(unix, windows))))]
#[path = "posix_compat.rs"]
pub mod posix;
#[cfg(all(
feature = "host_env",
any(
target_os = "linux",
target_os = "macos",
target_os = "windows",
target_os = "android"
),
not(any(target_env = "musl", target_env = "sgx"))
))]
mod _ctypes;
#[cfg(all(feature = "host_env", windows))]
pub(crate) mod msvcrt;
#[cfg(all(
feature = "host_env",
unix,
not(any(target_os = "ios", target_os = "wasi", target_os = "redox"))
))]
mod pwd;
#[cfg(feature = "host_env")]
pub(crate) mod _signal;
#[cfg(feature = "threading")]
pub mod _thread;
#[cfg(all(feature = "host_env", windows))]
mod _wmi;
pub mod sys;
#[cfg(all(feature = "host_env", windows))]
#[path = "_winapi.rs"]
mod winapi;
#[cfg(all(feature = "host_env", windows))]
mod winreg;
#[cfg(all(feature = "host_env", windows))]
mod winsound;
use crate::{Context, builtins::PyModuleDef};
/// Returns module definitions for multi-phase init modules.
///
/// These modules use multi-phase initialization pattern:
/// 1. Create module from def and add to sys.modules
/// 2. Call exec slot (can safely import other modules without circular import issues)
pub fn builtin_module_defs(ctx: &Context) -> Vec<&'static PyModuleDef> {
vec![
_abc::module_def(ctx),
_types::module_def(ctx),
#[cfg(feature = "ast")]
_ast::module_def(ctx),
atexit::module_def(ctx),
_codecs::module_def(ctx),
_collections::module_def(ctx),
#[cfg(all(
feature = "host_env",
any(
target_os = "linux",
target_os = "macos",
target_os = "windows",
target_os = "android"
),
not(any(target_env = "musl", target_env = "sgx"))
))]
_ctypes::module_def(ctx),
errno::module_def(ctx),
_functools::module_def(ctx),
gc::module_def(ctx),
_imp::module_def(ctx),
_io::module_def(ctx),
itertools::module_def(ctx),
marshal::module_def(ctx),
#[cfg(all(feature = "host_env", windows))]
msvcrt::module_def(ctx),
#[cfg(all(feature = "host_env", windows))]
nt::module_def(ctx),
_operator::module_def(ctx),
#[cfg(all(feature = "host_env", any(unix, target_os = "wasi")))]
posix::module_def(ctx),
#[cfg(all(feature = "host_env", not(any(unix, windows, target_os = "wasi"))))]
posix::module_def(ctx),
#[cfg(all(
feature = "host_env",
unix,
not(any(target_os = "ios", target_os = "wasi", target_os = "redox"))
))]
pwd::module_def(ctx),
#[cfg(feature = "host_env")]
_signal::module_def(ctx),
_sre::module_def(ctx),
_stat::module_def(ctx),
_string::module_def(ctx),
#[cfg(feature = "compiler")]
_symtable::module_def(ctx),
_sysconfigdata::module_def(ctx),
_sysconfig::module_def(ctx),
#[cfg(feature = "threading")]
_thread::module_def(ctx),
time::module_def(ctx),
_typing::module_def(ctx),
_warnings::module_def(ctx),
_weakref::module_def(ctx),
#[cfg(all(feature = "host_env", windows))]
winapi::module_def(ctx),
#[cfg(all(feature = "host_env", windows))]
winreg::module_def(ctx),
#[cfg(all(feature = "host_env", windows))]
winsound::module_def(ctx),
#[cfg(all(feature = "host_env", windows))]
_wmi::module_def(ctx),
]
}