Runtime#
This code is run when initializing the python interperter in a Relenv environment.
Point Relenv’s Openssl to the system installed Openssl certificate path
Make sure pip creates scripts with a shebang that points to the correct python using a relative path.
On linux, provide pip with the proper location of the Relenv toolchain gcc. This ensures when using pip any c dependencies are compiled against the proper glibc version.
- class relenv.runtime.RelenvImporter(wrappers=None, _loads=None)#
Handle runtime wrapping of module methods.
- create_module(spec)#
Create the module via a spec.
- exec_module(module)#
Exec module noop.
- find_module(module_name, package_path=None)#
Find modules being imported.
- load_module(name)#
Load an imported module.
- class relenv.runtime.Wrapper(module, wrapper, matcher='equals', _loading=False)#
Wrap methods of an imported module.
- matches(module)#
Check if wrapper metches module being imported.
- relenv.runtime.bootstrap()#
Bootstrap the relenv environment.
- relenv.runtime.debug(string)#
Prints the provided message if RELENV_DEBUG is truthy in the environment.
- Parameters:
string (str) – The message to print
- relenv.runtime.finalize_options_wrapper(func)#
Wrapper around build_ext.finalize_options.
Used to add the relenv environment’s include path.
- relenv.runtime.get_config_var_wrapper(func)#
Return a wrapper to resolve paths relative to the relenv root.
- relenv.runtime.get_config_vars_wrapper(func, mod)#
Return a wrapper to resolve paths relative to the relenv root.
- relenv.runtime.get_major_version()#
Current python major version.
- relenv.runtime.get_paths_wrapper(func, default_scheme)#
Return a wrapper to resolve paths relative to the relenv root.
- relenv.runtime.install_cargo_config()#
Setup cargo config.
- relenv.runtime.install_legacy_wrapper(func)#
Wrap pip’s legacy install function.
This method determines any newly installed files and checks their RPATHs.
- relenv.runtime.install_wheel_wrapper(func)#
Wrap pip’s wheel install function.
This method determines any newly installed files and checks their RPATHs.
- relenv.runtime.pushd(new_dir)#
Changedir context.
- relenv.runtime.relenv_root()#
Return the relenv module root.
- relenv.runtime.set_env_if_not_set(name, value)#
Set an environment variable if not already set.
If the environment variable is already set and not equal to value, warn the user.
- relenv.runtime.setup_crossroot()#
Setup cross root if needed.
- relenv.runtime.setup_openssl()#
Configure openssl certificate locations.
- relenv.runtime.wrap_distutils_command(name)#
distutils.command wrapper.
- relenv.runtime.wrap_pip_build_wheel(name)#
pip._internal.operations.build wrapper.
- relenv.runtime.wrap_pip_distlib_scripts(name)#
pip.distlib.scripts wrapper.
- relenv.runtime.wrap_pip_install_legacy(name)#
pip._internal.operations.install.legacy wrapper.
- relenv.runtime.wrap_pip_install_wheel(name)#
pip._internal.operations.install.wheel wrapper.
- relenv.runtime.wrap_sysconfig(name)#
Sysconfig wrapper.
- relenv.runtime.wrapsitecustomize(func)#
Wrap site.execsitecustomize.
This allows relenv a hook to be the last thing that runs when pythong is setting itself up.