made pip install a tool

This commit is contained in:
isanae
2020-05-02 03:08:13 -04:00
parent c847a8c552
commit 60d70f0b1a
3 changed files with 66 additions and 15 deletions
+5 -15
View File
@@ -36,13 +36,9 @@ void pyqt::do_build_and_install()
"_QOpenGLFunctions_4_1_Core"
};
run_tool(process_runner(process()
.binary(python::python_exe())
.arg("-m", "pip")
.arg("install")
.arg("--no-warn-script-location")
.arg("--disable-pip-version-check")
.arg("PyQt-builder==" + versions::pyqt_builder())));
run_tool(pip_install()
.package("PyQt-builder")
.version(versions::pyqt_builder()));
run_tool(patcher()
.task(name())
@@ -100,14 +96,8 @@ void pyqt::do_build_and_install()
}
else
{
run_tool(process_runner(process()
.binary(python::python_exe())
.arg("-m", "pip")
.arg("install")
.arg("--no-warn-script-location")
.arg("--disable-pip-version-check")
.arg(paths::cache() / sip_install_file())
.cwd(python::source_path())));
run_tool(pip_install()
.file(paths::cache() / sip_install_file()));
op::touch(source_path() / "_mob_installed");
}
+42
View File
@@ -3,6 +3,7 @@
#include "utility.h"
#include "op.h"
#include "conf.h"
#include "tasks/tasks.h"
namespace builder
{
@@ -865,4 +866,45 @@ void nuget::do_run()
execute_and_join();
}
pip_install::pip_install()
: basic_process_runner("pip install")
{
}
pip_install& pip_install::package(const std::string& s)
{
package_ = s;
return *this;
}
pip_install& pip_install::version(const std::string& s)
{
version_ = s;
return *this;
}
pip_install& pip_install::file(const fs::path& p)
{
file_ = p;
return *this;
}
void pip_install::do_run()
{
process_
.binary(python::python_exe())
.arg("-m", "pip")
.arg("install")
.arg("--no-warn-script-location")
.arg("--disable-pip-version-check");
if (!package_.empty())
process_.arg(package_ + "==" + version_);
else if (!file_.empty())
process_.arg(file_);
execute_and_join();
}
} // namespace
+19
View File
@@ -274,4 +274,23 @@ private:
fs::path sln_;
};
class pip_install : public basic_process_runner
{
public:
pip_install();
pip_install& package(const std::string& s);
pip_install& version(const std::string& s);
pip_install& file(const fs::path& p);
protected:
void do_run() override;
private:
std::string package_;
std::string version_;
fs::path file_;
};
} // namespace