~andrewsomething/bzr/debian-build-sphinx-docs

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Andrew Starr-Bochicchio
  • Date: 2012-12-19 23:12:31 UTC
  • Revision ID: a.starr.b@gmail.com-20121219231231-xu301y4la8dbx6lf
* Build Sphinx-based docs rather than the plain html ones.
  The fixes a number of outstanding doc related bugs:
 - Closes: #670526, #606009
 - LP: #544149, LP: #1014572, LP: #514609

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
pythonpath_dbg = $$(ls -d $(CURDIR)/build/lib_d.*-$(1) 2>/dev/null || ls -d $(CURDIR)/build/lib.*$(1)-pydebug)
11
11
 
12
12
%:
13
 
        dh --with python2 --buildsystem=python_distutils $*
 
13
        dh $* --with python2,sphinxdoc --buildsystem=python_distutils
14
14
 
15
15
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
16
16
CONCURRENCY = BZR_CONCURRENCY=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
29
29
 
30
30
override_dh_auto_clean:
31
31
        dh_auto_clean
32
 
        $(MAKE) clean-docs
33
32
        rm -rf debian/bzrhome
34
33
        rm -f bzrlib/*_pyx.c
 
34
        # 'make clean-sphinx' calls Makefiles in sub-directories that are
 
35
        # created only after calling 'make docs-sphinx'. Check for them first.
 
36
        if [ -f doc/es/Makefile ]; then $(MAKE) clean-sphinx; fi
 
37
        # It also doesn't really clean every thing...
 
38
        ls doc/en/user-reference/*txt | grep -v readme.txt | xargs rm -rf
 
39
        rm -rf doc/developers/make.bat \
 
40
                doc/es/make.bat \
 
41
                doc/ja/make.bat \
 
42
                doc/ru/make.bat \
 
43
                doc/developers/Makefile \
 
44
                doc/es/Makefile \
 
45
                doc/ja/Makefile \
 
46
                doc/ru/Makefile \
 
47
                doc/*/_build/ \
 
48
                doc/en/release-notes/index.txt
35
49
 
36
50
override_dh_install:
37
51
        find debian/tmp/ -name "*.pyc" | xargs rm -f
49
63
        fi;
50
64
        dh_install --list-missing --fail-missing
51
65
        # Install the documentation; since html and txt and intermixed
52
 
        # under doc/, this is handier than trying to do it from bzr-doc.install. 
53
 
        for ext in txt html; do \
54
 
            ( cd doc && find -name "*.$$ext" -print0 ) | \
55
 
                xargs -r0 -i'{}' -n1 install -D -m 644 'doc/{}' \
56
 
                "debian/bzr-doc/usr/share/doc/bzr/$$ext/{}"; \
57
 
        done
58
 
        rm debian/bzr-doc/usr/share/doc/bzr/txt/*/*/licence.txt
59
 
        # Install images as well
60
 
        ( cd doc && find -name "*.png" -print0 ) | \
61
 
            xargs -r0 -i'{}' -n1 install -D -m 644 'doc/{}' \
62
 
            "debian/bzr-doc/usr/share/doc/bzr/html/{}"
 
66
        # under doc/, this is handier than trying to do it from bzr-doc.install.
 
67
        ( cd doc && find -name "*.txt" -not -wholename "*/_build/*" -print0 ) | \
 
68
                xargs -r0 -i'{}' -n1 install -D -m 644 'doc/{}' \
 
69
                "debian/bzr-doc/usr/share/doc/bzr/txt/{}"
63
70
 
64
71
override_dh_auto_build:
65
72
        dh_auto_build
66
 
        $(MAKE) docs
 
73
        $(MAKE) docs-sphinx
67
74
 
68
75
override_dh_compress:
69
76
        dh_compress -X.xvg -X.pdf
70
77
 
71
78
override_dh_strip:
72
79
        dh_strip -ppython-bzrlib --dbg-package=python-bzrlib-dbg
 
80
 
 
81
override_dh_link:
 
82
        # symlink identical resources.
 
83
        cd debian/bzr-doc/usr/share/doc && fdupes -rnq . | while read line; do \
 
84
                if [ -z "$$line" ]; then \
 
85
                        target=""; \
 
86
                elif [ -z "$$target" ]; then \
 
87
                        target=$$line; \
 
88
                else \
 
89
                        echo "symlinking duplicate file '$$line' to '$$target'"; \
 
90
                        ln -sf /usr/share/doc/"$$target" "$$line"; \
 
91
                fi; \
 
92
        done
 
93
        dh_link
 
94
 
 
95
override_dh_sphinxdoc:
 
96
        dh_sphinxdoc -X searchtools.js
 
97
        # dh_sphinxdoc chokes if we delete the extra licence files before it runs.
 
98
        find debian/bzr-doc/usr/share/doc/bzr -name "licence.txt" -print | xargs rm -f