-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathsetup.py
41 lines (35 loc) · 1.21 KB
/
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
41
#!/usr/bin/env python3
import distutils.core
import os.path
import sys
if __name__ == "__main__":
README = "https://github.com/sbp/gin/blob/master/README.md"
if os.path.isfile("gin"):
with open("gin", "r+", encoding="ascii") as f:
f.seek(66)
version = f.read(7)
if os.path.isdir(".git") and ("sdist" in sys.argv):
patch = int(version[-3:]) + 1
if patch > 999:
raise ValueError("Update major/minor version")
version = version[:-3] + "%03i" % patch
f.seek(66)
f.write(version)
else:
print("Unable to find gin script: refusing to install")
sys.exit(1)
distutils.core.setup(
name="gin",
version=version,
author="Sean B. Palmer",
url="https://github.com/sbp/gin",
description="Git index file parser",
long_description="Documented in `@sbp/gin/README.md <%s>`_" % README,
scripts=["gin"],
platforms="Linux and OS X",
classifiers=[
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python :: 3"
]
)