diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..45728608 --- /dev/null +++ b/setup.py @@ -0,0 +1,97 @@ +from distutils.core import setup +import fnmatch, os.path + +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. + + 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 + + + + +long_description = """ +A man-in-the-middle intercepting proxy written in Python. + +Features +======== + + * Intercept HTTP and HTTPS traffic. + * Modify, manipulate and replay requests and responses on the fly. +""" +packages, package_data = findPackages("libmproxy") +print packages, package_data +version = "0.1" +setup( + name = "mitmproxy", + version = version, + description = "An interactive intercepting proxy server.", + long_description = long_description, + author = "Aldo Cortesi", + author_email = "aldo@corte.si", + url = "http://corte.si/software/mitmproxy", + packages = packages, + package_data = package_data, + scripts = ["mitmproxy"], + classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Operating System :: OS Independent", + ] +) |