Skip to content

Commit

Permalink
setup.py: Add minimum pip requirement check
Browse files Browse the repository at this point in the history
Older setuptools/pip fails on installation
due to missing syntax in them. This fixes
that problem by avoiding such installation.

Related to: coala#6017
  • Loading branch information
abhishalya committed Jun 19, 2019
1 parent 74c75c8 commit 03edf5f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .misc/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ install:
# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- "%CMD_IN_ENV% python -m pip install --upgrade setuptools==21 pip==9"
- "%CMD_IN_ENV% python -m pip install --upgrade setuptools==21 pip==9.0.1"
- "%CMD_IN_ENV% python -m pip install -r test-requirements.txt \
-r requirements.txt -r docs-requirements.txt"

Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ before_install:
# Apart from builds with python 2.7 and 3.5, it installs setuptools
# twice. So, it is required to uninstall one version manually.
- pip uninstall setuptools --yes
- pip install pip==9 setuptools==21
- pip install pip==9.0.1 setuptools==21
- python .misc/check_setuptools.py

# https://github.com/coala/coala/issues/3183
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from os import getenv
from subprocess import call

import pip
import setuptools.command.build_py
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
Expand Down Expand Up @@ -437,6 +438,10 @@ def read_requirements(filename):
})

if __name__ == '__main__':
pip_version = LooseVersion(pip.__version__)
if pip_version < LooseVersion('9.0.1'):
raise RuntimeError('Version of pip is less than 9.0.1. '
'Consider upgrading pip to pip~=9.0.1')
setup(name='coala',
version=VERSION,
description=DESCRIPTION,
Expand Down

0 comments on commit 03edf5f

Please sign in to comment.