MCPcopy Index your code
hub / github.com/RustPython/RustPython / _uninstall_helper

Function _uninstall_helper

Lib/ensurepip/__init__.py:175–203  ·  view source on GitHub ↗

Helper to support a clean default uninstall process on Windows Note that calling this function may alter os.environ.

(*, verbosity=0)

Source from the content-addressed store, hash-verified

173
174
175def _uninstall_helper(*, verbosity=0):
176 """Helper to support a clean default uninstall process on Windows
177
178 Note that calling this function may alter os.environ.
179 """
180 # Nothing to do if pip was never installed, or has been removed
181 try:
182 import pip
183 except ImportError:
184 return
185
186 # If the installed pip version doesn't match the available one,
187 # leave it alone
188 available_version = version()
189 if pip.__version__ != available_version:
190 print(f"ensurepip will only uninstall a matching version "
191 f"({pip.__version__!r} installed, "
192 f"{available_version!r} available)",
193 file=sys.stderr)
194 return
195
196 _disable_pip_configuration_settings()
197
198 # Construct the arguments to be passed to the pip command
199 args = ["uninstall", "-y", "--disable-pip-version-check"]
200 if verbosity:
201 args += ["-" + "v" * verbosity]
202
203 return _run_pip([*args, "pip"])
204
205
206def _main(argv=None):

Callers

nothing calls this directly

Calls 4

_run_pipFunction · 0.85
versionFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected