-
Notifications
You must be signed in to change notification settings - Fork 22
/
setup.py
executable file
·76 lines (63 loc) · 2.26 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# http://inamidst.com/saxo/
# Created by Sean B. Palmer
# python3 setup.py sdist --formats=bztar
# python3 setup.py bdist_wheel
import os.path
import sys
def error(*messages):
for message in messages:
print(message, file=sys.stderr)
sys.exit(1)
try: from setuptools import setup
except ImportError as err:
if "bdist_wheel" in sys.argv:
error("Option bdist_wheel requires setuptools, which can't be found")
from distutils.core import setup
try: import sqlite3
except ImportError:
error("Error: sqlite3 is not installed",
"Please build Python against the sqlite libraries")
else:
if not sqlite3.threadsafety:
error("Error: Your sqlite3 is not thread-safe")
# Do wheels invoke setup.py?
if sys.version_info < (3, 3):
error("Error: Requires Python 3.3 or later")
def update_version():
if os.path.isfile("version"):
with open("version", "r", encoding="ascii") as f:
version = f.read().rstrip("\r\n")
if os.path.isdir(".git") and ("sdist" in sys.argv):
major, minor, serial = [int(n) for n in version.split(".")]
version = "%s.%s.%s" % (major, minor, serial + 1)
with open("version", "w", encoding="ascii") as f:
f.write(version)
else:
error("Error: No saxo version file found")
return version
# http://stackoverflow.com/questions/4384796
# http://packages.python.org/distribute/
if __name__ == "__main__":
README = "https://github.com/sbp/saxo/blob/master/README.md"
setup(
name="saxo",
version=update_version(),
author="Sean B. Palmer",
url="http://inamidst.com/saxo/",
description="Quick and flexible irc bot, extensible in any language",
long_description="Documented in `@sbp/saxo/README.md <%s>`_" % README,
license="Apache License 2.0",
packages=["saxo"],
package_dir={"saxo": "."},
package_data={"saxo": [
"README.md", "NOTICE", "version",
"commands/*", "plugins/*", "test/*"
]},
scripts=["saxo"],
platforms="Linux and OS X",
classifiers=[
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python :: 3"
]
)