need to install psycopg2-binary in the created venv

This commit is contained in:
Steven Robertson 2020-09-23 20:47:48 -07:00
parent 9bef6fe784
commit 9a34d5c2c9
1 changed files with 7 additions and 3 deletions

View File

@ -55,12 +55,12 @@ if ci_lib.have_apt():
# and Azure isn't allowing disabling it apparently: https://developercommunityapi.westus.cloudapp.azure.com/idea/558702/allow-disabling-sip-on-microsoft-hosted-macos-agen.html # and Azure isn't allowing disabling it apparently: https://developercommunityapi.westus.cloudapp.azure.com/idea/558702/allow-disabling-sip-on-microsoft-hosted-macos-agen.html
# so we'll use /usr/local/bin/python for everything # so we'll use /usr/local/bin/python for everything
# /usr/local/bin/python2.7 already exists! # /usr/local/bin/python2.7 already exists!
need_to_fix_psycopg2 = False
if os.environ['PYTHONVERSION'].startswith('3') and ci_lib.have_brew(): if os.environ['PYTHONVERSION'].startswith('3') and ci_lib.have_brew():
need_to_fix_psycopg2 = True
batches.append([ batches.append([
'brew install python@{pv} postgresql' 'brew install python@{pv} postgresql'
.format(pv=os.environ['PYTHONVERSION']), .format(pv=os.environ['PYTHONVERSION'])
# fixes https://stackoverflow.com/questions/59595649/can-not-install-psycopg2-on-macos-catalina
'pip3 install psycopg2-binary'
]) ])
# setup venv # setup venv
@ -73,6 +73,10 @@ if os.environ['PYTHONVERSION'].startswith('2'):
]) ])
else: else:
venv_steps.append('/usr/local/bin/python{pv} -m venv /tmp/venv'.format(pv=os.environ['PYTHONVERSION'])) venv_steps.append('/usr/local/bin/python{pv} -m venv /tmp/venv'.format(pv=os.environ['PYTHONVERSION']))
# fixes https://stackoverflow.com/questions/59595649/can-not-install-psycopg2-on-macos-catalina
if need_to_fix_psycopg2:
venv_steps.append('/tmp/venv/bin/pip3 install psycopg2-binary')
batches.append(venv_steps) batches.append(venv_steps)