From 3f66c7ceda4f934a78a6a83d0d735f911aaaecf8 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Wed, 2 Mar 2016 14:13:43 +0100 Subject: [PATCH] Recognize git version from tarball name if everything else fails --- .gitignore | 4 ++-- src/gitversion/_version.py | 3 ++- src/gitversion/versioneer.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2b212f93..0fc7e0cf 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ umltest.status /.idea *~ -gitversion/*.pyc -gitversion/__pycache__ +src/gitversion/*.pyc +src/gitversion/__pycache__ diff --git a/src/gitversion/_version.py b/src/gitversion/_version.py index 12c47d74..1c24d642 100644 --- a/src/gitversion/_version.py +++ b/src/gitversion/_version.py @@ -108,7 +108,8 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): Source tarballs conventionally unpack into a directory that includes both the project name and a version string. """ - dirname = os.path.basename(root) + # -- (MESSMER) CHANGED FOLLOWING LINE TO LOOK IN ../.. instead of . -- + dirname = os.path.basename(os.path.abspath(os.path.join(os.path.join(root, '..'), '..'))) if not dirname.startswith(parentdir_prefix): if verbose: print("guessing rootdir is '%s', but '%s' doesn't start with " diff --git a/src/gitversion/versioneer.py b/src/gitversion/versioneer.py index ba9d5f26..341adb5a 100644 --- a/src/gitversion/versioneer.py +++ b/src/gitversion/versioneer.py @@ -590,7 +590,8 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): Source tarballs conventionally unpack into a directory that includes both the project name and a version string. """ - dirname = os.path.basename(root) + # -- (MESSMER) CHANGED FOLLOWING LINE TO LOOK IN ../.. instead of . -- + dirname = os.path.basename(os.path.abspath(os.path.join(os.path.join(root, '..'), '..'))) if not dirname.startswith(parentdir_prefix): if verbose: print("guessing rootdir is '%%s', but '%%s' doesn't start with "