diff --git a/CHANGELOG.md b/CHANGELOG.md index 153032cc..3e5f0227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -187,6 +187,16 @@ ([Commits](https://github.com/foosel/OctoPrint/compare/master...devel)) +## 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):