From f431eb5accb03a2e97109e4b12b880827fd8306e Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 19 Jan 2014 16:06:03 +1300 Subject: [PATCH] Tweak setup.py to allow installs outside source dir Also fix mitmdump version output --- mitmdump | 2 +- setup.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mitmdump b/mitmdump index 68e8c4eee..2ceb9b306 100755 --- a/mitmdump +++ b/mitmdump @@ -5,7 +5,7 @@ import argparse if __name__ == '__main__': 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) parser.add_argument( "--keepserving", diff --git a/setup.py b/setup.py index 3c126a0e0..9b4d7f7ba 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,12 @@ from distutils.core import setup import fnmatch, os.path from libmproxy import version + +def pdir(): + dirname, _ = os.path.split(__file__) + return os.path.abspath(dirname) + + def _fnmatch(name, patternList): for i in patternList: if fnmatch.fnmatch(name, i): @@ -65,7 +71,7 @@ def findPackages(path, dataExclude=[]): 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") setup( name = "mitmproxy",