Dropped text docs generation

This commit is contained in:
Daniele Varrazzo 2019-02-17 01:48:33 +01:00
parent e5e8cec350
commit f70d6fd0ed
5 changed files with 5 additions and 83 deletions

View File

@ -50,12 +50,10 @@ all: package sdist
package: $(PLATLIB) $(PURELIB)
docs: docs-html docs-txt
docs: docs-html
docs-html: doc/html/genindex.html
docs-txt: doc/psycopg2.txt
# for PyPI documentation
docs-zip: doc/docs.zip
@ -98,9 +96,6 @@ $(SDIST): $(SOURCE)
doc/html/genindex.html: $(PLATLIB) $(PURELIB) $(SOURCE_DOC)
$(MAKE) -C doc html
doc/psycopg2.txt: $(PLATLIB) $(PURELIB) $(SOURCE_DOC)
$(MAKE) -C doc text
doc/docs.zip: doc/html/genindex.html
(cd doc/html && zip -r ../docs.zip *)

View File

@ -1,6 +1,6 @@
.PHONY: env help clean html text doctest
.PHONY: env help clean html doctest
docs: html text
docs: html
check: doctest
@ -18,11 +18,6 @@ html: src/sqlstate_errors.rst
$(MAKE) $(SPHOPTS) -C src $@
cp -r src/_build/html .
text: src/sqlstate_errors.rst
$(MAKE) PYTHON=$(PYTHON) -C .. package
$(MAKE) $(SPHOPTS) -C src $@
cd src && tools/stitch_text.py index.rst _build/text > ../psycopg2.txt
src/sqlstate_errors.rst: ../psycopg/sqlstate_errors.h
PYTHONPATH=`pwd`/../build/lib.$(PYTHON_VERSION) $(PYTHON) src/tools/make_sqlstate_docs.py $< > $@
@ -36,7 +31,7 @@ upload:
clean:
$(MAKE) $(SPHOPTS) -C src $@
rm -rf html psycopg2.txt src/sqlstate_errors.rst
rm -rf html src/sqlstate_errors.rst
env: requirements.txt
virtualenv env

View File

@ -17,10 +17,4 @@ Then you can build the documentation with::
make
Or the single targets::
make html
make text
You should find the rendered documentation in the ``html`` dir and the text
file ``psycopg2.txt``.
You should find the rendered documentation in the ``html`` directory.

View File

@ -1,61 +0,0 @@
#! /usr/bin/env python
"""A script to stitch together the generated text files in the correct order.
"""
import os
import sys
def main():
if len(sys.argv) != 3:
sys.stderr.write("usage: %s index.rst text-dir\n")
return 2
_, index, txt_dir = sys.argv
for fb in iter_file_base(index):
emit(fb, txt_dir)
return 0
def iter_file_base(fn):
f = open(fn)
while not next(f).startswith('.. toctree'):
pass
while next(f).strip().startswith(':'):
pass
yield os.path.splitext(os.path.basename(fn))[0]
n = 0
while True:
line = next(f)
if line.isspace():
continue
if line.startswith(".."):
break
n += 1
yield line.strip()
f.close()
if n < 5:
# maybe format changed?
raise Exception("Not enough files found. Format change in index.rst?")
def emit(basename, txt_dir):
f = open(os.path.join(txt_dir, basename + ".txt"))
for line in f:
line = line.replace("``", "'")
sys.stdout.write(line)
f.close()
# some space between sections
sys.stdout.write("\n\n")
if __name__ == '__main__':
sys.exit(main())

View File

@ -142,7 +142,6 @@
<None Include="doc\src\usage.rst" />
<None Include="doc\src\tools\lib\dbapi_extension.py" />
<None Include="doc\src\tools\lib\sql_role.py" />
<None Include="doc\src\tools\stitch_text.py" />
<None Include="doc\src\_static\psycopg.css" />
<None Include="doc\src\faq.rst" />
<None Include="tests\test_async.py" />