From c2d3f126ede597ae30dd406c6a02edd08fa95b0c Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Tue, 5 Nov 2024 11:03:09 -0500 Subject: [PATCH] language/python: link manpages by default --- Library/Homebrew/language/python.rb | 4 ++-- .../test/language/python/virtualenv_spec.rb | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index e0244f4d1ff1e..58ba40490152b 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -240,7 +240,7 @@ def needs_python?(python) ).returns(Virtualenv) } def virtualenv_install_with_resources(using: nil, system_site_packages: true, without_pip: true, - link_manpages: false, without: nil, start_with: nil, end_with: nil) + link_manpages: true, without: nil, start_with: nil, end_with: nil) python = using if python.nil? wanted = python_names.select { |py| needs_python?(py) } @@ -415,7 +415,7 @@ def pip_install(targets, build_isolation: true) build_isolation: T::Boolean, ).void } - def pip_install_and_link(targets, link_manpages: false, build_isolation: true) + def pip_install_and_link(targets, link_manpages: true, build_isolation: true) bin_before = Dir[@venv_root/"bin/*"].to_set man_before = Dir[@venv_root/"share/man/man*/*"].to_set if link_manpages diff --git a/Library/Homebrew/test/language/python/virtualenv_spec.rb b/Library/Homebrew/test/language/python/virtualenv_spec.rb index 27a9934f9fef3..f425bcf40b565 100644 --- a/Library/Homebrew/test/language/python/virtualenv_spec.rb +++ b/Library/Homebrew/test/language/python/virtualenv_spec.rb @@ -49,7 +49,7 @@ f.libexec, "python", { system_site_packages: true, without_pip: true } ).and_return(venv) expect(venv).to receive(:pip_install).with([r_a, r_b, r_c, r_d]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python") end @@ -58,21 +58,21 @@ f.libexec, "python3.12", { system_site_packages: true, without_pip: true } ).and_return(venv) expect(venv).to receive(:pip_install).with([r_a, r_b, r_c, r_d]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python@3.12") end it "skips a `without` resource string and installs remaining resources in order" do expect(f).to receive(:virtualenv_create).and_return(venv) expect(venv).to receive(:pip_install).with([r_a, r_b, r_d]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python", without: r_c.name) end it "skips all resources in `without` array and installs remaining resources in order" do expect(f).to receive(:virtualenv_create).and_return(venv) expect(venv).to receive(:pip_install).with([r_b, r_c]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python", without: [r_d.name, r_a.name]) end @@ -91,14 +91,14 @@ it "installs a `start_with` resource string and then remaining resources in order" do expect(f).to receive(:virtualenv_create).and_return(venv) expect(venv).to receive(:pip_install).with([r_c, r_a, r_b, r_d]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python", start_with: r_c.name) end it "installs all resources in `start_with` array and then remaining resources in order" do expect(f).to receive(:virtualenv_create).and_return(venv) expect(venv).to receive(:pip_install).with([r_d, r_b, r_a, r_c]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python", start_with: [r_d.name, r_b.name]) end @@ -117,14 +117,14 @@ it "installs an `end_with` resource string as last resource" do expect(f).to receive(:virtualenv_create).and_return(venv) expect(venv).to receive(:pip_install).with([r_a, r_c, r_d, r_b]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python", end_with: r_b.name) end it "installs all resources in `end_with` array after other resources are installed" do expect(f).to receive(:virtualenv_create).and_return(venv) expect(venv).to receive(:pip_install).with([r_a, r_d, r_c, r_b]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python", end_with: [r_c.name, r_b.name]) end @@ -143,7 +143,7 @@ it "installs resources in correct order when combining `without`, `start_with` and `end_with" do expect(f).to receive(:virtualenv_create).and_return(venv) expect(venv).to receive(:pip_install).with([r_d, r_c, r_b]) - expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: false }) + expect(venv).to receive(:pip_install_and_link).with(buildpath, { link_manpages: true }) f.virtualenv_install_with_resources(using: "python", without: r_a.name, start_with: r_d.name, end_with: r_b.name) end @@ -254,7 +254,7 @@ expect(virtualenv).to receive(:pip_install).with("foo", { build_isolation: true }) expect(Dir).to receive(:[]).with(src_bin/"*").twice.and_return(bin_before, bin_after) - virtualenv.pip_install_and_link "foo" + virtualenv.pip_install_and_link("foo", link_manpages: false) expect(src_bin/"kilroy").to exist expect(dest_bin/"kilroy").to exist