mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
git_clone doesn't assume github anymore
python installs pip added sip
This commit is contained in:
@@ -81,6 +81,8 @@ static std::map<std::string, std::string> g_conf =
|
||||
{"nmm", "0.70.11"},
|
||||
{"spdlog", "v1.4.2"},
|
||||
{"usvfs", "master"},
|
||||
{"qt", "5.14.2"},
|
||||
{"sip", "5.1.2"},
|
||||
|
||||
{"prefix", R"(C:\dev\projects\mobuild-out)"},
|
||||
};
|
||||
@@ -137,6 +139,8 @@ const std::string& versions::lz4() { return get_conf("lz4"); }
|
||||
const std::string& versions::nmm() { return get_conf("nmm"); }
|
||||
const std::string& versions::spdlog() { return get_conf("spdlog"); }
|
||||
const std::string& versions::usvfs() { return get_conf("usvfs"); }
|
||||
const std::string& versions::qt() { return get_conf("qt"); }
|
||||
const std::string& versions::sip() { return get_conf("sip"); }
|
||||
|
||||
fs::path paths::prefix() { return get_conf("prefix"); }
|
||||
fs::path paths::cache() { return prefix() / "downloads"; }
|
||||
|
||||
@@ -54,6 +54,8 @@ struct versions
|
||||
static const std::string& nmm();
|
||||
static const std::string& spdlog();
|
||||
static const std::string& usvfs();
|
||||
static const std::string& qt();
|
||||
static const std::string& sip();
|
||||
};
|
||||
|
||||
struct paths
|
||||
|
||||
@@ -57,6 +57,7 @@ int run(int argc, char** argv)
|
||||
add_task<ncc>();
|
||||
add_task<spdlog>();
|
||||
add_task<usvfs>();
|
||||
add_task<sip>();
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,11 @@ const std::string& url::string() const
|
||||
return s_;
|
||||
}
|
||||
|
||||
bool url::empty() const
|
||||
{
|
||||
return s_.empty();
|
||||
}
|
||||
|
||||
std::string url::filename() const
|
||||
{
|
||||
const auto pos = s_.find_last_of("/");
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
|
||||
const char* c_str() const;
|
||||
const std::string& string() const;
|
||||
bool empty() const;
|
||||
|
||||
std::string filename() const;
|
||||
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ fs::path gtest::source_path()
|
||||
void gtest::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org("google")
|
||||
.repo("googletest")
|
||||
.url(make_github_url("google", "googletest"))
|
||||
.branch(versions::gtest())
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
@@ -17,8 +17,7 @@ fs::path libffi::source_path()
|
||||
void libffi::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org("python")
|
||||
.repo("cpython-bin-deps")
|
||||
.url(make_github_url("python","cpython-bin-deps"))
|
||||
.branch("libffi")
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ fs::path lz4::source_path()
|
||||
void lz4::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org("lz4")
|
||||
.repo("lz4")
|
||||
.url(make_github_url("lz4","lz4"))
|
||||
.branch(versions::lz4())
|
||||
.output(source_path()));
|
||||
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ fs::path ncc::source_path()
|
||||
void ncc::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org(conf::mo_org())
|
||||
.repo("modorganizer-NCC")
|
||||
.url(make_github_url(conf::mo_org(), "modorganizer-NCC"))
|
||||
.branch(conf::mo_branch())
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ fs::path nmm::source_path()
|
||||
void nmm::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org("Nexus-Mods")
|
||||
.repo("Nexus-Mod-Manager")
|
||||
.url(make_github_url("Nexus-Mods", "Nexus-Mod-Manager"))
|
||||
.branch(versions::nmm())
|
||||
.output(source_path()));
|
||||
|
||||
|
||||
+16
-2
@@ -45,8 +45,7 @@ fs::path python::source_path()
|
||||
void python::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org("python")
|
||||
.repo("cpython")
|
||||
.url(make_github_url("python", "cpython"))
|
||||
.branch(versions::python())
|
||||
.output(source_path()));
|
||||
|
||||
@@ -89,6 +88,8 @@ void python::do_build_and_install()
|
||||
op::touch(build_path() / "_mob_packaged");
|
||||
}
|
||||
|
||||
install_pip();
|
||||
|
||||
op::copy_file_to_dir_if_better(
|
||||
source_path() / "PC" / "pyconfig.h",
|
||||
include_path());
|
||||
@@ -110,6 +111,14 @@ void python::do_build_and_install()
|
||||
paths::install_pdbs());
|
||||
}
|
||||
|
||||
void python::install_pip()
|
||||
{
|
||||
debug("installing pip");
|
||||
|
||||
run_tool(process_runner(arch::dont_care, python_exe(), cmd::noflags)
|
||||
.arg("-m", "ensurepip"));
|
||||
}
|
||||
|
||||
fs::path python::build_path()
|
||||
{
|
||||
return source_path() / "PCBuild" / "amd64";
|
||||
@@ -125,6 +134,11 @@ fs::path python::include_path()
|
||||
return source_path() / "Include";
|
||||
}
|
||||
|
||||
fs::path python::scripts_path()
|
||||
{
|
||||
return source_path() / "Scripts";
|
||||
}
|
||||
|
||||
fs::path python::solution_file()
|
||||
{
|
||||
return source_path() / "PCBuild" / "pcbuild.sln";
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "pch.h"
|
||||
#include "tasks.h"
|
||||
|
||||
namespace builder
|
||||
{
|
||||
|
||||
sip::sip()
|
||||
: basic_task("sip")
|
||||
{
|
||||
}
|
||||
|
||||
fs::path sip::source_path()
|
||||
{
|
||||
return paths::build() / ("sip-" + versions::sip());
|
||||
}
|
||||
|
||||
void sip::do_fetch()
|
||||
{
|
||||
const auto download_file =
|
||||
paths::cache() / ("sip-" + versions::sip() + ".tar.gz");
|
||||
|
||||
if (fs::exists(download_file))
|
||||
{
|
||||
debug("sip: " + download_file.string() + " already exists");
|
||||
}
|
||||
else
|
||||
{
|
||||
run_tool(process_runner(arch::dont_care, python::python_exe(), cmd::noflags)
|
||||
.arg("-m", "pip")
|
||||
.arg("download")
|
||||
.arg("--no-binary=:all:")
|
||||
.arg("--no-deps")
|
||||
.arg("-d", paths::cache())
|
||||
.arg("sip==" + versions::sip()));
|
||||
}
|
||||
|
||||
run_tool(decompresser()
|
||||
.file(download_file)
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
void sip::do_build_and_install()
|
||||
{
|
||||
const auto header = source_path() / "sip.h";
|
||||
|
||||
if (fs::exists(header))
|
||||
{
|
||||
debug("sip.h already exists");
|
||||
}
|
||||
else
|
||||
{
|
||||
run_tool(process_runner(arch::dont_care, python::python_exe(), cmd::noflags)
|
||||
.arg("setup.py")
|
||||
.arg("install")
|
||||
.cwd(source_path()));
|
||||
|
||||
const auto sip_module = python::scripts_path() / "sip-module.exe";
|
||||
|
||||
run_tool(process_runner(arch::dont_care, sip_module, cmd::noflags)
|
||||
.arg("--sip-h")
|
||||
.arg("PyQt5.zip")
|
||||
.cwd(source_path()));
|
||||
}
|
||||
|
||||
op::copy_file_to_dir_if_better(
|
||||
source_path() / "sip.h",
|
||||
python::include_path());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -17,8 +17,7 @@ fs::path spdlog::source_path()
|
||||
void spdlog::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org("gabime")
|
||||
.repo("spdlog")
|
||||
.url(make_github_url("gabime", "spdlog"))
|
||||
.branch(versions::spdlog())
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
@@ -220,17 +220,33 @@ public:
|
||||
static fs::path build_path();
|
||||
static fs::path python_exe();
|
||||
static fs::path include_path();
|
||||
static fs::path scripts_path();
|
||||
|
||||
protected:
|
||||
void do_fetch() override;
|
||||
void do_build_and_install() override;
|
||||
|
||||
private:
|
||||
void install_pip();
|
||||
|
||||
static fs::path solution_file();
|
||||
static std::string version_for_dll();
|
||||
};
|
||||
|
||||
|
||||
class sip : public basic_task<sip>
|
||||
{
|
||||
public:
|
||||
sip();
|
||||
|
||||
static fs::path source_path();
|
||||
|
||||
protected:
|
||||
void do_fetch() override;
|
||||
void do_build_and_install() override;
|
||||
};
|
||||
|
||||
|
||||
class sevenz : public basic_task<sevenz>
|
||||
{
|
||||
public:
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ fs::path usvfs::source_path()
|
||||
void usvfs::do_fetch()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.org(conf::mo_org())
|
||||
.repo("usvfs")
|
||||
.url(make_github_url(conf::mo_org(), "usvfs"))
|
||||
.branch(versions::usvfs())
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
+11
-16
@@ -179,20 +179,20 @@ fs::path downloader::path_for_url(const builder::url& u) const
|
||||
}
|
||||
|
||||
|
||||
url make_github_url(const std::string& org, const std::string& repo)
|
||||
{
|
||||
return "https://github.com/" + org + "/" + repo + ".git";
|
||||
}
|
||||
|
||||
|
||||
git_clone::git_clone()
|
||||
: basic_process_runner("git_clone")
|
||||
{
|
||||
}
|
||||
|
||||
git_clone& git_clone::org(const std::string& name)
|
||||
git_clone& git_clone::url(const builder::url& u)
|
||||
{
|
||||
org_ = name;
|
||||
return *this;
|
||||
}
|
||||
|
||||
git_clone& git_clone::repo(const std::string& name)
|
||||
{
|
||||
repo_ = name;
|
||||
url_ = u;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ git_clone& git_clone::output(const fs::path& dir)
|
||||
|
||||
void git_clone::do_run()
|
||||
{
|
||||
if (org_.empty() || repo_.empty() || where_.empty())
|
||||
if (url_.empty() || where_.empty())
|
||||
bail_out("git_clone missing parameters");
|
||||
|
||||
const fs::path dot_git = where_ / ".git";
|
||||
@@ -230,7 +230,7 @@ void git_clone::clone()
|
||||
.arg("--branch", branch_)
|
||||
.arg("--quiet", cmd::quiet)
|
||||
.arg("-c", "advice.detachedHead=false", cmd::quiet)
|
||||
.arg(repo_url())
|
||||
.arg(url_)
|
||||
.arg(where_));
|
||||
}
|
||||
|
||||
@@ -240,16 +240,11 @@ void git_clone::pull()
|
||||
.arg("pull")
|
||||
.arg("--recurse-submodules")
|
||||
.arg("--quiet", cmd::quiet)
|
||||
.arg(repo_url())
|
||||
.arg(url_)
|
||||
.arg(branch_)
|
||||
.cwd(where_));
|
||||
}
|
||||
|
||||
url git_clone::repo_url() const
|
||||
{
|
||||
return "https://github.com/" + org_ + "/" + repo_ + ".git";
|
||||
}
|
||||
|
||||
|
||||
decompresser::decompresser()
|
||||
: basic_process_runner("decompresser")
|
||||
|
||||
+5
-5
@@ -132,13 +132,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
url make_github_url(const std::string& org, const std::string& repo);
|
||||
|
||||
|
||||
class git_clone : public basic_process_runner
|
||||
{
|
||||
public:
|
||||
git_clone();
|
||||
|
||||
git_clone& org(const std::string& name);
|
||||
git_clone& repo(const std::string& name);
|
||||
git_clone& url(const builder::url& u);
|
||||
git_clone& branch(const std::string& name);
|
||||
git_clone& output(const fs::path& dir);
|
||||
|
||||
@@ -146,14 +148,12 @@ protected:
|
||||
void do_run() override;
|
||||
|
||||
private:
|
||||
std::string org_;
|
||||
std::string repo_;
|
||||
builder::url url_;
|
||||
std::string branch_;
|
||||
fs::path where_;
|
||||
|
||||
void clone();
|
||||
void pull();
|
||||
url repo_url() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
<ClCompile Include="..\src\tasks\openssl.cpp" />
|
||||
<ClCompile Include="..\src\tasks\python.cpp" />
|
||||
<ClCompile Include="..\src\tasks\sevenz.cpp" />
|
||||
<ClCompile Include="..\src\tasks\sip.cpp" />
|
||||
<ClCompile Include="..\src\tasks\spdlog.cpp" />
|
||||
<ClCompile Include="..\src\tasks\task.cpp" />
|
||||
<ClCompile Include="..\src\tasks\usvfs.cpp" />
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
<ClCompile Include="..\src\tasks\usvfs.cpp">
|
||||
<Filter>src\tasks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\tasks\sip.cpp">
|
||||
<Filter>src\tasks</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pch.h">
|
||||
|
||||
Reference in New Issue
Block a user