def update_version_py(): if not os.path.isdir(".git"): print_("This does not appear to be a Git repository.") return try: p = subprocess.Popen(["git", "describe", "--tags", "--dirty", "--always"], stdout=subprocess.PIPE) except EnvironmentError: print_("unable to run git, leaving ecdsa/_version.py alone") return stdout = p.communicate()[0] if p.returncode != 0: print_("unable to run git, leaving ecdsa/_version.py alone") return # we use tags like "python-ecdsa-0.5", so strip the prefix assert stdout.startswith("python-ecdsa-") ver = stdout[len("python-ecdsa-"):].strip() f = open("ecdsa/_version.py", "w") f.write(VERSION_PY % ver) f.close() print_("set ecdsa/_version.py to '%s'" % ver)
def update_version_py(): if not os.path.isdir(".git"): print_("This does not appear to be a Git repository.") return try: p = subprocess.Popen( ["git", "describe", "--tags", "--dirty", "--always"], stdout=subprocess.PIPE) except EnvironmentError: print_("unable to run git, leaving ecdsa/_version.py alone") return stdout = p.communicate()[0] if p.returncode != 0: print_("unable to run git, leaving ecdsa/_version.py alone") return # we use tags like "python-ecdsa-0.5", so strip the prefix assert stdout.startswith("python-ecdsa-") ver = stdout[len("python-ecdsa-"):].strip() f = open("ecdsa/_version.py", "w") f.write(VERSION_PY % ver) f.close() print_("set ecdsa/_version.py to '%s'" % ver)
def run(self): update_version_py() print_("Version is now", get_version())