From f8243086f6f052d2fb88f2dc636717b999edb661 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 4 Jul 2015 19:38:41 +0200 Subject: [PATCH] improve dependency management in setup.py --- setup.py | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/setup.py b/setup.py index 1c15eb804..847a17f99 100644 --- a/setup.py +++ b/setup.py @@ -11,10 +11,7 @@ here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'README.txt'), encoding='utf-8') as f: long_description = f.read() -scripts = ["mitmdump", "mitmweb"] -if os.name != "nt": - scripts.append("mitmproxy") - +# Core dependencies deps = { "netlib>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION), "pyasn1>0.1.2", @@ -25,7 +22,8 @@ deps = { "pyparsing>=1.5.2", "html2text>=2015.4.14" } -script_deps = { +# A script -> additional dependencies dict. +scripts = { "mitmproxy": { "urwid>=1.3", "lxml>=3.3.6", @@ -34,14 +32,29 @@ script_deps = { "mitmdump": set(), "mitmweb": set() } -for script in scripts: - deps.update(script_deps[script]) +# Developer dependencies +dev_deps = { + "mock>=1.0.1", + "nose>=1.3.0", + "nose-cov>=1.6", + "coveralls>=0.4.1", + "pathod>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION), + "countershape" +} +# Add *all* script dependencies to developer dependencies. +for script_deps in scripts.values(): + dev_deps.update(script_deps) + +# Remove mitmproxy for Windows support. if os.name == "nt": + del scripts["mitmproxy"] deps.add("pydivert>=0.0.7") # Transparent proxying on Windows -console_scripts = [ - "%s = libmproxy.main:%s" % (s, s) for s in scripts -] +# Add dependencies for available scripts as core dependencies. +for script_deps in scripts.values(): + deps.update(script_deps) + +console_scripts = ["%s = libmproxy.main:%s" % (s, s) for s in scripts.keys()] setup( name="mitmproxy", @@ -75,15 +88,7 @@ setup( 'console_scripts': console_scripts}, install_requires=list(deps), extras_require={ - 'dev': [ - "mock>=1.0.1", - "nose>=1.3.0", - "nose-cov>=1.6", - "coveralls>=0.4.1", - "pathod>=%s, <%s" % - (version.MINORVERSION, - version.NEXT_MINORVERSION), - "countershape"], + 'dev': list(dev_deps), 'contentviews': [ "pyamf>=0.6.1", "protobuf>=2.5.0",