Skip to content

Fix update for pre-release version #693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
@@ -215,14 +215,24 @@
}

# Unfortunately this is the smartest way of getting the latest available package version with pip as of now
# Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns
# more than one line with paretheses.
$latest_version = join([
"${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}",
" ${install_args} ${install_editable} '${real_pkgname}==9!0dev0+x' 2>&1",
$version_processing_commands = if $install_args and $install_args =~ /--pre/ {
[
" | sed -nE 's/.*\\(from versions: (.*, )*(.*)\\)/\\2/p'",
' | tr -d "[:space:]"',
])
]
} else {
[
" | sed -nE 's/.*\\(from versions: ([^\\)]*)\\)/\\1/p'",
' | awk \'BEGIN {RS=", "} {if ($0 !~ /(a|b|rc|dev)/) {gsub(/\n/,"");stable[arraylen++]=$0}} END {print stable[arraylen-1] }\'',
]
}

$latest_version = join(
[
"${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}",
" ${install_args} ${install_editable} '${real_pkgname}==9!0dev0+x' 2>&1",
] + $version_processing_commands,
)

# Packages with underscores in their names are listed with dashes in their place in `pip freeze` output
$pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G')

Unchanged files with check annotations Beta

{

Check warning on line 1 in metadata.json

GitHub Actions / Puppet / Static validations

Skipping EOL operating system CentOS 7

Check warning on line 1 in metadata.json

GitHub Actions / Puppet / Static validations

Skipping EOL operating system CentOS 8

Check warning on line 1 in metadata.json

GitHub Actions / Puppet / Static validations

Skipping EOL operating system Debian 10

Check warning on line 1 in metadata.json

GitHub Actions / Puppet / Static validations

Skipping EOL operating system FreeBSD 11

Check warning on line 1 in metadata.json

GitHub Actions / Puppet / Static validations

Skipping EOL operating system FreeBSD 12

Check warning on line 1 in metadata.json

GitHub Actions / Puppet / Static validations

Skipping EOL operating system Ubuntu 18.04
"name": "puppet-python",
"version": "7.3.1-rc0",
"author": "Vox Pupuli",
describe 'python::pip defined resource' do
context 'install package with custom name' do
it 'works with no errors' do

Check failure on line 7 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource install package with custom name works with no errors Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'archlinuxrolling-64.example.com' exited with 6 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_132806023.6xt6OO.pp Last 10 lines of output were: �[mNotice: Compiled catalog for archlinuxrolling-64.example.com in environment production in 0.08 seconds Info: Using environment 'production' Info: Applying configuration version '1724333287' �[mNotice: /Stage[main]/Main/Python::Pyvenv[/opt/test-venv]/File[/opt/test-venv]/ensure: created Error: invalid byte sequence in US-ASCII Error: /Stage[main]/Main/Python::Pyvenv[/opt/test-venv]/Exec[python_virtualenv_/opt/test-venv]/returns: change from 'notrun' to ['0'] failed: invalid byte sequence in US-ASCII Info: Python::Pyvenv[/opt/test-venv]: Unscheduling all events on Python::Pyvenv[/opt/test-venv] �[mNotice: /Stage[main]/Main/Python::Pip[agent package]/Exec[pip_install_agent package]: Dependency Exec[python_virtualenv_/opt/test-venv] has failures: true Warning: /Stage[main]/Main/Python::Pip[agent package]/Exec[pip_install_agent package]: Skipping because of failed dependencies �[mNotice: Applied catalog in 4.35 seconds
pp = <<-PUPPET
class { 'python':
dev => 'present',
# rubocop:disable RSpec/RepeatedExampleGroupDescription
# rubocop:disable RSpec/RepeatedExampleGroupBody
describe command('/opt/test-venv/bin/pip list') do
its(:exit_status) { is_expected.to eq 0 }

Check failure on line 35 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource Command "/opt/test-venv/bin/pip list" exit_status is expected to eq 0 Failure/Error: its(:exit_status) { is_expected.to eq 0 } expected: 0 got: 1 (compared using ==)
its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} }

Check failure on line 36 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource Command "/opt/test-venv/bin/pip list" stdout is expected to match /agent.* 0\.1\.2/ Failure/Error: its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } expected "" to match /agent.* 0\.1\.2/ Diff: @@ -1 +1 @@ -/agent.* 0\.1\.2/ +""
end
context 'uninstall package with custom name' do
it 'works with no errors' do

Check failure on line 40 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource uninstall package with custom name works with no errors Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'archlinuxrolling-64.example.com' exited with 4 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_132811884.nOSL3c.pp Last 10 lines of output were: �[mNotice: /Stage[main]/Main/Python::Pip[agent package install]/Exec[pip_install_agent package install]/returns: File "/opt/test-venv/lib/python3.12/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent package install]/Exec[pip_install_agent package install]/returns: from pip._internal.cli import cmdoptions �[mNotice: /Stage[main]/Main/Python::Pip[agent package install]/Exec[pip_install_agent package install]/returns: File "/opt/test-venv/lib/python3.12/site-packages/pip/_internal/cli/cmdoptions.py", line 18, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent package install]/Exec[pip_install_agent package install]/returns: from distutils.util import strtobool �[mNotice: /Stage[main]/Main/Python::Pip[agent package install]/Exec[pip_install_agent package install]/returns: ModuleNotFoundError: No module named 'distutils' Error: '/opt/test-venv/bin/pip --log /opt/test-venv/pip.log install agent==0.1.2' returned 1 instead of one of [0] Error: /Stage[main]/Main/Python::Pip[agent package install]/Exec[pip_install_agent package install]/returns: change from 'notrun' to ['0'] failed: '/opt/test-venv/bin/pip --log /opt/test-venv/pip.log install agent==0.1.2' returned 1 instead of one of [0] �[mNotice: /Stage[main]/Main/Python::Pip[agent package uninstall custom pkgname]/Exec[pip_uninstall_agent package uninstall custom pkgname]: Dependency Exec[pip_install_agent package install] has failures: true Warning: /Stage[main]/Main/Python::Pip[agent package uninstall custom pkgname]/Exec[pip_uninstall_agent package uninstall custom pkgname]: Skipping because of failed dependencies �[mNotice: Applied catalog in 0.49 seconds
pp = <<-PUPPET
class { 'python':
dev => 'present',
end
describe command('/opt/test-venv/bin/pip list') do
its(:exit_status) { is_expected.to eq 0 }

Check failure on line 73 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource Command "/opt/test-venv/bin/pip list" exit_status is expected to eq 0 Failure/Error: its(:exit_status) { is_expected.to eq 0 } expected: 0 got: 1 (compared using ==)
its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} }
end
context 'install package via extra_index' do
it 'works with no errors' do

Check failure on line 78 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource install package via extra_index works with no errors Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'archlinuxrolling-64.example.com' exited with 4 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_132813866.Cr8Vsr.pp Last 10 lines of output were: �[mNotice: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: File "/opt/test-venv/lib/python3.12/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: from pip._internal.cli.main_parser import create_main_parser �[mNotice: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: File "/opt/test-venv/lib/python3.12/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: from pip._internal.cli import cmdoptions �[mNotice: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: File "/opt/test-venv/lib/python3.12/site-packages/pip/_internal/cli/cmdoptions.py", line 18, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: from distutils.util import strtobool �[mNotice: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: ModuleNotFoundError: No module named 'distutils' Error: '/opt/test-venv/bin/pip --log /opt/test-venv/pip.log install --index-url=invalid --extra-index-url=https://pypi.org/simple agent==0.1.2' returned 1 instead of one of [0] Error: /Stage[main]/Main/Python::Pip[agent package via extra_index]/Exec[pip_install_agent package via extra_index]/returns: change from 'notrun' to ['0'] failed: '/opt/test-venv/bin/pip --log /opt/test-venv/pip.log install --index-url=invalid --extra-index-url=https://pypi.org/simple agent==0.1.2' returned 1 instead of one of [0] �[mNotice: Applied catalog in 0.48 seconds
pp = <<-PUPPET
class { 'python':
dev => 'present',
end
describe command('/opt/test-venv/bin/pip list') do
its(:exit_status) { is_expected.to eq 0 }

Check failure on line 106 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource Command "/opt/test-venv/bin/pip list" exit_status is expected to eq 0 Failure/Error: its(:exit_status) { is_expected.to eq 0 } expected: 0 got: 1 (compared using ==)
its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} }

Check failure on line 107 in spec/acceptance/pip_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pip defined resource Command "/opt/test-venv/bin/pip list" stdout is expected to match /agent.* 0\.1\.2/ Failure/Error: its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } expected "" to match /agent.* 0\.1\.2/ Diff: @@ -1 +1 @@ -/agent.* 0\.1\.2/ +""
end
# rubocop:enable RSpec/RepeatedExampleGroupBody
# rubocop:enable RSpec/RepeatedExampleGroupDescription
describe 'python::pyvenv defined resource with python 3' do
context 'minimal parameters' do
# Using puppet_apply as a helper
it 'works with no errors' do

Check failure on line 8 in spec/acceptance/pyvenv_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pyvenv defined resource with python 3 minimal parameters works with no errors Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'archlinuxrolling-64.example.com' exited with 6 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_132815874.LfULhX.pp Last 10 lines of output were: �[mNotice: Compiled catalog for archlinuxrolling-64.example.com in environment production in 0.08 seconds Info: Using environment 'production' Info: Applying configuration version '1724333297' �[mNotice: /Stage[main]/Main/User[agent]/ensure: created �[mNotice: /Stage[main]/Main/Python::Pyvenv[/opt/agent/venv]/File[/opt/agent/venv]/ensure: created Error: invalid byte sequence in US-ASCII Error: /Stage[main]/Main/Python::Pyvenv[/opt/agent/venv]/Exec[python_virtualenv_/opt/agent/venv]/returns: change from 'notrun' to ['0'] failed: invalid byte sequence in US-ASCII Info: Python::Pyvenv[/opt/agent/venv]: Unscheduling all events on Python::Pyvenv[/opt/agent/venv] Info: Class[Main]: Unscheduling all events on Class[Main] �[mNotice: Applied catalog in 4.39 seconds
pp = <<-PUPPET
class { 'python':
dev => 'present',
end
context 'with minimal python::pip' do
it 'works with no errors' do

Check failure on line 80 in spec/acceptance/pyvenv_spec.rb

GitHub Actions / Puppet / Distro Puppet - Archlinux rolling

python::pyvenv defined resource with python 3 with minimal python::pip works with no errors Failure/Error: apply_manifest(pp, catch_failures: true) Beaker::Host::CommandFailure: Host 'archlinuxrolling-64.example.com' exited with 4 running: puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest_132825507.iWJA0w.pp Last 10 lines of output were: �[mNotice: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: File "/opt/agent/venv/lib/python3.12/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: from pip._internal.cli.main_parser import create_main_parser �[mNotice: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: File "/opt/agent/venv/lib/python3.12/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: from pip._internal.cli import cmdoptions �[mNotice: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: File "/opt/agent/venv/lib/python3.12/site-packages/pip/_internal/cli/cmdoptions.py", line 18, in <module> �[mNotice: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: from distutils.util import strtobool �[mNotice: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: ModuleNotFoundError: No module named 'distutils' Error: '/opt/agent/venv/bin/pip --log /opt/agent/venv/pip.log install agent' returned 1 instead of one of [0] Error: /Stage[main]/Main/Python::Pip[agent]/Exec[pip_install_agent]/returns: change from 'notrun' to ['0'] failed: '/opt/agent/venv/bin/pip --log /opt/agent/venv/pip.log install agent' returned 1 instead of one of [0] �[mNotice: Applied catalog in 0.50 seconds
pp = <<-PUPPET
class { 'python':
dev => 'present',