prebuilt python

don't clean prebuilt
This commit is contained in:
isanae
2020-05-07 14:06:37 -04:00
parent 9d84303624
commit ce7c33db77
7 changed files with 71 additions and 9 deletions
+1
View File
@@ -20,6 +20,7 @@ boost = true
lz4 = true
openssl = true
pyqt = true
python = true
[versions]
vs = 16
+2 -1
View File
@@ -47,7 +47,8 @@ static bool_map g_prebuilt =
{"boost", false},
{"lz4", false},
{"openssl", false},
{"pyqt", false}
{"pyqt", false},
{"python", false}
};
static string_map g_versions =
+3
View File
@@ -60,6 +60,9 @@ void boost::do_build_and_install()
void boost::do_clean_for_rebuild()
{
if (prebuilt())
return;
op::delete_directory(cx(), source_path() / "bin.v2", op::optional);
op::delete_directory(cx(), root_lib_path(arch::x86), op::optional);
op::delete_directory(cx(), root_lib_path(arch::x64), op::optional);
+3
View File
@@ -26,6 +26,9 @@ fs::path lz4::source_path()
void lz4::do_clean_for_rebuild()
{
if (prebuilt())
return;
op::delete_directory(cx(), solution_dir() / "bin", op::optional);
}
+3
View File
@@ -36,6 +36,9 @@ fs::path pyqt::build_path()
void pyqt::do_clean_for_rebuild()
{
if (prebuilt())
return;
op::delete_file(cx(), paths::cache() / sip_install_file(), op::optional);
}
+52 -8
View File
@@ -16,7 +16,7 @@ const std::string& python::version()
bool python::prebuilt()
{
return false;
return prebuilt::by_name("python");
}
python::version_info python::parsed_version()
@@ -40,7 +40,7 @@ python::version_info python::parsed_version()
return v;
}
fs::path python::source_path()
std::string python::version_without_v()
{
const auto v = parsed_version();
@@ -49,7 +49,12 @@ fs::path python::source_path()
if (v.patch != "")
s += "." + v.patch;
return paths::build() / ("python-" + s);
return s;
}
fs::path python::source_path()
{
return paths::build() / ("python-" + version_without_v());
}
fs::path python::build_path()
@@ -59,6 +64,9 @@ fs::path python::build_path()
void python::do_clean_for_rebuild()
{
if (prebuilt())
return;
const fs::path pcbuild = source_path() / "PCBuild";
op::delete_directory(cx(), pcbuild / "amd64", op::optional);
@@ -66,6 +74,36 @@ void python::do_clean_for_rebuild()
}
void python::do_fetch()
{
if (prebuilt())
fetch_prebuilt();
else
fetch_from_source();
}
void python::do_build_and_install()
{
if (prebuilt())
build_and_install_prebuilt();
else
build_and_install_from_source();
}
void python::fetch_prebuilt()
{
const auto file = run_tool(downloader(prebuilt_url()));
run_tool(extractor()
.file(file)
.output(source_path()));
}
void python::build_and_install_prebuilt()
{
copy_files();
}
void python::fetch_from_source()
{
run_tool(git_clone()
.url(make_github_url("python", "cpython"))
@@ -75,7 +113,7 @@ void python::do_fetch()
run_tool(devenv_upgrade(solution_file()));
}
void python::do_build_and_install()
void python::build_and_install_from_source()
{
run_tool(msbuild()
.solution(solution_file())
@@ -92,6 +130,11 @@ void python::do_build_and_install()
package();
install_pip();
op::copy_file_to_dir_if_better(cx(),
source_path() / "PC" / "pyconfig.h",
include_path());
copy_files();
}
@@ -123,10 +166,6 @@ void python::package()
void python::copy_files()
{
op::copy_file_to_dir_if_better(cx(),
source_path() / "PC" / "pyconfig.h",
include_path());
op::copy_glob_to_dir_if_better(cx(),
build_path() / "*.lib",
paths::install_libs(),
@@ -185,6 +224,11 @@ fs::path python::site_packages_path()
return source_path() / "Lib" / "site-packages";
}
url python::prebuilt_url()
{
return make_prebuilt_url("python-prebuilt-" + version_without_v() + ".7z");
}
fs::path python::solution_file()
{
return source_path() / "PCBuild" / "pcbuild.sln";
+7
View File
@@ -414,10 +414,17 @@ protected:
void do_clean_for_rebuild() override;
private:
void fetch_prebuilt();
void fetch_from_source();
void build_and_install_prebuilt();
void build_and_install_from_source();
void package();
void install_pip();
void copy_files();
static std::string version_without_v();
static url prebuilt_url();
static fs::path solution_file();
static std::string version_for_dll();
};