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:
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",