Tweak setup.py to allow installs outside source dir

Also fix mitmdump version output
This commit is contained in:
Aldo Cortesi 2014-01-19 16:06:03 +13:00
parent 64be9b1a8a
commit f431eb5acc
2 changed files with 8 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import argparse
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(usage = "%(prog)s [options] [filter]") parser = argparse.ArgumentParser(usage = "%(prog)s [options] [filter]")
parser.add_argument('--version', action='version', version=version.NAMEVERSION) parser.add_argument('--version', action='version', version="mitmdump" + " " + version.VERSION)
cmdline.common_options(parser) cmdline.common_options(parser)
parser.add_argument( parser.add_argument(
"--keepserving", "--keepserving",

View File

@ -2,6 +2,12 @@ from distutils.core import setup
import fnmatch, os.path import fnmatch, os.path
from libmproxy import version from libmproxy import version
def pdir():
dirname, _ = os.path.split(__file__)
return os.path.abspath(dirname)
def _fnmatch(name, patternList): def _fnmatch(name, patternList):
for i in patternList: for i in patternList:
if fnmatch.fnmatch(name, i): if fnmatch.fnmatch(name, i):
@ -65,7 +71,7 @@ def findPackages(path, dataExclude=[]):
return packages, package_data return packages, package_data
long_description = file("README.txt").read() long_description = file(os.path.join(pdir(), "README.txt")).read()
packages, package_data = findPackages("libmproxy") packages, package_data = findPackages("libmproxy")
setup( setup(
name = "mitmproxy", name = "mitmproxy",