aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-10-02 00:05:29 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-10-02 00:05:29 +0200
commit48fb49ee44ff5b136f0ef3db7a7033e3c2018f06 (patch)
treea4ff71727bc5a9581493a7c391625f81e6e02907 /setup.py
parent0426eccfd8c175d0ece6da92dd8425370fc8de6c (diff)
downloadmitmproxy-48fb49ee44ff5b136f0ef3db7a7033e3c2018f06.tar.gz
mitmproxy-48fb49ee44ff5b136f0ef3db7a7033e3c2018f06.tar.bz2
mitmproxy-48fb49ee44ff5b136f0ef3db7a7033e3c2018f06.zip
distutils -> setuptools
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py96
1 files changed, 21 insertions, 75 deletions
diff --git a/setup.py b/setup.py
index 1dd0e7d2..b756dbfe 100644
--- a/setup.py
+++ b/setup.py
@@ -1,90 +1,25 @@
-from distutils.core import setup
-import fnmatch, os.path
+from setuptools import setup, find_packages
+from codecs import open
+import os
from libpathod import version
+# Based on https://github.com/pypa/sampleproject/blob/master/setup.py
+# and https://python-packaging-user-guide.readthedocs.org/
-def _fnmatch(name, patternList):
- for i in patternList:
- if fnmatch.fnmatch(name, i):
- return True
- return False
+here = os.path.abspath(os.path.dirname(__file__))
-
-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
-
-with open("README.txt", "rb") as f:
+with open(os.path.join(here, 'README.txt'), encoding='utf-8') as f:
long_description = f.read()
-packages, package_data = findPackages("libpathod")
setup(
name="pathod",
version=version.VERSION,
description="A pathological HTTP/S daemon for testing and stressing clients.",
long_description=long_description,
+ url="http://pathod.net",
author="Aldo Cortesi",
author_email="aldo@corte.si",
- url="http://pathod.net",
- packages=packages,
- package_data=package_data,
- entry_points={
- 'console_scripts': [
- "pathod = libpathod.main:pathod",
- "pathoc = libpathod.main:pathoc"
- ]
- },
+ license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Development Status :: 5 - Production/Stable",
@@ -92,11 +27,22 @@ setup(
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Topic :: Internet",
+ "Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Testing :: Traffic Generation",
- "Topic :: Internet :: WWW/HTTP",
],
+
+ packages=find_packages(),
+ include_package_data=True,
+
+ entry_points={
+ 'console_scripts': [
+ "pathod = libpathod.main:pathod",
+ "pathoc = libpathod.main:pathoc"
+ ]
+ },
+
install_requires=[
'netlib>=%s' % version.MINORVERSION,
"requests>=2.4.1",