summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Ward <peteraward@gmail.com>2014-09-20 10:49:15 +1000
committerPeter Ward <peteraward@gmail.com>2014-09-20 10:49:15 +1000
commitcada1ca46ef5ae37c5fdde7af65252b0ba4ef2ce (patch)
tree4b822e55827d4e6cda795512d12abe6e2e18edbb
parentd92f168d0b8894df12d8e558404d375cfe327cfe (diff)
parentace2ce54a4e947250dfbab0a14ef039f9c4db147 (diff)
merge
-rw-r--r--.hgignore4
-rw-r--r--capturer.py20
-rw-r--r--real-setup.py20
-rw-r--r--requirements.txt2
-rw-r--r--setup.cfg2
-rw-r--r--setup.py56
6 files changed, 71 insertions, 33 deletions
diff --git a/.hgignore b/.hgignore
index e21f17c..5d9d8a5 100644
--- a/.hgignore
+++ b/.hgignore
@@ -1,3 +1,7 @@
syntax: glob
*~
*.py[co]
+robots.egg*
+*.c
+*.o
+*.so
diff --git a/capturer.py b/capturer.py
index 7a698ee..54b0be6 100644
--- a/capturer.py
+++ b/capturer.py
@@ -46,19 +46,7 @@ class CaptureSpawns(object):
return results
if __name__ == '__main__':
-# random.seed(42)
- map_ = robots.border_map(40, 30, 0)
-
- add_spawns(map_, 300, 'X')
- add_spawns(map_, 20, '+')
-
- for y in range(20):
- map_[y][20] = 'X'
-
- add_spawns(map_, 6)
-
- game = robots.Game(map_)
- game.add_bot(CaptureSpawns(variance=0), 'Alice')
- game.add_bot(CaptureSpawns(variance=0.01), 'Bob')
- viewer = robots.CursesViewer(game)
- viewer.run()
+ server = robots.Server()
+ server.SERVER_NAME = 'Capturer Server'
+ server.add_bot(CaptureSpawns, 'Capture')
+ server.run()
diff --git a/real-setup.py b/real-setup.py
new file mode 100644
index 0000000..5a15cf2
--- /dev/null
+++ b/real-setup.py
@@ -0,0 +1,20 @@
+from setuptools import find_packages, setup
+from Cython.Build import cythonize
+
+setup(
+ name='robots',
+ packages=find_packages(),
+ ext_modules=cythonize('robots/*.pyx'),
+ install_requires=[
+ 'blessings',
+ 'cython',
+ 'logbook',
+ 'pyzmq',
+ 'urwid'
+ ],
+ entry_points={
+ 'console_scripts': [
+ 'robots-client = robots.client:main',
+ ]
+ },
+)
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..d9b8239
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+-e ../simple-network
+-e .
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..01f6a07
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,2 @@
+[metadata]
+setup-requires = Cython
diff --git a/setup.py b/setup.py
index a1cd26e..cd079e6 100644
--- a/setup.py
+++ b/setup.py
@@ -1,18 +1,40 @@
-from setuptools import find_packages, setup
-from Cython.Build import cythonize
+#!/usr/bin/env python
+# Install dependencies from a "[metadata] setup-requires = ..." section in
+# setup.cfg, then run real-setup.py.
+# From https://bitbucket.org/dholth/setup-requires
+
+import sys, os, subprocess, codecs, pkg_resources
+
+sys.path[0:0] = ['setup-requires']
+pkg_resources.working_set.add_entry('setup-requires')
+
+try:
+ import configparser
+except:
+ import ConfigParser as configparser
+
+def get_requirements():
+ if not os.path.exists('setup.cfg'): return
+ config = configparser.ConfigParser()
+ config.readfp(codecs.open('setup.cfg', encoding='utf-8'))
+ setup_requires = config.get('metadata', 'setup-requires')
+ specifiers = [line.strip() for line in setup_requires.splitlines()]
+ for specifier in specifiers:
+ try:
+ pkg_resources.require(specifier)
+ except pkg_resources.DistributionNotFound:
+ yield specifier
+
+try:
+ to_install = list(get_requirements())
+ if to_install:
+ subprocess.call([sys.executable, "-m", "pip", "install",
+ "-t", "setup-requires"] + to_install)
+except (configparser.NoSectionError, configparser.NoOptionError):
+ pass
+
+# Run real-setup.py
+exec(compile(open("real-setup.py").read().replace('\\r\\n', '\\n'),
+ __file__,
+ 'exec'))
-setup(
- name='robots',
- packages=find_packages(),
- ext_modules=cythonize('robots/*.pyx'),
- install_requires=[
- 'flask',
- 'blessings',
- 'cython',
- ],
- entry_points={
- 'console_scripts': [
- 'robots-client = robots.client:main',
- ]
- },
-)