Compare commits
3 Commits
main
...
issue/2110
| Author | SHA1 | Date |
|---|---|---|
|
|
ead34158a6 | |
|
|
d68675eac4 | |
|
|
2b92716afb |
|
|
@ -6,11 +6,30 @@ on:
|
|||
branches: [main]
|
||||
|
||||
jobs:
|
||||
split:
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
rspec_groups: ${{ steps.groups.outputs.rspec_groups }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '3.4'
|
||||
bundler-cache: true
|
||||
- id: groups
|
||||
run: |
|
||||
printf "rspec_groups<<JSON\n" >> $GITHUB_OUTPUT
|
||||
bundle exec rspec -fd --dry-run | sed -ne '/^Finished in /q; /^\S/p' | jq -R | jq -s >> $GITHUB_OUTPUT
|
||||
printf "JSON\n" >> $GITHUB_OUTPUT
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [ split ]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ruby-version: ['2.7', '3.0', '3.1', '3.4']
|
||||
rspec-group: ${{ fromJSON(needs.split.outputs.rspec_groups) }}
|
||||
steps:
|
||||
- run: |
|
||||
sudo apt-get update
|
||||
|
|
@ -21,10 +40,7 @@ jobs:
|
|||
ruby-version: ${{ matrix.ruby-version }}
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
- run: |
|
||||
if [ ! -z "$RUNNER_DEBUG" ] ; then
|
||||
DEBUG=1 bundle exec rspec -fd
|
||||
else
|
||||
bundle exec rspec
|
||||
fi
|
||||
[ ! -z "$RUNNER_DEBUG" ] && export DEBUG=1
|
||||
bundle exec rspec -fd -e "${{ matrix.rspec-group }}"
|
||||
env:
|
||||
SHELL: /usr/bin/bash
|
||||
|
|
|
|||
|
|
@ -375,11 +375,15 @@ class FPM::Package::Python < FPM::Package
|
|||
|
||||
logger.info("Setting default python executable", :name => default_python)
|
||||
attributes[:python_bin] = default_python
|
||||
end
|
||||
|
||||
if !attributes[:python_package_name_prefix_given?]
|
||||
attributes[:python_package_name_prefix] = default_python
|
||||
logger.info("Setting package name prefix", :name => default_python)
|
||||
if !attributes[:python_package_name_prefix_given?]
|
||||
major = nil
|
||||
execmd([attributes[:python_bin], "-c", "import sys; print(sys.version_info[0])"], :stdin => false, :stderr => false) do |stdout|
|
||||
major = stdout.readline.chomp
|
||||
end
|
||||
attributes[:python_package_name_prefix] = "python#{major}"
|
||||
logger.info("Setting package name prefix based on python major version #{major}", :name => attributes[:python_package_name_prefix])
|
||||
end
|
||||
|
||||
if attributes[:python_internal_pip?]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module FPM
|
||||
VERSION = "1.17.0.pre1"
|
||||
VERSION = "1.17.0"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ describe FPM::Package::Python do
|
|||
#subject.attributes[:python_bin] = find_python
|
||||
end
|
||||
|
||||
|
||||
let(:python_major) do
|
||||
`#{subject.attributes[:python_bin]} -c "import sys; print(sys.version_info[0])"`.chomp
|
||||
end
|
||||
|
||||
let (:example_dir) do
|
||||
File.expand_path("../../fixtures/python/", File.dirname(__FILE__))
|
||||
end
|
||||
|
|
@ -56,9 +61,11 @@ describe FPM::Package::Python do
|
|||
end
|
||||
|
||||
context "and :python_package_name_prefix is nil/default" do
|
||||
it "should prefix the package name based on detected python-bin name" do
|
||||
it "should prefix the package name based on detected python-bin version" do
|
||||
subject.input(example_dir)
|
||||
insist { subject.name } == "#{subject.attributes[:python_bin]}-Example"
|
||||
reject { subject.attributes[:python_package_name_prefix_given?] }
|
||||
insist { subject.attributes[:python_package_name_prefix] } == "python#{python_major}"
|
||||
insist { subject.name } == "python#{python_major}-Example"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -99,7 +106,7 @@ describe FPM::Package::Python do
|
|||
it "should prefix the package based on the version of python" do
|
||||
subject.input(example_dir)
|
||||
insist { subject.attributes[:python_package_name_prefix_given?] }.nil?
|
||||
insist { subject.name } == "#{subject.attributes[:python_bin]}-example"
|
||||
insist { subject.name } == "python#{python_major}-example"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue