From d9c273a72c3fe05b51f55b0e5887c4379ad6ed8b Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 16 Jan 2016 02:23:18 +0100 Subject: [PATCH] Hopefully definite fix for building from outside package directory (follow-up for 73ec7da13e668ae6555f20daa673c29659f390a4) `find_packages` does not seem to work correctly when the working directory does not equal the package directory (resulted in the actual module not being installed). Fix this by changing the working directory during setup. --- setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c14779a..446ac05 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,11 @@ Authors: - Tobias Oberstein (maintainer) """ -VERSIONFILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "scour", "__init__.py") +old_path = os.getcwd() +src_path = os.path.dirname(os.path.realpath(__file__)) +os.chdir(src_path) + +VERSIONFILE = "scour/__init__.py" verstrline = open(VERSIONFILE, "rt").read() VSRE = r"^__version__ = u['\"]([^'\"]*)['\"]" mo = re.search(VSRE, verstrline, re.M) @@ -74,3 +78,5 @@ setup ( "Topic :: Utilities"], keywords = 'svg optimizer' ) + +os.chdir(old_path) \ No newline at end of file