private bool Install(PythonInstall install, PackageDownload download, Request request) { if (download.packagetype != "bdist_wheel") { if (!install.InstallPip(request)) { return(false); } } string tempdir, filename; if (!DoDownload(download, out tempdir, out filename, request)) { return(false); } try { if (download.packagetype == "bdist_wheel") { foreach (var package in PackagesFromFile(filename, request)) { if (package.MatchesName(name) && package.version.raw_version_string == version.raw_version_string) { return(package.Install(install, request)); } } request.Error(ErrorCategory.MetadataError, name, "Downloaded package file doesn't contain the expected package."); return(false); } else { return(install.InstallViaPip(filename, request)); } } finally { File.Delete(filename); Directory.Delete(tempdir); } }
public virtual bool Uninstall(Request request) { if (distinfo_path != null) { return(install.UninstallDistinfo(distinfo_path, request) == 0); } else if (egginfo_path != null) { if (!install.InstallPip(request)) { return(false); } return(install.UninstallViaPip(name, request)); } else { request.Error(ErrorCategory.NotImplemented, name, "uninstalling not implemented for this package type"); return(false); } }