Release preparation.
[python-bulletml.git] / setup.py
diff --git a/setup.py b/setup.py
new file mode 100755 (executable)
index 0000000..c3b5726
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+import glob
+import os
+import shutil
+
+from distutils.core import setup
+from distutils.command.clean import clean as distutils_clean
+
+class clean(distutils_clean):
+    def run(self):
+        # In addition to what the normal clean run does, remove pyc
+        # and pyo and backup files from the source tree.
+        distutils_clean.run(self)
+        def should_remove(filename):
+            if (filename.lower()[-4:] in [".pyc", ".pyo"] or
+                filename.endswith("~") or
+                (filename.startswith("#") and filename.endswith("#"))):
+                return True
+            else:
+                return False
+        for pathname, dirs, files in os.walk(os.path.dirname(__file__)):
+            for filename in filter(should_remove, files):
+                try: os.unlink(os.path.join(pathname, filename))
+                except EnvironmentError, err:
+                    print str(err)
+
+        try: os.unlink("MANIFEST")
+        except OSError: pass
+
+        for base in ["coverage", "build", "dist"]:
+             path = os.path.join(os.path.dirname(__file__), base)
+             if os.path.isdir(path):
+                 shutil.rmtree(path)
+
+if __name__ == "__main__":
+    from bulletml import VERSION_STRING
+    setup(cmdclass=dict(clean=clean),
+          name="python-bulletml", version=VERSION_STRING,
+          url="http://code.google.com/p/python-bulletml/",
+          description="parse and run BulletML scripts",
+          author="Joe Wreschnig",
+          author_email="joe.wreschnig@gmail.com",
+          license="MIT-style",
+          packages=["bulletml"],
+          data_files=glob.glob("examples/*/*.xml") + ["examples/template/xml"],
+          scripts=["bulletml-parse", "bulletml-runner"],
+          long_description="""\
+This module parses and runs BulletML scripts. BulletML is a markup
+language for describing complex bullet patterns in shooting games.
+More information is available at the BulletML homepage,
+http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html.
+
+The module code is renderer-agnostic. A sample renderer for Pygame is
+included.
+"""
+          )