Skip to content

Commit

Permalink
no-need-for-git-creds-here-either
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwidman committed Jul 22, 2023
1 parent 4229194 commit ecae2b2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 49 deletions.
41 changes: 14 additions & 27 deletions python/lib/dependabot/python/file_updater/pipfile_file_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,27 +195,25 @@ def add_private_sources(pipfile_content)
def updated_generated_files
@updated_generated_files ||=
SharedHelpers.in_a_temporary_directory do
SharedHelpers.with_git_configured(credentials: credentials) do
write_temporary_dependency_files(prepared_pipfile_content)
install_required_python
write_temporary_dependency_files(prepared_pipfile_content)
language_version_manager.install_required_python

run_pipenv_command(
"pyenv exec pipenv lock"
)
run_pipenv_command(
"pyenv exec pipenv lock"
)

result = { lockfile: File.read("Pipfile.lock") }
result[:lockfile] = post_process_lockfile(result[:lockfile])
result = { lockfile: File.read("Pipfile.lock") }
result[:lockfile] = post_process_lockfile(result[:lockfile])

# Generate updated requirement.txt entries, if needed.
if generate_updated_requirements_files?
generate_updated_requirements_files
# Generate updated requirement.txt entries, if needed.
if generate_updated_requirements_files?
generate_updated_requirements_files

result[:requirements_txt] = File.read("req.txt")
result[:dev_requirements_txt] = File.read("dev-req.txt")
end

result
result[:requirements_txt] = File.read("req.txt")
result[:dev_requirements_txt] = File.read("dev-req.txt")
end

result
end
end

Expand Down Expand Up @@ -298,17 +296,6 @@ def write_temporary_dependency_files(pipfile_content)
File.write("Pipfile", pipfile_content)
end

def install_required_python
# # Initialize a git repo to appease pip-tools
# begin
# run_command("git init") if setup_files.any?
# rescue Dependabot::SharedHelpers::HelperSubprocessFailed
# nil
# end

language_version_manager.install_required_python
end

def sanitized_setup_file_content(file)
@sanitized_setup_file_content ||= {}
return @sanitized_setup_file_content[file.name] if @sanitized_setup_file_content[file.name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,18 @@ def fetch_latest_resolvable_version_string(requirement:)

@latest_resolvable_version_string[requirement] ||=
SharedHelpers.in_a_temporary_directory do
SharedHelpers.with_git_configured(credentials: credentials) do
write_temporary_dependency_files(updated_req: requirement)
install_required_python
write_temporary_dependency_files(updated_req: requirement)
language_version_manager.install_required_python

# Shell out to Pipenv, which handles everything for us.
# Whilst calling `lock` avoids doing an install as part of the
# pipenv flow, an install is still done by pip-tools in order
# to resolve the dependencies. That means this is slow.
run_pipenv_command("pyenv exec pipenv lock")
# Shell out to Pipenv, which handles everything for us.
# Whilst calling `lock` avoids doing an install as part of the
# pipenv flow, an install is still done by pip-tools in order
# to resolve the dependencies. That means this is slow.
run_pipenv_command("pyenv exec pipenv lock")

updated_lockfile = JSON.parse(File.read("Pipfile.lock"))
updated_lockfile = JSON.parse(File.read("Pipfile.lock"))

fetch_version_from_parsed_lockfile(updated_lockfile)
end
fetch_version_from_parsed_lockfile(updated_lockfile)
rescue SharedHelpers::HelperSubprocessFailed => e
handle_pipenv_errors(e)
end
Expand Down Expand Up @@ -314,17 +312,6 @@ def write_temporary_dependency_files(updated_req: nil,
)
end

def install_required_python
# # Initialize a git repo to appease pip-tools
# begin
# run_command("git init") if setup_files.any?
# rescue Dependabot::SharedHelpers::HelperSubprocessFailed
# nil
# end

language_version_manager.install_required_python
end

def sanitized_setup_file_content(file)
@sanitized_setup_file_content ||= {}
@sanitized_setup_file_content[file.name] ||=
Expand Down

0 comments on commit ecae2b2

Please sign in to comment.