Skip to content
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

Directly call py3 binary #2084

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/travis/build/appliances/nonblock_pipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lib/travis/build/script/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions spec/build/script/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down