improve dependency management in setup.py

This commit is contained in:
Maximilian Hils 2015-07-04 19:38:41 +02:00
parent 5a2b121f50
commit f8243086f6
1 changed files with 24 additions and 19 deletions

View File

@ -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: with open(os.path.join(here, 'README.txt'), encoding='utf-8') as f:
long_description = f.read() long_description = f.read()
scripts = ["mitmdump", "mitmweb"] # Core dependencies
if os.name != "nt":
scripts.append("mitmproxy")
deps = { deps = {
"netlib>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION), "netlib>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION),
"pyasn1>0.1.2", "pyasn1>0.1.2",
@ -25,7 +22,8 @@ deps = {
"pyparsing>=1.5.2", "pyparsing>=1.5.2",
"html2text>=2015.4.14" "html2text>=2015.4.14"
} }
script_deps = { # A script -> additional dependencies dict.
scripts = {
"mitmproxy": { "mitmproxy": {
"urwid>=1.3", "urwid>=1.3",
"lxml>=3.3.6", "lxml>=3.3.6",
@ -34,14 +32,29 @@ script_deps = {
"mitmdump": set(), "mitmdump": set(),
"mitmweb": set() "mitmweb": set()
} }
for script in scripts: # Developer dependencies
deps.update(script_deps[script]) 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": if os.name == "nt":
del scripts["mitmproxy"]
deps.add("pydivert>=0.0.7") # Transparent proxying on Windows deps.add("pydivert>=0.0.7") # Transparent proxying on Windows
console_scripts = [ # Add dependencies for available scripts as core dependencies.
"%s = libmproxy.main:%s" % (s, s) for s in scripts for script_deps in scripts.values():
] deps.update(script_deps)
console_scripts = ["%s = libmproxy.main:%s" % (s, s) for s in scripts.keys()]
setup( setup(
name="mitmproxy", name="mitmproxy",
@ -75,15 +88,7 @@ setup(
'console_scripts': console_scripts}, 'console_scripts': console_scripts},
install_requires=list(deps), install_requires=list(deps),
extras_require={ extras_require={
'dev': [ 'dev': list(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"],
'contentviews': [ 'contentviews': [
"pyamf>=0.6.1", "pyamf>=0.6.1",
"protobuf>=2.5.0", "protobuf>=2.5.0",