From b7d716651b9a09d371e8bcb9a823fb700b173a42 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Mon, 20 May 2024 03:24:24 -0500 Subject: [PATCH] Upgrade to Python 3.12 - Should manage most external dependencies for python --- mob.ini | 8 +++---- src/main.cpp | 1 - src/tasks/libffi.cpp | 51 -------------------------------------------- src/tasks/python.cpp | 15 ++++++++++--- src/tasks/tasks.h | 19 +---------------- 5 files changed, 17 insertions(+), 77 deletions(-) delete mode 100644 src/tasks/libffi.cpp diff --git a/mob.ini b/mob.ini index 4d35a51..ed16050 100644 --- a/mob.ini +++ b/mob.ini @@ -24,8 +24,8 @@ plugins = check_fnis bsapacker bsa_extractor diagnose_basic installer_* plugin_p [task] enabled = true mo_org = ModOrganizer2 -mo_branch = master -mo_fallback = +mo_branch = dev/deps-upgrade-20240518 +mo_fallback = master no_pull = false ignore_ts = false revert_ts = false @@ -87,7 +87,7 @@ pull = true boost = true lz4 = true openssl = true -pyqt = true +pyqt = false python = true usvfs = false @@ -108,7 +108,7 @@ openssl = 3.3.0 pyqt = 6.7.0 pyqt_builder = 1.16.2 pyqt_sip = 13.7.0 -python = v3.11.9 +python = v3.12.3 pybind11 = v2.12.0 bzip2 = 1.0.8 sip = 6.8.3 diff --git a/src/main.cpp b/src/main.cpp index a260975..e75d7c5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,6 @@ namespace mob { .add_task() .add_task() .add_task() - .add_task() .add_task(); add_task() diff --git a/src/tasks/libffi.cpp b/src/tasks/libffi.cpp deleted file mode 100644 index ba8529a..0000000 --- a/src/tasks/libffi.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "pch.h" -#include "tasks.h" - -namespace mob::tasks { - - // required by python - - libffi::libffi() : basic_task("libffi") {} - - std::string libffi::version() - { - return {}; - } - - bool libffi::prebuilt() - { - // actually always prebuilt - return false; - } - - fs::path libffi::source_path() - { - return conf().path().build() / "libffi"; - } - - void libffi::do_clean(clean c) - { - // delete the whole thing - if (is_set(c, clean::reclone)) - git_wrap::delete_directory(cx(), source_path()); - } - - void libffi::do_fetch() - { - run_tool(make_git() - .url(make_git_url("python", "cpython-bin-deps")) - .branch("libffi-3.4.4") - .root(source_path())); - } - - fs::path libffi::include_path() - { - return libffi::source_path() / "amd64" / "include"; - } - - fs::path libffi::lib_path() - { - return libffi::source_path() / "amd64"; - } - -} // namespace mob::tasks diff --git a/src/tasks/python.cpp b/src/tasks/python.cpp index d2ca6a8..2428a21 100644 --- a/src/tasks/python.cpp +++ b/src/tasks/python.cpp @@ -156,6 +156,9 @@ namespace mob::tasks { void python::build_and_install_from_source() { + // download externals + prepare_dependencies(); + // build run_tool(create_msbuild_tool()); @@ -172,6 +175,14 @@ namespace mob::tasks { copy_files(); } + void python::prepare_dependencies() + { + const auto bat = source_path() / "PCBuild" / "get_externals.bat"; + run_tool(process_runner(process() + .binary(bat) + .cwd(source_path()))); + } + void python::package() { if (fs::exists(python_core_zip_file())) { @@ -224,9 +235,7 @@ namespace mob::tasks { {"bz2Dir=" + path_to_utf8(bzip2::source_path()), "zlibDir=" + path_to_utf8(zlib::source_path()), "opensslIncludeDir=" + path_to_utf8(openssl::include_path()), - "opensslOutDir=" + path_to_utf8(openssl::source_path()), - "libffiIncludeDir=" + path_to_utf8(libffi::include_path()), - "libffiOutDir=" + path_to_utf8(libffi::lib_path())})); + "opensslOutDir=" + path_to_utf8(openssl::source_path())})); } fs::path python::python_exe() diff --git a/src/tasks/tasks.h b/src/tasks/tasks.h index bc24139..55a12f3 100644 --- a/src/tasks/tasks.h +++ b/src/tasks/tasks.h @@ -146,24 +146,6 @@ namespace mob::tasks { void do_build_and_install() override; }; - // needed by python - // - class libffi : public basic_task { - public: - libffi(); - - static std::string version(); - static bool prebuilt(); - - static fs::path source_path(); - static fs::path include_path(); - static fs::path lib_path(); - - protected: - void do_clean(clean c) override; - void do_fetch() override; - }; - class libloot : public basic_task { public: libloot(); @@ -462,6 +444,7 @@ namespace mob::tasks { void build_and_install_prebuilt(); void build_and_install_from_source(); + void prepare_dependencies(); void package(); void install_pip(); void copy_files();