On Wed, Nov 28, 2012 at 03:26:06PM +0800, Jonathan Ballet wrote:
> On Tue, Nov 20, 2012 at 05:43:18PM +0100, Matthias Klose wrote:
> > Am 20.11.2012 11:02, schrieb Jonathan Ballet:
> > > In short, is is possible to provide the API documentation of Twisted as
> > > a package (either as part of twisted-doc or into another package)?
> > 
[...]
> 
> Please find the attached patch to this email.

I made a new version of the patch, which should package the whole
documentation, and not only the apidocs.

Please find the updated patch attached to this email.

 Jonathan
diff -ruN debian.orig/control debian/control
--- debian.orig/control	2012-05-02 20:11:34.000000000 +0800
+++ debian/control	2012-11-25 18:38:14.000000000 +0800
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Matthias Klose <d...@debian.org>
 Uploaders: Free Ekanayaka <fr...@debian.org>
-Build-Depends: debhelper (>=7.0.50~), python-all-dev (>= 2.6.6-3~), python-all-dbg, python-zope.interface-dbg, patch
+Build-Depends: debhelper (>=7.0.50~), python-all-dev (>= 2.6.6-3~), python-all-dbg, python-zope.interface-dbg, patch, python-pydoctor
 Build-Conflicts: python-setuptools
 XS-Python-Version: all
 Standards-Version: 3.9.3
diff -ruN debian.orig/patches/index-doc.diff debian/patches/index-doc.diff
--- debian.orig/patches/index-doc.diff	1970-01-01 08:00:00.000000000 +0800
+++ debian/patches/index-doc.diff	2012-11-28 14:36:06.000000000 +0800
@@ -0,0 +1,21 @@
+--- twisted-12.0.0.orig/doc/index.html	2012-11-28 14:28:43.000000000 +0800
++++ twisted-12.0.0/doc/index.html	2012-11-28 14:31:17.000000000 +0800
+@@ -20,12 +20,13 @@
+ <li><a href="development/index.html" shape="rect">Development of Twisted</a>: for people who
+ want to work on Twisted itself</li>
+ </ul>
+-<p>An <a href="http://twistedmatrix.com/documents/current/api/"; shape="rect">API
+-  reference</a> is available on the twistedmatrix web site.</p>
+-
++<p>An <a href="apidocs/" shape="rect">API reference</a> is also available.
++You can find the
++<a href="http://twistedmatrix.com/documents/current/api/"; shape="rect">latest
++    reference</a> on the twistedmatrix web site.</p>
+ </div>
+ 
+     <p><a href="howto/index.html">Index</a></p>
+     <span class="version">Version: 12.0.0</span>
+   </body>
+-</html>
+\ No newline at end of file
++</html>
diff -ruN debian.orig/patches/series debian/patches/series
--- debian.orig/patches/series	2012-05-02 20:11:34.000000000 +0800
+++ debian/patches/series	2012-11-28 14:33:35.000000000 +0800
@@ -1 +1,2 @@
 tap2deb.diff
+index-doc.diff
diff -ruN debian.orig/rules debian/rules
--- debian.orig/rules	2012-05-02 20:11:34.000000000 +0800
+++ debian/rules	2012-11-28 17:29:30.000000000 +0800
@@ -10,11 +10,11 @@
 
 gamesdir = debian/twisted-quotes/usr/share/games/fortunes
 
-twersion := $(subst twisted-,,$(notdir $(CURDIR)))
+twversion := $(subst twisted-,,$(notdir $(CURDIR)))
 
 include /usr/share/python/python.mk
 
-build: build-stamp
+build: build-stamp build-doc
 build-arch: build-stamp
 build-indep: build-stamp
 build-stamp: $(PYVERS:%=build-python%)
@@ -24,6 +24,10 @@
 	python$*-dbg setup.py build
 	touch $@
 
+build-doc:
+	-pydoctor --html-write-function-pages --add-package twisted
+
+
 clean:
 	rm -rf *-stamp build-python* build
 	rm -rf $(addprefix debian/,$(packages)) debian/files debian/substvars
@@ -66,8 +70,8 @@
 
 	: # python-twisted
 	mkdir -p debian/python-twisted/$(call py_libdir,$*)
-	sed 's/@twersion@/$(twversion)/' debian/Twisted.egg-info.in \
-		> debian/python-twisted/$(call py_libdir,$*)/Twisted-$(twersion).egg-info
+	sed 's/@twversion@/$(twversion)/' debian/Twisted.egg-info.in \
+		> debian/python-twisted/$(call py_libdir,$*)/Twisted-$(twversion).egg-info
 
 	: # Replace all '#!' calls to python with /usr/bin/python
 	: # and make them executable
@@ -92,6 +96,7 @@
 	: # twisted-doc
 	mkdir -p debian/twisted-doc/usr/share/doc/twisted-doc
 	cp -a doc/* debian/twisted-doc/usr/share/doc/twisted-doc/
+	cp -ua apidocs debian/twisted-doc/usr/share/doc/twisted-doc/
 	-find debian/twisted-doc -type d -name man | xargs rm -rf
 
 	mkdir -p debian/python-twisted-core/usr/share/man/man1
@@ -99,6 +104,16 @@
 	  cp -p $$i debian/python-twisted-core/usr/share/man/man1/; \
 	done
 
+	# Replace links to Twisted website API doc by links to the local doc. We
+	# need to compute path to the API which goes up enough in the folder
+	# hierarchy to access the doc.
+	for i in $$(cd debian/twisted-doc/usr/share/doc/twisted-doc/ && \
+	  grep -rl "http://twistedmatrix.com/documents/$(twversion)/api/" .); do \
+	  path="$$(echo $$i | sed "s:[^/]::g" | sed "s:/:../:g" | cut -c 4-)apidocs/"; \
+	  sed -i "s:http\://twistedmatrix.com/documents/$(twversion)/api/:$$path:g" \
+	  debian/twisted-doc/usr/share/doc/twisted-doc/$$i; \
+	done
+
 binary-indep: build install
 	dh_testdir
 	dh_testroot

Reply via email to