summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-misc/anki/files/23.12.1/pseudo-venv.patch')
-rw-r--r--app-misc/anki/files/23.12.1/pseudo-venv.patch127
1 files changed, 0 insertions, 127 deletions
diff --git a/app-misc/anki/files/23.12.1/pseudo-venv.patch b/app-misc/anki/files/23.12.1/pseudo-venv.patch
deleted file mode 100644
index 8c173021a5b7..000000000000
--- a/app-misc/anki/files/23.12.1/pseudo-venv.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-This is an adapted patch from the games/anki FreeBSD port.
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_configure_src_python.rs
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_ninja__gen_src_python.rs
-
-Use the "PythonEnvironmentStub" function to use a native Python environment
-instead of a Python venv.
-* Avoid the use of Python's pip (network access).
-* Remove the python_binary input for PythonEnvironmentStub since we create the
- pseudo venv manually in the ebuild. This saves us from setting an extra
- environment variable to prevent network access.
-
- The python_binary input should really only be added to PythonEnvironment, if
- the venv is not set up.
-* TODO: add dev-python/mypy-protobuf to tree for fully typed Anki.
-
-From: Lucio Sauer <watermanpaint@posteo.net>
---- a/build/configure/src/python.rs
-+++ b/build/configure/src/python.rs
-@@ -13,6 +13,7 @@ use ninja_gen::input::BuildInput;
- use ninja_gen::inputs;
- use ninja_gen::python::python_format;
- use ninja_gen::python::PythonEnvironment;
-+use ninja_gen::python::PythonEnvironmentStub;
- use ninja_gen::python::PythonLint;
- use ninja_gen::python::PythonTypecheck;
- use ninja_gen::rsync::RsyncFiles;
-@@ -81,6 +82,25 @@ pub fn setup_venv(build: &mut Build) -> Result<()> {
- Ok(())
- }
-
-+pub fn setup_venv_stub(build: &mut Build) -> Result<()> {
-+ build.add_action(
-+ "pyenv",
-+ PythonEnvironmentStub {
-+ folder: "pyenv",
-+ extra_binary_exports: &[
-+ "mypy", // Required in some parts of the code, but not for build
-+ "black", // dito
-+ "isort", // dito
-+ "pylint", // dito
-+ "pytest", // dito
-+ "protoc-gen-mypy",
-+ ],
-+ },
-+ )?;
-+
-+ Ok(())
-+}
-+
- pub struct GenPythonProto {
- pub proto_files: BuildInput,
- }
-@@ -88,9 +108,7 @@ pub struct GenPythonProto {
- impl BuildAction for GenPythonProto {
- fn command(&self) -> &str {
- "$protoc $
-- --plugin=protoc-gen-mypy=$protoc-gen-mypy $
- --python_out=$builddir/pylib $
-- --mypy_out=$builddir/pylib $
- -Iproto $in"
- }
-
-@@ -108,7 +126,6 @@ impl BuildAction for GenPythonProto {
- .collect();
- build.add_inputs("in", &self.proto_files);
- build.add_inputs("protoc", inputs![":protoc_binary"]);
-- build.add_inputs("protoc-gen-mypy", inputs![":pyenv:protoc-gen-mypy"]);
- build.add_outputs("", python_outputs);
- }
-
-@@ -254,7 +271,6 @@ impl BuildAction for Sphinx {
-
- fn files(&mut self, build: &mut impl FilesHandle) {
- build.add_inputs("python", inputs![":pyenv:bin"]);
-- build.add_inputs("pip", inputs![":pyenv:pip"]);
- build.add_inputs("", &self.deps);
- build.add_output_stamp("python/sphinx/stamp");
- }
---- a/build/ninja_gen/src/python.rs
-+++ b/build/ninja_gen/src/python.rs
-@@ -86,6 +86,11 @@ pub struct PythonEnvironment {
- pub extra_binary_exports: &'static [&'static str],
- }
-
-+pub struct PythonEnvironmentStub {
-+ pub folder: &'static str,
-+ pub extra_binary_exports: &'static [&'static str],
-+}
-+
- impl BuildAction for PythonEnvironment {
- fn command(&self) -> &str {
- "$runner pyenv $python_binary $builddir/$pyenv_folder $system_pkgs $base_requirements $requirements"
-@@ -118,6 +123,34 @@ impl BuildAction for PythonEnvironment {
- }
- }
-
-+impl BuildAction for PythonEnvironmentStub {
-+ fn command(&self) -> &str {
-+ "echo Running PythonEnvironmentStub..."
-+ }
-+
-+ fn files(&mut self, build: &mut impl crate::build::FilesHandle) {
-+ let bin_path = |binary: &str| -> Vec<String> {
-+ let folder = self.folder;
-+ let path = if cfg!(windows) {
-+ format!("{folder}/scripts/{binary}.exe")
-+ } else {
-+ format!("{folder}/bin/{binary}")
-+ };
-+ vec![path]
-+ };
-+
-+ build.add_variable("pyenv_folder", self.folder);
-+ build.add_outputs_ext("bin", bin_path("python"), true);
-+ for binary in self.extra_binary_exports {
-+ build.add_outputs_ext(*binary, bin_path(binary), true);
-+ }
-+ }
-+
-+ fn check_output_timestamps(&self) -> bool {
-+ true
-+ }
-+}
-+
- pub struct PythonTypecheck {
- pub folders: &'static [&'static str],
- pub deps: BuildInput,