Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Environment markers #357

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

Closed
wants to merge 5 commits into from
Closed
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
30 changes: 20 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,26 @@
# You need to have the setuptools module installed. Try reading the setuptools
# documentation: http://pypi.python.org/pypi/setuptools
REQUIRES = ["requests >= 2.0.0", "six", "pytz", "PyJWT >= 1.4.2"]
REQUIRES_PY2 = ["cryptography >= 1.3.4", "idna >= 2.0.0", "pyOpenSSL >= 0.14"]
REQUIRES_PY3 = ['pysocks']

if sys.version_info < (3, 0):
REQUIRES.extend(["cryptography >= 1.3.4", "idna >= 2.0.0", "pyOpenSSL >= 0.14"])
if sys.version_info >= (3, 0):
REQUIRES.append('pysocks')
if 'bdist_wheel' not in sys.argv:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this if statement used and the environment markers are not used such that this block is necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used when an older version of pip installs twilio sdist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what versions of pip need this block? Maybe we can remove it if those versions of pip are sufficiently old?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about that, but as far as I remember pip installed on Ubuntu LTS versions didn't work well without this.

# Since wheels don't have setup.py but a static list of dependencies,
# if install_requires is once made it's fixed to a wheel file.
# To prevent fixing the following conditional dependencies, opt-out them
# when building wheels and use "environment markers" instead (see below).
if sys.version_info < (3, 0):
REQUIRES.extend(REQUIRES_PY2)
if sys.version_info >= (3, 0):
REQUIRES.extend(REQUIRES_PY3)

# Environment markers
extras_require = {
# Older versions of pip don't support operators other than ==/!=
":python_version=='2.7'": REQUIRES_PY2,
(":python_version=='3.3' or python_version=='3.4' or"
" python_version=='3.5' or python_version=='3.6'"): REQUIRES_PY3,
}

setup(
name = "twilio",
Expand All @@ -30,12 +45,7 @@
keywords = ["twilio","twiml"],
install_requires = REQUIRES,
# bdist conditional requirements support
extras_require={
':python_version=="3.3"': ['pysocks'],
':python_version=="3.4"': ['pysocks'],
':python_version=="3.5"': ['pysocks'],
':python_version=="3.6"': ['pysocks'],
},
extras_require = extras_require,
packages = find_packages(exclude=['tests', 'tests.*']),
include_package_data=True,
classifiers = [
Expand Down