Commits

Tay Ray Chuan  committed e525722 Merge

Merge shift of store config to sphinx's conf.py

Closes #1100.

  • Participants
  • Parent commits 1b605c8, 2982016

Comments (0)

Files changed (2)

File docs/Makefile

 # Makefile for Sphinx documentation
 #
-# Typical usage for Satchmo:
-# make DJANGO_SETTINGS_MODULE=simplestore.settings ROOT_DIR=/path/to/satchmo-working/ html
 
 # You can set these variables from the command line.
 SPHINXOPTS    =
 SPHINXBUILD   = sphinx-build
 PAPER         =
-ROOT_DIR =
 
 # Internal variables.
 PAPEROPT_a4     = -D latex_paper_size=a4
 PAPEROPT_letter = -D latex_paper_size=letter
 ALLSPHINXOPTS   = -d .build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
 
-.PHONY: help clean sphinx-autodoc html web pickle htmlhelp latex changes linkcheck
+.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
 
 help:
 	@echo "Please use \`make <target>' where <target> is one of"
 	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
 	@echo "  changes   to make an overview over all changed/added/deprecated items"
 	@echo "  linkcheck to check all external links for integrity"
-	@echo ""
-	@echo "Ensure also that ROOT_DIR is defined (the absolute path to the directory"
-	@echo "containing satchmo's apps and projects, usually the parent directory of"
-	@echo "this file)."
 
 clean:
 	-rm -rf .build/*
 
-sphinx-autodoc:
-#
-# Set up a django/satchmo store for sphinx's autodoc.
-#
-
-# You *must* set this variable from the command line.
-ifeq ($(ROOT_DIR),)
-	@echo "Please define ROOT_DIR (the absolute path to the directory containing"
-	@echo "satchmo's apps and projects, usually the parent directory of this file)."
-	@exit 2
-endif
-
-# Fallback on the "simple" sample store.
-ifeq ($(DJANGO_SETTINGS_MODULE),)
-export DJANGO_SETTINGS_MODULE = simple.settings
-endif
-
-# The separator used in PATH.
-# Use ":" unless WINDOWS is defined (use ";" instead).
-#
-# Indent with space here instead of tabs so that make doesn't treat lines as a
-# shell command.
-ifdef WINDOWS
-PATHSEP = \;
-else
-PATHSEP = :
-endif
-
-# Paths
-SATCHMO_APPS = $(ROOT_DIR)/apps
-PROJECT_DIR = $(ROOT_DIR)/projects
-
-# Set them in the environment so that the sphinx child process find
-# satchmo and friends.
-export PYTHONPATH = $(shell echo $$PYTHONPATH)$(PATHSEP)$(SATCHMO_APPS)$(PATHSEP)$(PROJECT_DIR)
-
-html: sphinx-autodoc
+html:
 	mkdir -p .build/html .build/doctrees
 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) .build/html
 	@echo
 	@echo "Build finished. The HTML pages are in .build/html."
 
-pickle: sphinx-autodoc
+pickle:
 	mkdir -p .build/pickle .build/doctrees
 	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) .build/pickle
 	@echo
 
 web: pickle
 
-htmlhelp: sphinx-autodoc
+htmlhelp:
 	mkdir -p .build/htmlhelp .build/doctrees
 	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) .build/htmlhelp
 	@echo
 	@echo "Build finished; now you can run HTML Help Workshop with the" \
 	      ".hhp project file in .build/htmlhelp."
 
-latex: sphinx-autodoc
+latex:
 	mkdir -p .build/latex .build/doctrees
 	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) .build/latex
 	@echo
 	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
 	      "run these through (pdf)latex."
 
-changes: sphinx-autodoc
+changes:
 	mkdir -p .build/changes .build/doctrees
 	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) .build/changes
 	@echo
 	@echo "The overview file is in .build/changes."
 
-linkcheck: sphinx-autodoc
+linkcheck:
 	mkdir -p .build/linkcheck .build/doctrees
 	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) .build/linkcheck
 	@echo

File docs/conf.py

 # documentation root, use os.path.abspath to make it absolute, like shown here.
 #sys.path.append(os.path.abspath('.'))
 
+# Add satchmo apps.
+sys.path.append(os.path.abspath('../satchmo/apps'))
+
+# Setup the 'simple' store.
+sys.path.append(os.path.abspath('../satchmo/projects'))
+os.environ['DJANGO_SETTINGS_MODULE'] = 'simple.settings'
+
 # -- General configuration -----------------------------------------------------
 
 # Add any Sphinx extension module names here, as strings. They can be extensions