Skip to content

Commit 0abf1c1

Browse files
committed
setup.py: don't panic on wrong command line
1 parent 69fc51e commit 0abf1c1

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

setup.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,22 @@
1414

1515
from __future__ import print_function
1616

17-
import fnmatch
1817
import os
1918
import shutil
2019
import sys
2120
import json
2221
import warnings
2322
from pathlib import Path
24-
from sysconfig import get_config_vars
2523

26-
if __name__ == '__main__' and sys.argv[1] == "gevent_nosetests":
27-
print("Running gevent tests")
28-
from gevent.monkey import patch_all
29-
patch_all()
30-
31-
if __name__ == '__main__' and sys.argv[1] == "eventlet_nosetests":
32-
print("Running eventlet tests")
33-
from eventlet import monkey_patch
34-
monkey_patch()
24+
if __name__ == '__main__' and len(sys.argv) > 1:
25+
if sys.argv[1] == "gevent_nosetests":
26+
print("Running gevent tests")
27+
from gevent.monkey import patch_all
28+
patch_all()
29+
elif sys.argv[1] == "eventlet_nosetests":
30+
print("Running eventlet tests")
31+
from eventlet import monkey_patch
32+
monkey_patch()
3533

3634
from setuptools.command.build_ext import build_ext
3735
from setuptools import Extension, Command, setup
@@ -57,7 +55,7 @@ class eventlet_nosetests(nosetests):
5755
description = "run nosetests with eventlet monkey patching"
5856

5957
has_cqlengine = False
60-
if __name__ == '__main__' and sys.argv[1] == "install":
58+
if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] == "install":
6159
try:
6260
import cqlengine
6361
has_cqlengine = True
@@ -453,9 +451,7 @@ def run_setup(extensions):
453451
else:
454452
sys.stderr.write("Bypassing Cython setup requirement\n")
455453

456-
setup(
457-
tests_require=['nose', 'mock>=2.0.0', 'PyYAML', 'pytz', 'sure'],
458-
**kw)
454+
setup(**kw)
459455

460456

461457
run_setup(None)

0 commit comments

Comments
 (0)