Skip to content

Commit 3389442

Browse files
python pip use --target instead of --root
1 parent 665f019 commit 3389442

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.github/workflows/ruby.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ jobs:
2222
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
2323
- name: Run test suite
2424
run: |
25-
# use a Python venv to avoid the mess of interacting with system Python packages
26-
python -m venv venv
27-
. venv/bin/activate
28-
pip install -r requirements.txt -r spec/test-requirements.txt
29-
3025
if [ ! -z "$RUNNER_DEBUG" ] ; then
3126
DEBUG=1 bundle exec rspec -fd
3227
else

lib/fpm/package/python.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,12 @@ def fix_name(name)
594594
end
595595
end # def fix_name
596596

597+
def pip_install_dir()
598+
execmd([attributes[:python_bin], "-c", "import sysconfig; from pathlib import Path; print(Path(sysconfig.get_path('purelib')).parent)"], :stdin => false, :stderr => false) do |stdout|
599+
return stdout.read(64<<10).strip()
600+
end
601+
end
602+
597603
# Install this package to the staging directory
598604
def install_to_staging(path)
599605
prefix = "/"
@@ -602,10 +608,10 @@ def install_to_staging(path)
602608
# XXX: Note: pip doesn't seem to have any equivalent to `--install-lib` or similar flags.
603609
# XXX: Deprecate :python_install_data, :python_install_lib, :python_install_bin
604610
# XXX: Deprecate: :python_setup_py_arguments
605-
flags = [ "--root", staging_path ]
606-
flags += [ "--prefix", prefix ] if !attributes[:prefix].nil?
607-
611+
flags = [ "--target", staging_path + pip_install_dir() ]
612+
#flags += [ "--prefix", prefix ] if !attributes[:prefix].nil?
608613
safesystem(*attributes[:python_pip], "install", "--no-deps", *flags, path)
614+
require 'pry'; binding.pry #DEBUG:
609615
end # def install_to_staging
610616

611617
public(:input)

0 commit comments

Comments
 (0)