Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

language/python: link manpages by default #18715

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/language/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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

Expand Down
20 changes: 10 additions & 10 deletions Library/Homebrew/test/language/python/virtualenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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: "[email protected]")
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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading