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

Python: Honour --strip-extras flag of pip-compile #4439

Merged
merged 1 commit into from
Nov 23, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ def pip_compile_options_from_compiled_file(requirements_file)
options << "--no-header" unless requirements_file.content.include?("autogenerated by pip-c")

options << "--pre" if requirements_file.content.include?("--pre")

options << "--strip-extras" if requirements_file.content.include?("--strip-extras")

options
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,5 +505,21 @@
end
end
end

context "with stripped extras" do
let(:manifest_fixture_name) { "strip_extras.in" }
let(:generated_fixture_name) { "pip_compile_strip_extras.txt" }
let(:dependency_name) { "cachecontrol" }
let(:dependency_version) { "0.12.10" }
let(:dependency_previous_version) { "0.12.9" }

it "doesn't add an extras annotation on cachecontrol" do
expect(updated_files.count).to eq(1)
expect(updated_files.first.content).to include("--strip-extras")
expect(updated_files.first.content).to include("cachecontrol==0.12.10")
expect(updated_files.first.content).
to_not include("cachecontrol[filecache]==")
end
end
end
end
1 change: 1 addition & 0 deletions python/spec/fixtures/pip_compile_files/strip_extras.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cachecontrol[filecache]
22 changes: 22 additions & 0 deletions python/spec/fixtures/requirements/pip_compile_strip_extras.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile --strip-extras --output-file=constraints.txt constraints.in
#
cachecontrol==0.12.10
# via -r constraints.in
certifi==2021.10.8
# via requests
charset-normalizer==2.0.7
# via requests
idna==3.3
# via requests
lockfile==0.12.2
# via cachecontrol
msgpack==1.0.2
# via cachecontrol
requests==2.26.0
# via cachecontrol
urllib3==1.26.7
# via requests