summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/_version.py100
1 files changed, 62 insertions, 38 deletions
diff --git a/src/leap/bitmask/_version.py b/src/leap/bitmask/_version.py
index 8c507c92..f032a17a 100644
--- a/src/leap/bitmask/_version.py
+++ b/src/leap/bitmask/_version.py
@@ -6,7 +6,9 @@
# that just contains the computed version number.
# This file is released into the public domain. Generated by
-# versioneer-0.15 (https://github.com/warner/python-versioneer)
+# versioneer-0.16 (https://github.com/warner/python-versioneer)
+
+"""Git implementation of _version.py."""
import errno
import os
@@ -16,6 +18,7 @@ import sys
def get_keywords():
+ """Get the keywords needed to look up the version information."""
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
@@ -27,10 +30,11 @@ def get_keywords():
class VersioneerConfig:
- pass
+ """Container for Versioneer configuration parameters."""
def get_config():
+ """Create, populate and return the VersioneerConfig() object."""
# these strings are filled in when 'setup.py versioneer' creates
# _version.py
cfg = VersioneerConfig()
@@ -44,7 +48,7 @@ def get_config():
class NotThisMethod(Exception):
- pass
+ """Exception raised if a method is not valid for the current scenario."""
LONG_VERSION_PY = {}
@@ -52,7 +56,9 @@ HANDLERS = {}
def register_vcs_handler(vcs, method): # decorator
+ """Decorator to mark a method as the handler for a particular VCS."""
def decorate(f):
+ """Store f in HANDLERS[vcs][method]."""
if vcs not in HANDLERS:
HANDLERS[vcs] = {}
HANDLERS[vcs][method] = f
@@ -61,6 +67,7 @@ def register_vcs_handler(vcs, method): # decorator
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
+ """Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
@@ -94,8 +101,11 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
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.
+ """Try to determine the version from the parent directory name.
+
+ Source tarballs conventionally unpack into a directory that includes
+ both the project name and a version string.
+ """
dirname = os.path.basename(root)
if not dirname.startswith(parentdir_prefix):
if verbose:
@@ -109,6 +119,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
@register_vcs_handler("git", "get_keywords")
def git_get_keywords(versionfile_abs):
+ """Extract version information from the given file."""
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from
@@ -133,6 +144,7 @@ def git_get_keywords(versionfile_abs):
@register_vcs_handler("git", "keywords")
def git_versions_from_keywords(keywords, tag_prefix, verbose):
+ """Get version information from git keywords."""
if not keywords:
raise NotThisMethod("no keywords at all, weird")
refnames = keywords["refnames"].strip()
@@ -178,11 +190,12 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
@register_vcs_handler("git", "pieces_from_vcs")
def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
- # this runs 'git' from the root of the source tree. This only gets called
- # if the git-archive 'subst' keywords were *not* expanded, and
- # _version.py hasn't already been rewritten with a short version string,
- # meaning we're inside a checked out source tree.
+ """Get version from 'git describe' in the root of the source tree.
+ This only gets called if the git-archive 'subst' keywords were *not*
+ expanded, and _version.py hasn't already been rewritten with a short
+ version string, meaning we're inside a checked out source tree.
+ """
if not os.path.exists(os.path.join(root, ".git")):
if verbose:
print("no .git in %s" % root)
@@ -191,10 +204,11 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
- # if there is a tag, this yields TAG-NUM-gHEX[-dirty]
- # if there are no tags, this yields HEX[-dirty] (no NUM)
+ # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
+ # if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out = run_command(GITS, ["describe", "--tags", "--dirty",
- "--always", "--long"],
+ "--always", "--long",
+ "--match", "%s*" % tag_prefix],
cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
@@ -259,19 +273,21 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
def plus_or_dot(pieces):
+ """Return a + if we don't already have one, else return a ."""
if "+" in pieces.get("closest-tag", ""):
return "."
return "+"
def render_pep440(pieces):
- # now build up version string, with post-release "local version
- # identifier". Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
- # get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
+ """Build up version string, with post-release "local version identifier".
- # exceptions:
- # 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
+ Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
+ get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
+ Exceptions:
+ 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
+ """
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
@@ -289,11 +305,11 @@ def render_pep440(pieces):
def render_pep440_pre(pieces):
- # TAG[.post.devDISTANCE] . No -dirty
-
- # exceptions:
- # 1: no tags. 0.post.devDISTANCE
+ """TAG[.post.devDISTANCE] -- No -dirty.
+ Exceptions:
+ 1: no tags. 0.post.devDISTANCE
+ """
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
@@ -305,14 +321,15 @@ def render_pep440_pre(pieces):
def render_pep440_post(pieces):
- # TAG[.postDISTANCE[.dev0]+gHEX] . The ".dev0" means dirty. Note that
- # .dev0 sorts backwards (a dirty tree will appear "older" than the
- # corresponding clean one), but you shouldn't be releasing software with
- # -dirty anyways.
+ """TAG[.postDISTANCE[.dev0]+gHEX] .
- # exceptions:
- # 1: no tags. 0.postDISTANCE[.dev0]
+ The ".dev0" means dirty. Note that .dev0 sorts backwards
+ (a dirty tree will appear "older" than the corresponding clean one),
+ but you shouldn't be releasing software with -dirty anyways.
+ Exceptions:
+ 1: no tags. 0.postDISTANCE[.dev0]
+ """
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
@@ -331,11 +348,13 @@ def render_pep440_post(pieces):
def render_pep440_old(pieces):
- # TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty.
+ """TAG[.postDISTANCE[.dev0]] .
- # exceptions:
- # 1: no tags. 0.postDISTANCE[.dev0]
+ The ".dev0" means dirty.
+ Eexceptions:
+ 1: no tags. 0.postDISTANCE[.dev0]
+ """
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
@@ -351,12 +370,13 @@ def render_pep440_old(pieces):
def render_git_describe(pieces):
- # TAG[-DISTANCE-gHEX][-dirty], like 'git describe --tags --dirty
- # --always'
+ """TAG[-DISTANCE-gHEX][-dirty].
- # exceptions:
- # 1: no tags. HEX[-dirty] (note: no 'g' prefix)
+ Like 'git describe --tags --dirty --always'.
+ Exceptions:
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
+ """
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
@@ -370,12 +390,14 @@ def render_git_describe(pieces):
def render_git_describe_long(pieces):
- # TAG-DISTANCE-gHEX[-dirty], like 'git describe --tags --dirty
- # --always -long'. The distance/hash is unconditional.
+ """TAG-DISTANCE-gHEX[-dirty].
- # exceptions:
- # 1: no tags. HEX[-dirty] (note: no 'g' prefix)
+ Like 'git describe --tags --dirty --always -long'.
+ The distance/hash is unconditional.
+ Exceptions:
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
+ """
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
@@ -388,6 +410,7 @@ def render_git_describe_long(pieces):
def render(pieces, style):
+ """Render the given version pieces into the requested style."""
if pieces["error"]:
return {"version": "unknown",
"full-revisionid": pieces.get("long"),
@@ -417,6 +440,7 @@ def render(pieces, style):
def get_versions():
+ """Get version information or return default if unable to do so."""
# I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
# __file__, we can work backwards from there to the root. Some
# py2exe/bbfreeze/non-CPython implementations don't do __file__, in which