Commits

Anonymous committed 193c836

Makefile: added a `make server` target for running tracd.

One can use the `python=...` variable to easily switch between Python versions, and in general benefit from the other settings made in Makefile.cfg.

Comments (0)

Files changed (2)

-# Makefile for testing Trac (see doc/dev/testing.rst)
+#          Makefile for testing Trac (see doc/dev/testing.rst)
 #
-# Some i18n tasks are also supported, see HELP below.
+#          Some i18n tasks are also supported, see HELP below.
 # ----------------------------------------------------------------------------
 #
 # Note that this is a GNU Makefile.
 
   [python=...]        variable for selecting Python version
 
-                  Testing tasks
+ ---------------- Testing tasks
 
   unit-test           run unit tests
   functional-test     run functional tests
   [db=...]            variable for selecting database backend
   [test=...]          variable for selecting a single test file
 
-                  L10N tasks
+ ---------------- Standalone test server
+
+  server              start tracd
+
+  [port=...]          variable for selecting the port
+  [auth=...]          variable for specifying authentication
+  [env=...]           variable for the trac environment or parent dir
+  [tracdopts=...]     variable containing extra options
+
+ ---------------- L10N tasks
 
   extraction          regenerate the messages.pot template file
 
 all: help
 endif
 
-
 help:
 	@echo "$$HELP"
 
 status:
+	@echo -n "Python version: "
 	@python -V
-	@echo PYTHONPATH=$$PYTHONPATH
-	@echo TRAC_TEST_DB_URI=$$TRAC_TEST_DB_URI
+	@echo "PYTHONPATH=$$PYTHONPATH"
+	@echo "TRAC_TEST_DB_URI=$$TRAC_TEST_DB_URI"
+	@echo "server-options=$(server-options)"
 
 clean:
 	find -name \*.py[co] | xargs -d"\n" --no-run-if-empty rm -f
 	rm -rf .figleaf* html
 
+# ----------------------------------------------------------------------------
+
+# Copy Makefile.cfg.sample to Makefile.cfg and adapt to your local environment.
+
+-include Makefile.cfg
+
+# ----------------------------------------------------------------------------
+
 # L10N related tasks
 
 ifdef locale
 Trac.egg-info: status
 	python setup.py egg_info
 
-# ----------------------------------------------------------------------------
+# Tracd related tasks
 
-# Copy Makefile.cfg.sample to Makefile.cfg and adapt to your local environment.
+port ?= 8000
+tracdopts ?= -r
 
--include Makefile.cfg
+define server-options
+ $(if $(port),-p $(port))\
+ $(if $(auth),-a '$(auth)')\
+ $(tracdopts)\
+ $(if $(wildcard $(env)/VERSION),$(env),-e $(env))
+endef
+
+server:
+ifdef env
+	python trac/web/standalone.py $(server-options)
+else
+	@echo "\`env' variable was not specified. See \`make help'."
+endif
 
 # ----------------------------------------------------------------------------
 ifeq "$(OS)" "Windows_NT"

Makefile.cfg.sample

 postgres.python = 26
 
 # ----------------------------------------------------------------------------
+# Settings for the test server
+
+env = ~/tracenvs
+auth = *,~/tracenvs/htdigest.realm,realm
+
+# ----------------------------------------------------------------------------
 # Custom rules 
 
 .PHONY: bigtest
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.