Skip to content
Merged
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
29 changes: 19 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Setuptools setup file, used to install or test 'cmd2'
"""
import sys

import setuptools
from setuptools import setup

VERSION = '0.8.2'
Expand Down Expand Up @@ -64,17 +66,23 @@

INSTALL_REQUIRES = ['pyparsing >= 2.0.1', 'pyperclip', 'six']

# Windows also requires pyreadline to ensure tab completion works
if sys.platform.startswith('win'):
INSTALL_REQUIRES += ['pyreadline']

# Python 3.4 and earlier require contextlib2 for temporarily redirecting stderr and stdout
if sys.version_info < (3, 5):
INSTALL_REQUIRES += ['contextlib2']
EXTRAS_REQUIRE = {
Copy link
Member

Choose a reason for hiding this comment

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

I wasn't familiar with this syntax within setuptools for conditional dependencies.

# Windows also requires pyreadline to ensure tab completion works
":sys_platform=='win32'": ['pyreadline'],
# Python 3.4 and earlier require contextlib2 for temporarily redirecting stderr and stdout
":python_version<'3.5'": ['contextlib2'],
# Python 2.7 also requires subprocess32
":python_version<'3.0'": ['subprocess32'],
}

# Python 2.7 also requires subprocess32
if sys.version_info < (3, 0):
INSTALL_REQUIRES += ['subprocess32']
if int(setuptools.__version__.split('.')[0]) < 18:
EXTRAS_REQUIRE = {}
if sys.platform.startswith('win'):
INSTALL_REQUIRES.append('pyreadline')
if sys.version_info < (3, 5):
INSTALL_REQUIRES.append('contextlib2')
if sys.version_info < (3, 0):
INSTALL_REQUIRES.append('subprocess32')

# unittest.mock was added in Python 3.3. mock is a backport of unittest.mock to all versions of Python
TESTS_REQUIRE = ['mock', 'pytest', 'pytest-xdist']
Expand All @@ -94,5 +102,6 @@
py_modules=["cmd2"],
keywords='command prompt console cmd',
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
tests_require=TESTS_REQUIRE,
)