Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7ff59b2
Add _bootsrap.py as frozen module
palaviv Jun 1, 2019
e88d6ac
Add init_importlib
palaviv Jun 5, 2019
698044b
Add Module.__name__
palaviv Jun 5, 2019
f1af6b1
Include _bootstrap.py as str
palaviv Jun 7, 2019
f214588
Don't set __file__ for frozen modules
palaviv Jun 7, 2019
0d9a066
Add sys.meta_path
palaviv Jun 7, 2019
37b40c5
Add frozen _bootstrap_external.py
palaviv Jun 7, 2019
fbaff7f
Install external importers on init_importlib
palaviv Jun 7, 2019
a57f38b
Rename builtin io to _io
palaviv Jun 7, 2019
b0cccf3
Change os_details
palaviv Jun 7, 2019
58d9d9d
Add sys.path_hooks
palaviv Jun 7, 2019
7f61125
Use _bootstrap.py __import__
palaviv Jun 7, 2019
2817214
Remove unused imports
palaviv Jun 7, 2019
0e76dbb
Add needed methods to _thread
palaviv Jun 7, 2019
5c53e58
Print frozen import file name in stacktrace
palaviv Jun 7, 2019
6615e81
Collapse concat
palaviv Jun 8, 2019
fe0284a
Add new to objmodule and change __name__ to property
palaviv Jun 8, 2019
375790e
objmodule should have a dict
palaviv Jun 8, 2019
c8248c3
Expose __name__ in __dict__
palaviv Jun 9, 2019
5584733
Add sys.path_importer_cache
palaviv Jun 9, 2019
d9d0ea1
Fix os to _os in class
palaviv Jun 9, 2019
5df05d4
Add script dir to sys.path
palaviv Jun 9, 2019
b567464
Add ModuleNotFoundError to builtins
palaviv Jun 9, 2019
10828e0
Set sys.pycache_prefix to None
palaviv Jun 9, 2019
8dec522
compile source may be bytes
palaviv Jun 9, 2019
03735a6
Add optional parameters to compile
palaviv Jun 10, 2019
e1472f2
Add sys.dont_write_bytecode
palaviv Jun 10, 2019
603ef1a
Support from_list
palaviv Jun 10, 2019
0e320f9
Change comment to XXX
palaviv Jun 10, 2019
ea8e280
Simplify objmodule
palaviv Jun 11, 2019
1de9f73
Optimize already loaded modules
palaviv Jun 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Include _bootstrap.py as str
  • Loading branch information
palaviv committed Jun 10, 2019
commit f1af6b1f4056ff3523ee8d4e064febbedd2d4764
2 changes: 0 additions & 2 deletions vm/src/importlib.rs → Lib/importlib/_bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub const IMPORTLIB_BOOTSTRAP: &str = r#"
"""Core implementation of import.

This module is NOT meant to be directly imported! It has been designed such
Expand Down Expand Up @@ -1172,4 +1171,3 @@ def _install_external_importers():
import _frozen_importlib_external
_bootstrap_external = _frozen_importlib_external
_frozen_importlib_external._install(sys.modules[__name__])
"#;
13 changes: 12 additions & 1 deletion vm/src/frozen.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
use crate::importlib::IMPORTLIB_BOOTSTRAP;
use std::collections::hash_map::HashMap;

const HELLO: &str = "initialized = True
print(\"Hello world!\")
";

const IMPORTLIB_BOOTSTRAP: &'static str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/",
"..",
"/",
"Lib",
"/",
"importlib",
"/",
"_bootstrap.py"
));

pub fn get_module_inits() -> HashMap<String, &'static str> {
let mut modules = HashMap::new();
modules.insert("__hello__".to_string(), HELLO);
Expand Down
1 change: 0 additions & 1 deletion vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub mod frame;
mod frozen;
pub mod function;
pub mod import;
mod importlib;
pub mod obj;
mod pyhash;
pub mod pyobject;
Expand Down