Skip to content

Commit

Permalink
Merge pull request #2519 from lfdebrux/lfdebrux/fix-python-path-depen…
Browse files Browse the repository at this point in the history
…dencies-with-file

Fix python path dependencies with file
  • Loading branch information
jurre committed Sep 10, 2020
2 parents c18b60b + aaacc97 commit 8991327
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions common/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
config.hook_into :webmock
config.configure_rspec_metadata!

unless ENV["DEPENDABOT_TEST_DEBUG_LOGGER"].nil?
config.debug_logger = File.open(ENV["DEPENDABOT_TEST_DEBUG_LOGGER"], "w")
end

# Prevent access tokens being written to VCR cassettes
unless ENV["DEPENDABOT_TEST_ACCESS_TOKEN"].nil?
config.filter_sensitive_data("<TOKEN>") do
Expand Down
4 changes: 2 additions & 2 deletions python/lib/dependabot/python/file_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,14 @@ def requirement_in_path_setup_file_paths
def parse_path_setup_paths(req_file)
uneditable_reqs =
req_file.content.
scan(/^['"]?(?<path>\..*?)(?=\[|#|'|"|$)/).
scan(/^['"]?(?:file:)?(?<path>\..*?)(?=\[|#|'|"|$)/).
flatten.
map(&:strip).
reject { |p| p.include?("://") }

editable_reqs =
req_file.content.
scan(/^(?:-e)\s+['"]?(?<path>.*?)(?=\[|#|'|"|$)/).
scan(/^(?:-e)\s+['"]?(?:file:)?(?<path>.*?)(?=\[|#|'|"|$)/).
flatten.
map(&:strip).
reject { |p| p.include?("://") || p.include?("git@") }
Expand Down
3 changes: 3 additions & 0 deletions python/spec/dependabot/python/file_fetcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,9 @@
body: fixture("github", "setup_content.json"),
headers: { "content-type" => "application/json" }
)
stub_request(:get, url + "file:./setup.py?ref=sha").
with(headers: { "Authorization" => "token token" }).
to_return(status: 404)
end

it "fetches the path dependencies" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"git_url": "https://api.github.com/repos/gocardless/bump/git/blobs/8d9a77a86256c11409622fd16d799d9718f1ff62",
"download_url": "https://raw.githubusercontent.com/gocardless/bump/master/requirements.txt?token=ABMwe8vXxd4DBCEsxz3jMusk5sr_fFsoks5WJWE-wA%3D%3D",
"type": "file",
"content": "LWUgLgotZSAiLi9teSIKLWUgJy4vbXktc2luZ2xlJwoKLi9teS1vdGhlcgou\nL3NvbWUvemlwLWZpbGUudGFyLmd6Cg==\n",
"content": "LWUgLgotZSAiLi9teSIKLWUgJy4vbXktc2luZ2xlJwoKLi9teS1vdGhlcgouL3NvbWUvemlwLWZpbGUudGFyLmd6CgpmaWxlOi4KLWUgZmlsZTouCg==\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/gocardless/bump/contents/requirements.txt?ref=master",
Expand Down

0 comments on commit 8991327

Please sign in to comment.