增加setup.py 文件
setuptools文档
setup.py样例
from setuptools import setup, find_packages
def sh(command):
try:
if isinstance(command, list):
command = ' '.join(command)
return subprocess.check_output(
command, shell=True,
stderr=subprocess.STDOUT).decode('utf-8').rstrip()
except Exception as e:
return None
VERSION = 'major.minor.patch'
git_branch = sh('git rev-parse --abbrev-ref HEAD')
git_commit_hash = sh('git log -1 --format=%h')
git_commit_count = sh('git rev-list --count HEAD')
git_diff_name_only = sh('git diff --name-only')
if git_diff_name_only:
git_diff_name_only = git_diff_name_only.replace('
', ',')
# this is a hack, the easiest way I found to inject these metedata
with open('w