2010-02-16 04:09:07 +00:00
|
|
|
from distutils.core import setup
|
|
|
|
import fnmatch, os.path
|
2011-03-17 21:35:09 +00:00
|
|
|
from libmproxy import version
|
2010-02-16 04:09:07 +00:00
|
|
|
|
|
|
|
def _fnmatch(name, patternList):
|
|
|
|
for i in patternList:
|
|
|
|
if fnmatch.fnmatch(name, i):
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
def _splitAll(path):
|
|
|
|
parts = []
|
|
|
|
h = path
|
|
|
|
while 1:
|
|
|
|
if not h:
|
|
|
|
break
|
|
|
|
h, t = os.path.split(h)
|
|
|
|
parts.append(t)
|
|
|
|
parts.reverse()
|
|
|
|
return parts
|
|
|
|
|
|
|
|
|
|
|
|
def findPackages(path, dataExclude=[]):
|
|
|
|
"""
|
|
|
|
Recursively find all packages and data directories rooted at path. Note
|
|
|
|
that only data _directories_ and their contents are returned -
|
|
|
|
non-Python files at module scope are not, and should be manually
|
|
|
|
included.
|
2012-02-19 09:43:05 +00:00
|
|
|
|
2010-02-16 04:09:07 +00:00
|
|
|
dataExclude is a list of fnmatch-compatible expressions for files and
|
|
|
|
directories that should not be included in pakcage_data.
|
|
|
|
|
|
|
|
Returns a (packages, package_data) tuple, ready to be passed to the
|
|
|
|
corresponding distutils.core.setup arguments.
|
|
|
|
"""
|
|
|
|
packages = []
|
|
|
|
datadirs = []
|
|
|
|
for root, dirs, files in os.walk(path, topdown=True):
|
|
|
|
if "__init__.py" in files:
|
|
|
|
p = _splitAll(root)
|
|
|
|
packages.append(".".join(p))
|
|
|
|
else:
|
|
|
|
dirs[:] = []
|
|
|
|
if packages:
|
|
|
|
datadirs.append(root)
|
|
|
|
|
|
|
|
# Now we recurse into the data directories
|
|
|
|
package_data = {}
|
|
|
|
for i in datadirs:
|
|
|
|
if not _fnmatch(i, dataExclude):
|
|
|
|
parts = _splitAll(i)
|
|
|
|
module = ".".join(parts[:-1])
|
|
|
|
acc = package_data.get(module, [])
|
|
|
|
for root, dirs, files in os.walk(i, topdown=True):
|
|
|
|
sub = os.path.join(*_splitAll(root)[1:])
|
|
|
|
if not _fnmatch(sub, dataExclude):
|
|
|
|
for fname in files:
|
|
|
|
path = os.path.join(sub, fname)
|
|
|
|
if not _fnmatch(path, dataExclude):
|
|
|
|
acc.append(path)
|
|
|
|
else:
|
|
|
|
dirs[:] = []
|
|
|
|
package_data[module] = acc
|
|
|
|
return packages, package_data
|
|
|
|
|
|
|
|
|
2012-02-25 00:16:30 +00:00
|
|
|
long_description = file("README.txt").read()
|
2010-02-16 04:09:07 +00:00
|
|
|
packages, package_data = findPackages("libmproxy")
|
|
|
|
setup(
|
|
|
|
name = "mitmproxy",
|
2011-03-17 21:35:09 +00:00
|
|
|
version = version.VERSION,
|
2012-02-19 09:43:05 +00:00
|
|
|
description = "An interactive, SSL-capable, man-in-the-middle HTTP proxy for penetration testers and software developers.",
|
2010-02-16 04:09:07 +00:00
|
|
|
long_description = long_description,
|
|
|
|
author = "Aldo Cortesi",
|
|
|
|
author_email = "aldo@corte.si",
|
2011-03-29 23:05:50 +00:00
|
|
|
url = "http://mitmproxy.org",
|
2010-02-16 04:09:07 +00:00
|
|
|
packages = packages,
|
|
|
|
package_data = package_data,
|
2011-02-20 23:04:24 +00:00
|
|
|
scripts = ["mitmproxy", "mitmdump"],
|
2010-02-16 04:09:07 +00:00
|
|
|
classifiers = [
|
2011-08-06 23:18:26 +00:00
|
|
|
"License :: OSI Approved :: GNU General Public License (GPL)",
|
|
|
|
"Development Status :: 5 - Production/Stable",
|
|
|
|
"Environment :: Console",
|
|
|
|
"Environment :: Console :: Curses",
|
2012-02-25 00:36:08 +00:00
|
|
|
"Operating System :: MacOS :: MacOS X",
|
|
|
|
"Operating System :: POSIX",
|
2010-02-16 04:09:07 +00:00
|
|
|
"Programming Language :: Python",
|
2010-02-16 05:01:26 +00:00
|
|
|
"Topic :: Security",
|
2012-02-25 00:36:08 +00:00
|
|
|
"Topic :: Internet",
|
2010-02-16 05:01:26 +00:00
|
|
|
"Topic :: Internet :: WWW/HTTP",
|
2011-08-06 23:18:26 +00:00
|
|
|
"Topic :: Internet :: Proxy Servers",
|
2010-02-16 05:01:26 +00:00
|
|
|
"Topic :: Software Development :: Testing"
|
2012-02-07 18:52:26 +00:00
|
|
|
],
|
2012-04-09 04:45:42 +00:00
|
|
|
install_requires=['urwid>=1.0', 'pyasn1', 'pyopenssl>=0.12', "PIL", "lxml"],
|
2010-02-16 04:09:07 +00:00
|
|
|
)
|