mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +03:00
Use virtualenv as build environment for the docs
This commit is contained in:
parent
4a4e0d8f9a
commit
f7ee006bef
30
Makefile
30
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 *)
|
||||
|
|
19
doc/Makefile
19
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
|
||||
|
|
3
doc/requirements.txt
Normal file
3
doc/requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Packages only needed to build the docs
|
||||
Pygments>=1.5
|
||||
Sphinx>=1.2,<=1.3
|
Loading…
Reference in New Issue
Block a user