Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 111 lines (92 sloc) 3.542 kB
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
1 #!/usr/bin/env python
2
a53b846 @dripton Bump copyright dates on recently changed files.
authored
3 __copyright__ = "Copyright (c) 2009-2012 David Ripton"
aac8ce6 @dripton Update copyrights on recently changed files.
authored
4 __license__ = "GNU GPL v2"
5
6
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
7 from glob import glob
8 from distutils.core import setup
9 from distutils.command.install_data import install_data
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
10 import subprocess
11 import datetime
b55a914 @dripton Use git.exe instead of git on Windows.
authored
12 import sys
e76722b @dripton Make setup.py work from any directory
authored
13 import os
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
14
15
b811e26 @dripton Bump version to 0.1
authored
16 VERSION = "0.1"
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
17
6452e70 @dripton PEP8 OCD whitespace commit
authored
18
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
19 class install_data_twisted(install_data):
20 """Make sure data files are installed in package.
21
22 Yuck. Taken from an old version of Twisted's setup.py.
23 """
24 def finalize_options(self):
25 self.set_undefined_options("install",
243ca6a @dripton Appease pep8
authored
26 ("install_lib", "install_dir"),
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
27 )
28 install_data.finalize_options(self)
29
6452e70 @dripton PEP8 OCD whitespace commit
authored
30
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
31 def head_commit():
32 """Return the current commit of HEAD, or "" on failure."""
b55a914 @dripton Use git.exe instead of git on Windows.
authored
33 if sys.platform == "win32":
34 GIT = "git.exe"
35 else:
36 GIT = "git"
37 cmd = [GIT, "rev-list", "--max-count=1", "HEAD"]
38 try:
39 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
40 stdout, unused = proc.communicate()
41 except Exception:
42 return ""
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
43 if proc.returncode != 0:
44 return ""
45 if stdout:
46 return stdout.strip()
47 else:
48 return ""
49
6452e70 @dripton PEP8 OCD whitespace commit
authored
50
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
51 def timestamp():
52 """Return the current UTC time in YYYYMMDDhhmmss form."""
53 utcnow = datetime.datetime.utcnow()
54 return utcnow.strftime("%Y%m%d%H%M%S")
55
6452e70 @dripton PEP8 OCD whitespace commit
authored
56
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
57 def write_version_file():
58 """Dump a file containing the version, timestamp, and commit to
59 docs/version.txt"""
60 version = "%s-%s-%s" % (VERSION, timestamp(), head_commit()[:7])
61 # Need to use a relative path here because we may not have installed yet.
556a6d6 @dripton whitespace
authored
62 with open("slugathon/docs/version.txt", "w") as fil:
7a4b639 @dripton Use a with statement to close the file.
authored
63 fil.write("%s\n" % version)
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
64
e76722b @dripton Make setup.py work from any directory
authored
65
66 # cd to the location of the setup.py file so relative paths work.
67 os.chdir(os.path.dirname(os.path.realpath(__file__)))
68
c26c122 @dripton Set the version number to 0.1a1 Closes #13
authored
69 write_version_file()
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
70
71 setup(
6452e70 @dripton PEP8 OCD whitespace commit
authored
72 name="slugathon",
73 version="%s-%s-%s" % (VERSION, timestamp(), head_commit()[:7]),
56d9b59 @dripton Update description
authored
74 description="Fantasy battle board game",
6452e70 @dripton PEP8 OCD whitespace commit
authored
75 author="David Ripton",
76 author_email="d+slugathon@ripton.net",
fac30d9 @dripton Add download URL, and make URL https.
authored
77 url="https://github.com/dripton/Slugathon/",
5027075 @dripton Update download_url to try to fix pip install.
authored
78 download_url="https://github.com/dripton/Slugathon/zipball/master",
6452e70 @dripton PEP8 OCD whitespace commit
authored
79 license="GPLv2",
80 packages=["slugathon", "slugathon.ai", "slugathon.data",
9c22d4a @dripton Install slugathon.ai package
authored
81 "slugathon.game", "slugathon.gui", "slugathon.net", "slugathon.util"],
6452e70 @dripton PEP8 OCD whitespace commit
authored
82 data_files=[
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
83 ("slugathon/images/battlehex", glob("slugathon/images/battlehex/*")),
84 ("slugathon/images/creature", glob("slugathon/images/creature/*")),
85 ("slugathon/images/dice", glob("slugathon/images/dice/*")),
86 ("slugathon/images/legion", glob("slugathon/images/legion/*")),
87 ("slugathon/images/masterhex", glob("slugathon/images/masterhex/*")),
88 ("slugathon/config", glob("slugathon/config/*")),
89 ("slugathon/docs", glob("slugathon/docs/*")),
90 ],
6452e70 @dripton PEP8 OCD whitespace commit
authored
91 scripts=[
27f186d @dripton Switch from three scripts and three spec files to one of each.
authored
92 "bin/slugathon",
a66d05b @dripton Script to run a bunch of all-AI games. Fixes #150
authored
93 "bin/stresstest-slugathon",
3b8ec06 @dripton Script to mass-set ai passwords, for stresstesting
authored
94 "bin/set-all-slugathon-ai-passwords",
3a687d2 @dripton Add slugathon-aiclient script.
authored
95 ],
6452e70 @dripton PEP8 OCD whitespace commit
authored
96 classifiers=[
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
97 "Development Status :: 3 - Alpha",
573727e @dripton Update Trove classifiers
authored
98 "Environment :: X11 Applications :: GTK",
99 "Framework :: Twisted",
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
100 "Intended Audience :: End Users/Desktop",
101 "License :: OSI Approved :: GNU General Public License (GPL)",
102 "Operating System :: OS Independent",
103 "Programming Language :: Python",
573727e @dripton Update Trove classifiers
authored
104 "Programming Language :: Python :: 2",
105 "Programming Language :: Python :: 2.6",
106 "Programming Language :: Python :: 2.7",
107 "Topic :: Games/Entertainment :: Board Games",
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
108 ],
6452e70 @dripton PEP8 OCD whitespace commit
authored
109 cmdclass={"install_data": install_data_twisted},
f2bc414 @dripton Move code into sub-packages and add an installer.
authored
110 )
Something went wrong with that request. Please try again.