From e97b375d9d4fc09378b2bc83d56d4f4110f11bb8 Mon Sep 17 00:00:00 2001 From: Cesar Souto Date: Thu, 11 May 2023 13:22:28 -0300 Subject: [PATCH 1/3] Call py3 binary --- lib/travis/build/appliances/nonblock_pipe.rb | 2 +- lib/travis/build/script/python.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/travis/build/appliances/nonblock_pipe.rb b/lib/travis/build/appliances/nonblock_pipe.rb index df9b69c520..c755f5e315 100644 --- a/lib/travis/build/appliances/nonblock_pipe.rb +++ b/lib/travis/build/appliances/nonblock_pipe.rb @@ -19,7 +19,7 @@ def apply flags_stderr = fcntl.fcntl(sys.stderr, fcntl.F_GETFL) fcntl.fcntl(sys.stderr, fcntl.F_SETFL, flags_stderr&~os.O_NONBLOCK) EOPY - python ~/nonblock.py + python3 ~/nonblock.py rm ~/nonblock.py fi EOF diff --git a/lib/travis/build/script/python.rb b/lib/travis/build/script/python.rb index eb2eebd7cf..35e7ecd3b0 100644 --- a/lib/travis/build/script/python.rb +++ b/lib/travis/build/script/python.rb @@ -48,8 +48,8 @@ def setup end def announce - sh.cmd 'python --version' - sh.cmd 'pip --version' + sh.cmd 'python3 --version' + sh.cmd 'pip3 --version' sh.export 'PIP_DISABLE_PIP_VERSION_CHECK', '1', echo: false sh.export 'PIP_PROGRESS_BAR', 'off', echo: false end From 0416574b2cc175433c61be2e0b7c25aee8ff85d8 Mon Sep 17 00:00:00 2001 From: Cesar Souto Date: Thu, 11 May 2023 14:15:21 -0300 Subject: [PATCH 2/3] Fix tests --- spec/build/script/python_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/build/script/python_spec.rb b/spec/build/script/python_spec.rb index 45321c5efc..82c6284949 100644 --- a/spec/build/script/python_spec.rb +++ b/spec/build/script/python_spec.rb @@ -15,7 +15,7 @@ it_behaves_like 'compiled script' do let(:code) { ['TRAVIS_LANGUAGE=python'] } - let(:cmds) { ['pip install'] } + let(:cmds) { ['pip3 install'] } end describe 'given a script' do @@ -146,11 +146,11 @@ end it 'announces python --version' do - should include_sexp [:cmd, 'python --version', echo: true] + should include_sexp [:cmd, 'python3 --version', echo: true] end it 'announces pip --version' do - should include_sexp [:cmd, 'pip --version', echo: true] + should include_sexp [:cmd, 'pip3 --version', echo: true] end describe 'install' do @@ -160,12 +160,12 @@ it 'installs with pip if Requirements.txt exists' do branch = sexp_find(sexp, [:then]) - expect(branch).to include_sexp [:cmd, 'pip install -r Requirements.txt', assert: true, echo: true, retry: true, timing: true] + expect(branch).to include_sexp [:cmd, 'pip3 install -r Requirements.txt', assert: true, echo: true, retry: true, timing: true] end it 'installs with pip if requirements.txt exists' do branch = sexp_find(sexp, [:elif, '-f requirements.txt']) - expect(branch).to include_sexp [:cmd, 'pip install -r requirements.txt', assert: true, echo: true, retry: true, timing: true] + expect(branch).to include_sexp [:cmd, 'pip3 install -r requirements.txt', assert: true, echo: true, retry: true, timing: true] end it 'errors if no requirements file exists' do @@ -174,7 +174,7 @@ end it 'adds ${TRAVIS_HOME}/.cache/pip to directory cache' do - should include_sexp [:cmd, %r(rvm \$\(travis_internal_ruby\) --fuzzy do \$CASHER_DIR/bin/casher --name \S+ cache add \${TRAVIS_HOME}/.cache/pip), timing: true] + should include_sexp [:cmd, %r(rvm \$\(travis_internal_ruby\) --fuzzy do \$CASHER_DIR/bin/casher --name \S+ cache add \${TRAVIS_HOME}/.cache/pip3), timing: true] end end From fb9fbd191a83a98b41e94914184461837cb97af4 Mon Sep 17 00:00:00 2001 From: Cesar Souto Date: Thu, 11 May 2023 16:19:00 -0300 Subject: [PATCH 3/3] Fix pip --- lib/travis/build/script/python.rb | 8 ++++---- spec/build/script/python_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/travis/build/script/python.rb b/lib/travis/build/script/python.rb index 35e7ecd3b0..8e9db2bbea 100644 --- a/lib/travis/build/script/python.rb +++ b/lib/travis/build/script/python.rb @@ -66,10 +66,10 @@ def setup_cache def install warn_pip_20_3 sh.if '-f Requirements.txt' do - sh.cmd 'pip install -r Requirements.txt', fold: 'install', retry: true + sh.cmd 'pip3 install -r Requirements.txt', fold: 'install', retry: true end sh.elif '-f requirements.txt' do - sh.cmd 'pip install -r requirements.txt', fold: 'install', retry: true + sh.cmd 'pip3 install -r requirements.txt', fold: 'install', retry: true end sh.else do sh.echo REQUIREMENTS_MISSING # , ansi: :red @@ -149,10 +149,10 @@ def setup_path(version = 'nightly') end def pip_version_at_least_20_2? - "$(travis_vers2int $(pip --version | cut -f2 -d \" \")) -ge $(travis_vers2int \"20.2\")" + "$(travis_vers2int $(pip3 --version | cut -f2 -d \" \")) -ge $(travis_vers2int \"20.2\")" end def pip_version_before_20_3? - "$(travis_vers2int $(pip --version | cut -f2 -d \" \")) -lt $(travis_vers2int \"20.3\")" + "$(travis_vers2int $(pip3 --version | cut -f2 -d \" \")) -lt $(travis_vers2int \"20.3\")" end def warn_pip_20_3 diff --git a/spec/build/script/python_spec.rb b/spec/build/script/python_spec.rb index 82c6284949..a50b9d9a5b 100644 --- a/spec/build/script/python_spec.rb +++ b/spec/build/script/python_spec.rb @@ -174,7 +174,7 @@ end it 'adds ${TRAVIS_HOME}/.cache/pip to directory cache' do - should include_sexp [:cmd, %r(rvm \$\(travis_internal_ruby\) --fuzzy do \$CASHER_DIR/bin/casher --name \S+ cache add \${TRAVIS_HOME}/.cache/pip3), timing: true] + should include_sexp [:cmd, %r(rvm \$\(travis_internal_ruby\) --fuzzy do \$CASHER_DIR/bin/casher --name \S+ cache add \${TRAVIS_HOME}/.cache/pip), timing: true] end end