mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
renamed pip_install tool to just pip, move all the pip stuff to it
filter out annoying ensurepip messages
This commit is contained in:
+2
-2
@@ -132,7 +132,7 @@ void pyqt::build_and_install_from_source()
|
||||
{
|
||||
instrument<times::build>([&]
|
||||
{
|
||||
run_tool(pip_install()
|
||||
run_tool(pip(pip::install)
|
||||
.package("PyQt-builder")
|
||||
.version(builder_version()));
|
||||
|
||||
@@ -211,7 +211,7 @@ void pyqt::install_sip_file()
|
||||
}
|
||||
else
|
||||
{
|
||||
run_tool(pip_install()
|
||||
run_tool(pip(pip::install)
|
||||
.file(paths::cache() / sip_install_file()));
|
||||
|
||||
installed_bypass.create();
|
||||
|
||||
+1
-19
@@ -235,25 +235,7 @@ void python::copy_files()
|
||||
void python::install_pip()
|
||||
{
|
||||
cx().trace(context::generic, "installing pip");
|
||||
|
||||
run_tool(process_runner(process()
|
||||
.binary(python_exe())
|
||||
.arg("-m", "ensurepip")));
|
||||
|
||||
run_tool(process_runner(process()
|
||||
.binary(python_exe())
|
||||
.arg("-m pip")
|
||||
.arg("install")
|
||||
.arg("--no-warn-script-location")
|
||||
.arg("--upgrade pip")));
|
||||
|
||||
// ssl errors while downloading through python without certifi
|
||||
run_tool(process_runner(process()
|
||||
.binary(python_exe())
|
||||
.arg("-m pip")
|
||||
.arg("install")
|
||||
.arg("--no-warn-script-location")
|
||||
.arg("certifi")));
|
||||
run_tool(pip(pip::ensure));
|
||||
}
|
||||
|
||||
msbuild python::create_msbuild_tool(msbuild::ops o)
|
||||
|
||||
+70
-6
@@ -230,30 +230,94 @@ void nuget::do_run()
|
||||
}
|
||||
|
||||
|
||||
pip_install::pip_install()
|
||||
: basic_process_runner("pip install")
|
||||
pip::pip(ops op)
|
||||
: basic_process_runner("pip"), op_(op)
|
||||
{
|
||||
}
|
||||
|
||||
pip_install& pip_install::package(const std::string& s)
|
||||
pip& pip::package(const std::string& s)
|
||||
{
|
||||
package_ = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
pip_install& pip_install::version(const std::string& s)
|
||||
pip& pip::version(const std::string& s)
|
||||
{
|
||||
version_ = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
pip_install& pip_install::file(const fs::path& p)
|
||||
pip& pip::file(const fs::path& p)
|
||||
{
|
||||
file_ = p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pip_install::do_run()
|
||||
void pip::do_run()
|
||||
{
|
||||
switch (op_)
|
||||
{
|
||||
case ensure:
|
||||
do_ensure();
|
||||
break;
|
||||
|
||||
case install:
|
||||
do_install();
|
||||
break;
|
||||
|
||||
default:
|
||||
cx().bail_out(context::generic, "pip unknown op {}", op_);
|
||||
}
|
||||
}
|
||||
|
||||
void pip::do_ensure()
|
||||
{
|
||||
// ensure
|
||||
//
|
||||
// this spits out two warnings about not being on PATH and suggests to add
|
||||
// --no-warn-script-location, but that's not actually a valid command
|
||||
// line parameter for `ensurepip` and it fails, unlike the `install`
|
||||
// commands below
|
||||
//
|
||||
// so just filter it out
|
||||
|
||||
set_process(process()
|
||||
.stderr_filter([](auto&& f)
|
||||
{
|
||||
if (f.line.find("which is not on PATH") != -1)
|
||||
f.lv = context::level::debug;
|
||||
else if (f.line.find("Consider adding this directory"))
|
||||
f.lv = context::level::debug;
|
||||
})
|
||||
.binary(python::python_exe())
|
||||
.arg("-m", "ensurepip"));
|
||||
|
||||
execute_and_join();
|
||||
|
||||
|
||||
// upgrade
|
||||
set_process(process()
|
||||
.binary(python::python_exe())
|
||||
.arg("-m pip")
|
||||
.arg("install")
|
||||
.arg("--no-warn-script-location")
|
||||
.arg("--upgrade pip"));
|
||||
|
||||
execute_and_join();
|
||||
|
||||
|
||||
// ssl errors while downloading through python without certifi
|
||||
set_process(process()
|
||||
.binary(python::python_exe())
|
||||
.arg("-m pip")
|
||||
.arg("install")
|
||||
.arg("--no-warn-script-location")
|
||||
.arg("certifi"));
|
||||
|
||||
execute_and_join();
|
||||
}
|
||||
|
||||
void pip::do_install()
|
||||
{
|
||||
auto p = process()
|
||||
.binary(python::python_exe())
|
||||
|
||||
+15
-5
@@ -590,22 +590,32 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class pip_install : public basic_process_runner
|
||||
class pip : public basic_process_runner
|
||||
{
|
||||
public:
|
||||
pip_install();
|
||||
enum ops
|
||||
{
|
||||
ensure = 1,
|
||||
install
|
||||
};
|
||||
|
||||
pip_install& package(const std::string& s);
|
||||
pip_install& version(const std::string& s);
|
||||
pip_install& file(const fs::path& p);
|
||||
pip(ops o);
|
||||
|
||||
pip& package(const std::string& s);
|
||||
pip& version(const std::string& s);
|
||||
pip& file(const fs::path& p);
|
||||
|
||||
protected:
|
||||
void do_run() override;
|
||||
|
||||
private:
|
||||
ops op_;
|
||||
std::string package_;
|
||||
std::string version_;
|
||||
fs::path file_;
|
||||
|
||||
void do_ensure();
|
||||
void do_install();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user