summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile39
-rwxr-xr-xall_tests.py10
-rwxr-xr-xmake_doc.py28
3 files changed, 48 insertions, 29 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..c2393415
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+PYTHON = python
+DOCDIR = doc/pydoc
+CWD = $(shell pwd)
+
+.PHONY: all clean doc cleandoc edit push test commit install
+
+all: clean test
+
+doc: cleandoc
+	mkdir -p $(DOCDIR)
+	cd $(DOCDIR); \
+		$(PYTHON) -c 'import pydoc, sys; \
+		sys.path[0] = "$(CWD)"; \
+		pydoc.writedocs("$(CWD)")'
+
+install:
+	@less -XF INSTALL
+
+cleandoc:
+	test -d $(DOCDIR) && rm -f $(DOCDIR)/*.html
+
+clean:
+	find . -regex .\*.pyc$ | xargs rm
+
+test:
+	./all_tests.py
+
+edit:
+	@vi ranger.py $(shell find ranger test -regex .\*py$ )
+
+push:
+	@for repo in $(shell git remote); do \
+		echo "Pushing to $$repo..."; \
+		git push $$repo master; \
+		git push $$repo -f hut; \
+	done
+
+commit:
+	@git citool
diff --git a/all_tests.py b/all_tests.py
index 33b16f7f..6693b870 100755
--- a/all_tests.py
+++ b/all_tests.py
@@ -3,6 +3,12 @@
 if __name__ == '__main__':
 	import unittest
 	from test import *
+	from sys import exit, argv
+
+	try:
+		verbosity = int(argv[1])
+	except IndexError:
+		verbosity = 2
 
 	tests = []
 	for key, val in vars().copy().items():
@@ -10,4 +16,6 @@ if __name__ == '__main__':
 			tests.extend(v for k,v in vars(val).items() if type(v) == type)
 
 	suite = unittest.TestSuite(map(unittest.makeSuite, tests))
-	unittest.TextTestRunner(verbosity=2).run(suite)
+	result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
+	if len(result.errors) + len(result.failures) > 0:
+		exit(1)
diff --git a/make_doc.py b/make_doc.py
deleted file mode 100755
index d59ac73b..00000000
--- a/make_doc.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/python
-"""Generate pydoc documentation and move it to the doc directory.
-THIS WILL DELETE ALL EXISTING HTML FILES IN THAT DIRECTORY, so don't
-store important content there."""
-
-import pydoc, os, sys
-if __name__ == '__main__':
-	docdir = 'doc/pydoc'
-	os.chdir(sys.path[0])
-	try: os.mkdir(docdir)
-	except: pass
-
-
-	for fname in os.listdir(docdir):
-		if fname.endswith('.html'):
-			os.remove(os.path.join(docdir, fname))
-
-	pydoc.writedocs('.')
-	pydoc.writedoc('curses')
-	pydoc.writedoc('curses.ascii')
-	pydoc.writedoc('os')
-	pydoc.writedoc('os.path')
-	pydoc.writedoc('sys')
-
-	for fname in os.listdir('.'):
-		if fname.endswith('.html'):
-			os.rename(fname, os.path.join(docdir, fname))
-
id='n221' href='#n221'>221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312