Repository: urllib3/urllib3

Issue:
urllib3 fails to install on centos7 due to old setuptools not supporting <=, < environment markers.
Current urllib3 fails to install on centos7. This bug was most likely introduced after https://github.com/shazow/urllib3/commit/9f5454eac808a105307b2d363c99ce97e5109821.

centos7 ships a very old version of setuptools (0.9.8) which does not support `<=` as an environment marker. See https://github.com/pypa/setuptools/issues/380.

```
$ python --version
Python 2.7.5

$ rpm -qa python-setuptools
python-setuptools-0.9.8-4.el7.noarch

$ lsb_release -a
...
Description:    CentOS Linux release 7.2.1511 (Core) 
Release:    7.2.1511

$ virtualenv venv
...

$ venv/bin/pip install urllib3
Downloading/unpacking urllib3
  Downloading urllib3-1.18.tar.gz (183kB): 183kB downloaded
  Running setup.py egg_info for package urllib3
    error in urllib3 setup command: Invalid environment marker: python_version <= "2.7"
    Complete output from command python setup.py egg_info:
    error in urllib3 setup command: Invalid environment marker: python_version <= "2.7"

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/rene/src/venv/build/urllib3
Storing complete log in /home/rene/.pip/pip.log
```

Installing https://github.com/shazow/urllib3/commit/f620d997134708b09560ca5797aa79a59a2ef4c0  (commit before 9f5454eac808a105307b2d363c99ce97e5109821) works fine.

```
$ venv/bin/pip install git+git://github.com/shazow/urllib3.git@f620d997134708b09560ca5797aa79a59a2ef4c0
...
Successfully installed urllib3
Cleaning up...
```

But 9f5454eac808a105307b2d363c99ce97e5109821 fails.

```
$ venv/bin/pip install git+git://github.com/shazow/urllib3.git@9f5454eac808a105307b2d363c99ce97e5109821
Downloading/unpacking git+git://github.com/shazow/urllib3.git@9f5454eac808a105307b2d363c99ce97e5109821
  Cloning git://github.com/shazow/urllib3.git (to 9f5454eac808a105307b2d363c99ce97e5109821) to /tmp/pip-lnVDAG-build
  Could not find a tag or branch '9f5454eac808a105307b2d363c99ce97e5109821', assuming commit.
  Running setup.py egg_info for package from git+git://github.com/shazow/urllib3.git@9f5454eac808a105307b2d363c99ce97e5109821
    error in urllib3 setup command: Invalid environment marker: python_version < "3.3"
    Complete output from command python setup.py egg_info:
    error in urllib3 setup command: Invalid environment marker: python_version < "3.3"

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-lnVDAG-build
Storing complete log in /home/rene/.pip/pip.log
```

urllib3 1.17 setup.py does not ship with < or <= markers so my workaround right now is to install urllib3==1.17.



Discussion:
Given that you're in a virtual environment, I recommend you work around this issue by running `venv/bin/pip install -U setuptools`, which should resolve the issue and allow you to use the newest urllib3.

Oh, I see, I didn't realise that your version of setuptools didn't support markers _at all_. That explains a lot. Regardless, the best solution is to update setuptools in your virtualenv and continue: that's generally a good policy.

In the medium term, we should remove the markers from setup.py and just leave them in setup.cfg.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -59,8 +59,6 @@
               'cryptography>=1.3.4',
               'idna>=2.0.0',
               'certifi',
-          ],
-          'secure:python_version <= "2.7"': [
               "ipaddress",
           ],
           'socks': [


Test patch: