Skip to content

Commit

Permalink
Use python3/pip3 so we don't have to have python/pip symlinks
Browse files Browse the repository at this point in the history
To reduce ambiguity, by default the compiled output from python 3
results in the commands `python3` / `pip3`. Often wrapper tooling will
create additional symlinks of `python`/`pip` pointing at these, but they
aren't the out-of-the-box default when compiling Python straight from
source.

In our case, `pyenv` _does_ add these symlinks. However, if we move away
from using `pyenv install` to another method (:wink:), then life will be simpler
if we directly call `python3` / `pip3` because we won't need to create
symlinks.
  • Loading branch information
jeffwidman committed Aug 30, 2023
1 parent 648ddc4 commit 90e20e1
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion python/helpers/build
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ cp -r \
"$install_dir"

cd "$install_dir"
PYENV_VERSION=$1 pyenv exec pip --disable-pip-version-check install --use-pep517 -r "requirements.txt"
PYENV_VERSION=$1 pyenv exec pip3 --disable-pip-version-check install --use-pep517 -r "requirements.txt"
2 changes: 1 addition & 1 deletion python/lib/dependabot/python/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def parsed_requirement_files
write_temporary_dependency_files

requirements = SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{NativeHelpers.python_helper_path}",
command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
function: "parse_requirements",
args: [Dir.pwd]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def parsed_pep621_dependencies
write_temporary_pyproject

SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{NativeHelpers.python_helper_path}",
command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
function: "parse_pep621_dependencies",
args: [pyproject.name]
)
Expand Down
4 changes: 2 additions & 2 deletions python/lib/dependabot/python/file_parser/setup_file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def parsed_setup_file
write_temporary_dependency_files

requirements = SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{NativeHelpers.python_helper_path}",
command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
function: "parse_setup",
args: [Dir.pwd]
)
Expand All @@ -81,7 +81,7 @@ def parsed_sanitized_setup_file
write_sanitized_setup_file

requirements = SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{NativeHelpers.python_helper_path}",
command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
function: "parse_setup",
args: [Dir.pwd]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def deps_to_augment_hashes_for(updated_content, original_content)

def package_hashes_for(name:, version:, algorithm:)
SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{NativeHelpers.python_helper_path}",
command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
function: "get_dependency_hash",
args: [name, version, algorithm]
).map { |h| "--hash=#{algorithm}:#{h['hash']}" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def pipfile_hash_for(pipfile_content)
SharedHelpers.in_a_temporary_directory do |dir|
File.write(File.join(dir, "Pipfile"), pipfile_content)
SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{NativeHelpers.python_helper_path}",
command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
function: "get_pipfile_hash",
args: [dir]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def pyproject_hash_for(pyproject_content)
write_temporary_dependency_files(pyproject_content)

SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{python_helper_path}",
command: "pyenv exec python3 #{python_helper_path}",
function: "get_pyproject_hash",
args: [dir]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def hash_separator(requirement)

def package_hashes_for(name:, version:, algorithm:)
SharedHelpers.run_helper_subprocess(
command: "pyenv exec python #{NativeHelpers.python_helper_path}",
command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
function: "get_dependency_hash",
args: [name, version, algorithm]
).map { |h| "--hash=#{algorithm}:#{h['hash']}" }
Expand Down

0 comments on commit 90e20e1

Please sign in to comment.