Skip to content

Commit

Permalink
Better support for dev PyQt builds
Browse files Browse the repository at this point in the history
- Add alternate index support to pip
- Utilize dev pypi index for PyQt
- Use Qt 5.7.1 for testing
  • Loading branch information
Silarn committed Jul 11, 2024
1 parent 9f1b33f commit 47804b6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 21 deletions.
12 changes: 6 additions & 6 deletions mob.ini
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pull = true
boost = true
lz4 = true
openssl = true
pyqt = true
pyqt = false
python = true

[versions]
Expand All @@ -106,15 +106,15 @@ libloot = 0.23.0
lz4 = v1.9.4
nmm = 0.71.2
openssl = 3.3.0
pyqt = 6.7.0
pyqt_builder = 1.16.2
pyqt_sip = 13.7.0
pyqt = 6.7.1.dev2407071716
pyqt_builder = 1.16.4.dev2+g2802761
pyqt_sip = 13.8.0
python = v3.12.3
pybind11 = v2.12.0
bzip2 = 1.0.8
sip = 6.8.3
sip = 6.8.6.dev4+gf624736c
spdlog = v1.14.1
qt = 6.7.0
qt = 6.7.1
qt_vs = 2019
zlib = v1.3.1
libbsarch = 0.0.12
Expand Down
4 changes: 3 additions & 1 deletion src/tasks/pyqt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ namespace mob::tasks {
void pyqt::build_and_install_from_source()
{
// use pip to install the pyqt builder
if (python::build_type() == config::debug) {
if (python::build_type() == config::debug ||
builder_version().find("dev") != std::string::npos) {
// 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)
Expand All @@ -184,6 +185,7 @@ namespace mob::tasks {
run_tool(pip(pip::install).package("packaging"));
run_tool(pip(pip::install)
.package("PyQt-builder")
.index("https://www.riverbankcomputing.com/pypi/simple")
.no_dependencies()
.version(builder_version()));
}
Expand Down
5 changes: 4 additions & 1 deletion src/tasks/sip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ namespace mob::tasks {
}
else {
// download
run_tool(pip(pip::download).package("sip").version(version()));
run_tool(pip(pip::download)
.package("sip")
.index("https://www.riverbankcomputing.com/pypi/simple")
.version(version()));
}

// extract
Expand Down
43 changes: 30 additions & 13 deletions src/tools/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ namespace mob {
return *this;
}

pip& pip::index(const std::string& s)
{
index_ = s;
return *this;
}

pip& pip::no_dependencies()
{
no_deps_ = true;
Expand Down Expand Up @@ -147,6 +153,10 @@ namespace mob {
.arg("--no-warn-script-location")
.arg("--disable-pip-version-check");

if (!index_.empty()) {
p.arg("-i", index_).arg("--extra-index-url", "https://pypi.org/simple")
}

if (!package_.empty()) {
if (version_.empty()) {
p.arg(package_);
Expand All @@ -169,19 +179,26 @@ namespace mob {

void pip::do_download()
{
execute_and_join(process()
.binary(tasks::python::python_exe())
.chcp(65001)
.stdout_encoding(encodings::utf8)
.stderr_encoding(encodings::utf8)
.arg("-X", "utf8")
.arg("-m", "pip")
.arg("download")
.arg("--no-binary=:all:")
.arg("--no-deps")
.arg("-d", conf().path().cache())
.arg(package_ + "==" + version_)
.env(this_env::get().set("PYTHONUTF8", "1")));
auto p = process()
.binary(tasks::python::python_exe())
.chcp(65001)
.stdout_encoding(encodings::utf8)
.stderr_encoding(encodings::utf8)
.arg("-X", "utf8")
.arg("-m", "pip")
.arg("download");

if (!index_.empty()) {
p.arg("-i", index_).arg("--extra-index-url", "https://pypi.org/simple")
}

p.arg("--no-binary=:all:")
.arg("--no-deps")
.arg("-d", conf().path().cache())
.arg(package_ + "==" + version_)
.env(this_env::get().set("PYTHONUTF8", "1"));

execute_and_join(p);
}

} // namespace mob
2 changes: 2 additions & 0 deletions src/tools/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ namespace mob {
pip& package(const std::string& s);
pip& version(const std::string& s);
pip& file(const fs::path& p);
pip& index(const std::string& s);

// do not install dependencies for the package
//
Expand All @@ -720,6 +721,7 @@ namespace mob {
std::string package_;
std::string version_;
fs::path file_;
std::string index_;

// no depndencies
bool no_deps_;
Expand Down

0 comments on commit 47804b6

Please sign in to comment.