def run(self): # create the git_version module if determine_git_version.in_git_repository(): log.info("generating bcv/git_version.py") try: git_version_fileobj = open("bcv/git_version.py", "w") determine_git_version.write_git_version(git_version_fileobj) finally: git_version_fileobj.close() else: log.info("not in git checkout; writing empty bcv/git_version.py") try: git_version_fileobj = open("bcv/git_version.py", "w") determine_git_version.write_empty_git_version(git_version_fileobj) finally: git_version_fileobj.close() # now run sdist sdist.sdist.run(self)
def run(self): # create the git_version module if determine_git_version.in_git_repository(): try: log.info("generating bcv/git_version.py") git_version_fileobj = open("bcv/git_version.py", "w") determine_git_version.write_git_version(git_version_fileobj) finally: git_version_fileobj.close() elif os.path.exists("bcv/git_version.py"): # We're probably being built from a release tarball; don't overwrite log.info("not in git checkout; using existing bcv/git_version.py") else: log.info("not in git checkout; writing empty bcv/git_version.py") try: git_version_fileobj = open("bcv/git_version.py", "w") determine_git_version.write_empty_git_version(git_version_fileobj) finally: git_version_fileobj.close() # resume normal build procedure build_py.build_py.run(self)