From babbbf696ecf4ad25f57a4e227ee81fa9046406a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 20 Apr 2015 12:45:38 +0200 Subject: [PATCH] Fix: Another versioneer branch issue --- CHANGELOG.md | 10 ++++++++++ versioneer.py | 31 +++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ca36496..25982d30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # OctoPrint Changelog +## 1.1.3 (unreleased) + +### Bug Fixes + +* Fixed another instance of a missing `branch` fields in version dicts generated by versioneer (compare + [#634](https://github.com/foosel/OctoPrint/pull/634)). Caused an issue when installing from source archive + downloaded from Github. + +([Commits](https://github.com/foosel/OctoPrint/compare/1.1.2...master)) + ## 1.1.2 (2015-03-23) ### Improvements diff --git a/versioneer.py b/versioneer.py index 6b473324..27e1741c 100644 --- a/versioneer.py +++ b/versioneer.py @@ -369,6 +369,17 @@ def versions_from_expanded_variables(variables, tag_prefix, verbose=False): tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: print("discarding '%%s', no digits" %% ",".join(refs-tags)) + + branches = [r for r in refs if not r.startswith(TAG) and r != "HEAD" and not r.startswith("refs/")] + if branches: + branch = branches[0] + else: + branch = "unknown" + + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + print("likely branches: %s" % ",".join(sorted(branches))) + if verbose: print("likely tags: %%s" %% ",".join(sorted(tags))) for ref in sorted(tags): @@ -378,12 +389,14 @@ def versions_from_expanded_variables(variables, tag_prefix, verbose=False): if verbose: print("picking %%s" %% r) return { "version": r, - "full": variables["full"].strip() } + "full": variables["full"].strip(), + "branch": branch} # no suitable tags, so we use the full revision id if verbose: print("no suitable tags, using full revision id") return { "version": variables["full"].strip(), - "full": variables["full"].strip() } + "full": variables["full"].strip(), + "branch": "unknown"} def versions_from_lookup(lookup, root, verbose=False): GITS = get_gits(root, verbose=verbose) @@ -635,8 +648,17 @@ def versions_from_expanded_variables(variables, tag_prefix, verbose=False): tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: print("discarding '%s', no digits" % ",".join(refs-tags)) + + branches = [r for r in refs if not r.startswith(TAG) and r != "HEAD" and not r.startswith("refs/")] + if branches: + branch = branches[0] + else: + branch = "unknown" + if verbose: print("likely tags: %s" % ",".join(sorted(tags))) + print("likely branches: %s" % ",".join(sorted(branches))) + for ref in sorted(tags): # sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startswith(tag_prefix): @@ -644,13 +666,14 @@ def versions_from_expanded_variables(variables, tag_prefix, verbose=False): if verbose: print("picking %s" % r) return { "version": r, - "full": variables["full"].strip() } + "full": variables["full"].strip(), + "branch": branch } # no suitable tags, so we use the full revision id if verbose: print("no suitable tags, using full revision id") return { "version": variables["full"].strip(), "full": variables["full"].strip(), - "branch": ""} + "branch": "unknown"} def versions_from_lookup(lookup, root, verbose=False):