-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
40 lines (28 loc) · 933 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import re
import subprocess
from setuptools import setup
def _get_git_description():
try:
return subprocess.check_output(["git", "describe"]).decode("utf-8").strip()
except subprocess.CalledProcessError:
return None
def get_version():
description = _get_git_description()
match = re.match(r'(?P<tag>[\d\.]+)-(?P<offset>[\d]+)-(?P<sha>\w{8})', description)
if match:
version = "{tag}.post{offset}".format(**match.groupdict())
else:
version = description
return version
def main():
setup(
name="open-repo",
url="https://github.com/DoWhileGeek/open-repo",
description="A command line utility for opening a repositories remote homepage.",
author="Joeseph Rodrigues",
author_email="[email protected]",
version=get_version(),
scripts=["open-repo", "open-pr"]
)
if __name__ == "__main__":
main()