##// END OF EJS Templates
packaging: enable rust extensions on centos...
packaging: enable rust extensions on centos Test on CentOS 7, repository with ~170000 tracked files, no untracked files: 10 runs with this enabled: -- Run #0 time: 0.6519973278045654 -- Run #1 time: 0.6933724880218506 -- Run #2 time: 0.7512078285217285 -- Run #3 time: 0.7517638206481934 -- Run #4 time: 0.5966529846191406 -- Run #5 time: 0.5960886478424072 -- Run #6 time: 0.5940573215484619 -- Run #7 time: 0.5963726043701172 -- Run #8 time: 0.6048009395599365 -- Run #9 time: 0.603604793548584 10 runs without this enabled: -- Run #0 time: 2.127584457397461 -- Run #1 time: 2.066192865371704 -- Run #2 time: 2.0831892490386963 -- Run #3 time: 2.077716588973999 -- Run #4 time: 2.07608962059021 -- Run #5 time: 2.072899341583252 -- Run #6 time: 2.094369888305664 -- Run #7 time: 2.067504644393921 -- Run #8 time: 2.069610834121704 -- Run #9 time: 2.0567898750305176 Differential Revision: https://phab.mercurial-scm.org/D9294

File last commit:

r46195:426294d0 default
r46547:eccbfa7e default
Show More
main.rs
39 lines | 1.4 KiB | application/rls-services+xml | RustLexer
use pyembed::MainPythonInterpreter;
// Include an auto-generated file containing the default
// `pyembed::PythonConfig` derived by the PyOxidizer configuration file.
//
// If you do not want to use PyOxidizer to generate this file, simply
// remove this line and instantiate your own instance of
// `pyembed::PythonConfig`.
include!(env!("PYOXIDIZER_DEFAULT_PYTHON_CONFIG_RS"));
fn main() {
// The following code is in a block so the MainPythonInterpreter is
// destroyed in an orderly manner, before process exit.
let code = {
// Load the default Python configuration as derived by the PyOxidizer
// config file used at build time.
let config = default_python_config();
// Construct a new Python interpreter using that config, handling any
// errors from construction.
match MainPythonInterpreter::new(config) {
Ok(mut interp) => {
// And run it using the default run configuration as specified
// by the configuration. If an uncaught Python
// exception is raised, handle it.
// This includes the special SystemExit, which is a request to
// terminate the process.
interp.run_as_main()
}
Err(msg) => {
eprintln!("{}", msg);
1
}
}
};
// And exit the process according to code execution results.
std::process::exit(code);
}