diff --git a/Makefile b/Makefile index ce9063d0..68eaf14a 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # # Build the documentation:: # -# make env +# make env (once) # make docs # # Create a source package:: @@ -20,9 +20,6 @@ PYTHON := python$(PYTHON_VERSION) PYTHON_VERSION ?= $(shell $(PYTHON) -c 'import sys; print ("%d.%d" % sys.version_info[:2])') BUILD_DIR = $(shell pwd)/build/lib.$(PYTHON_VERSION) -ENV_DIR = $(shell pwd)/env/py-$(PYTHON_VERSION) -ENV_BIN = $(ENV_DIR)/bin -ENV_LIB = $(ENV_DIR)/lib SOURCE_C := $(wildcard psycopg/*.c psycopg/*.h) SOURCE_PY := $(wildcard lib/*.py) @@ -46,9 +43,6 @@ endif VERSION := $(shell grep PSYCOPG_VERSION setup.py | head -1 | sed -e "s/.*'\(.*\)'/\1/") SDIST := dist/psycopg2-$(VERSION).tar.gz -EASY_INSTALL = PYTHONPATH=$(ENV_LIB) $(ENV_BIN)/easy_install-$(PYTHON_VERSION) -d $(ENV_LIB) -s $(ENV_BIN) -EZ_SETUP = $(ENV_BIN)/ez_setup.py - .PHONY: env check clean default: package @@ -68,22 +62,8 @@ docs-zip: doc/docs.zip sdist: $(SDIST) -# The environment is currently required to build the documentation. -# It is not clean by 'make clean' - -env: easy_install - mkdir -p $(ENV_BIN) - mkdir -p $(ENV_LIB) - $(EASY_INSTALL) docutils - $(EASY_INSTALL) sphinx - -easy_install: ez_setup - PYTHONPATH=$(ENV_LIB) $(PYTHON) $(EZ_SETUP) -d $(ENV_LIB) -s $(ENV_BIN) setuptools - -ez_setup: - mkdir -p $(ENV_BIN) - mkdir -p $(ENV_LIB) - wget -O $(EZ_SETUP) http://peak.telecommunity.com/dist/ez_setup.py +env: + $(MAKE) -C doc $@ check: PYTHONPATH=$(BUILD_DIR):$(PYTHONPATH) $(PYTHON) -c "from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')" --verbose @@ -122,10 +102,10 @@ MANIFEST: MANIFEST.in $(SOURCE) # docs depend on the build as it partly use introspection. doc/html/genindex.html: $(PLATLIB) $(PURELIB) $(SOURCE_DOC) - PYTHONPATH=$(ENV_LIB):$(BUILD_DIR):$$PYTHONPATH $(MAKE) SPHINXBUILD=$(ENV_BIN)/sphinx-build -C doc html + PYTHONPATH=:$(BUILD_DIR):$$PYTHONPATH $(MAKE) -C doc html doc/psycopg2.txt: $(PLATLIB) $(PURELIB) $(SOURCE_DOC) - PYTHONPATH=$(ENV_LIB):$(BUILD_DIR):$$PYTHONPATH $(MAKE) SPHINXBUILD=$(ENV_BIN)/sphinx-build -C doc text + PYTHONPATH=$(BUILD_DIR):$$PYTHONPATH $(MAKE) -C doc text doc/docs.zip: doc/html/genindex.html (cd doc/html && zip -r ../docs.zip *) diff --git a/doc/Makefile b/doc/Makefile index 54b59232..6d639526 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,23 +1,30 @@ -.PHONY: help clean html text doctest +.PHONY: env help clean html text doctest docs: html text check: doctest +# The environment is currently required to build the documentation. +# It is not clean by 'make clean' + help: - cd src && $(MAKE) $@ + $(MAKE) SPHINXBUILD=$$(pwd)/env/bin/sphinx-build -C src $@ html: - cd src && $(MAKE) $@ + $(MAKE) SPHINXBUILD=$$(pwd)/env/bin/sphinx-build -C src $@ cp -r src/_build/html . text: - cd src && $(MAKE) $@ + $(MAKE) SPHINXBUILD=$$(pwd)/env/bin/sphinx-build -C src $@ cd src && tools/stitch_text.py index.rst _build/text > ../psycopg2.txt doctest: - cd src && $(MAKE) $@ + $(MAKE) SPHINXBUILD=$$(pwd)/env/bin/sphinx-build -C src $@ clean: - cd src && $(MAKE) $@ + $(MAKE) SPHINXBUILD=$$(pwd)/env/bin/sphinx-build -C src $@ rm -rf html psycopg2.txt + +env: requirements.txt + virtualenv env + ./env/bin/pip install -r requirements.txt diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 00000000..b5323e79 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,3 @@ +# Packages only needed to build the docs +Pygments>=1.5 +Sphinx>=1.2,<=1.3