##// END OF EJS Templates
pyoxidizer: add user-site to `sys.path` on Windows...
pyoxidizer: add user-site to `sys.path` on Windows This is a port of 53221078e0de to Windows to allow pip-installed extensions to be loaded without specifying a path. It's a major headache to have an hg.exe on `PATH` that needs to have the path to the extensions specified, because WSL doesn't see the same path. This is only for Windows for now, to match the currently shipping py2 behavior. There is a better solution with using the `site` package, but this needs support in PyOxidizer[1]. [1] https://github.com/indygreg/PyOxidizer/issues/430 Differential Revision: https://phab.mercurial-scm.org/D11308

File last commit:

r45406:9f96beb9 default
r48679:95af358f stable
Show More
debug.rs
24 lines | 822 B | application/rls-services+xml | RustLexer
// debug.rs
//
// Copyright 2020 Raphaël Gomès <rgomes@octobus.net>
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
//! Module to get debug information about Rust extensions.
use cpython::{PyDict, PyModule, PyResult, Python};
/// Create the module, with `__package__` given from parent
pub fn init_module(py: Python, package: &str) -> PyResult<PyModule> {
let dotted_name = &format!("{}.debug", package);
let m = PyModule::new(py, dotted_name)?;
m.add(py, "__package__", package)?;
m.add(py, "__doc__", "Rust debugging information")?;
let sys = PyModule::import(py, "sys")?;
let sys_modules: PyDict = sys.get(py, "modules")?.extract(py)?;
sys_modules.set_item(py, dotted_name, &m)?;
Ok(m)
}