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..8e9db2bbea 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 @@ -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 45321c5efc..a50b9d9a5b 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