Do not replace manually installed sip when installing PyQt-builder.

This commit is contained in:
Mikaël Capelle
2024-06-12 22:20:01 +02:00
parent cad0eca997
commit 524a1fb46a
3 changed files with 44 additions and 4 deletions
+18 -1
View File
@@ -171,7 +171,24 @@ namespace mob::tasks {
void pyqt::build_and_install_from_source()
{
// use pip to install the pyqt builder
run_tool(pip(pip::install).package("PyQt-builder").version(builder_version()));
if (python::build_type() == config::debug) {
// PyQt-builder has sip as a dependency, so installing it directly will
// replace the sip we have installed manually, but the installed sip will
// not work (see comment in sip::build() for details)
//
// the workaround is to install the dependencies manually (only packaging),
// and then use a --no-dependencies install with pip
//
run_tool(pip(pip::install).package("packaging"));
run_tool(pip(pip::install)
.package("PyQt-builder")
.no_dependencies()
.version(builder_version()));
}
else {
run_tool(
pip(pip::install).package("PyQt-builder").version(builder_version()));
}
// patch for builder.py
run_tool(patcher()
+19 -3
View File
@@ -49,7 +49,7 @@ namespace mob {
execute_and_join(p);
}
pip::pip(ops op) : basic_process_runner("pip"), op_(op) {}
pip::pip(ops op) : basic_process_runner("pip"), op_(op), no_deps_{false} {}
pip& pip::package(const std::string& s)
{
@@ -69,6 +69,12 @@ namespace mob {
return *this;
}
pip& pip::no_dependencies()
{
no_deps_ = true;
return *this;
}
void pip::do_run()
{
switch (op_) {
@@ -141,11 +147,21 @@ namespace mob {
.arg("--no-warn-script-location")
.arg("--disable-pip-version-check");
if (!package_.empty())
p.arg(package_ + "==" + version_);
if (!package_.empty()) {
if (version_.empty()) {
p.arg(package_);
}
else {
p.arg(package_ + "==" + version_);
}
}
else if (!file_.empty())
p.arg(file_);
if (no_deps_) {
p.arg("--no-dependencies");
}
p.env(this_env::get().set("PYTHONUTF8", "1"));
execute_and_join(p);
+7
View File
@@ -703,6 +703,10 @@ namespace mob {
pip& version(const std::string& s);
pip& file(const fs::path& p);
// do not install dependencies for the package
//
pip& no_dependencies();
protected:
// runs pip
//
@@ -717,6 +721,9 @@ namespace mob {
std::string version_;
fs::path file_;
// no depndencies
bool no_deps_;
// runs `-m ensurepip`, then upgrades pip
//
void do_ensure();