Hi.

On Sat, Nov 09, 2013 at 05:49:12PM +0100, Elena Grandi wrote:
> 
> 
> Upstream claims that html5lib also works on CPython 3 (and PyPy): 
> could you please also build the python3-html5lib package?
> 

AFAIU, 0.99 is needed for Python 3 support.

Here's a proposed patch with a minimal footprint that updates for 0.99 and adds 
python3-html5lib generation.

It's far from complete but hopefully helps for a start.

I may eventually commit to svn but here's a first attempt in my git repo (made 
with git-svn), both in attachment and pushed at [0]. I haven't committed it 
directly as I'm quite new to Python packaging and DPMT (and wasn't really sure 
whether git svn dcommit would mess or not with the SVN repo).

Hope this helps.

Best regards,

[0] http://anonscm.debian.org/gitweb/?p=users/obergix/html5lib.git
-- 
Olivier BERGER 
http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)

diff --git a/debian/changelog b/debian/changelog
index 9c00e0d..0040762 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+html5lib (0.99-1) UNRELEASED; urgency=low
+
+  * New upstream version.
+
+ -- Olivier Berger <ober...@debian.org>  Tue, 03 Dec 2013 18:28:32 +0100
+
 html5lib (0.95-2) UNRELEASED; urgency=low
 
   * Use canonical URIs for Vcs-* fields.
diff --git a/debian/control b/debian/control
index d1f6e4d..967e005 100644
--- a/debian/control
+++ b/debian/control
@@ -19,3 +19,12 @@ Description: HTML parser/tokenizer based on the WHATWG HTML5 specification
  html5lib is a pure-python library for parsing HTML. It is designed to
  conform to the HTML 5 specification, which has formalized the error handling
  algorithms of popular web browsers.
+
+Package: python3-html5lib
+Architecture: all
+Depends: ${python3:Depends}, ${misc:Depends}
+Suggests: python-beautifulsoup, python-chardet, python-lxml | python-4suite-xml, python-genshi
+Description: HTML parser/tokenizer based on the WHATWG HTML5 specification
+ html5lib is a pure-python library for parsing HTML. It is designed to
+ conform to the HTML 5 specification, which has formalized the error handling
+ algorithms of popular web browsers.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..a1320b1
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README.rst
diff --git a/debian/python-html5lib.install b/debian/python-html5lib.install
new file mode 100644
index 0000000..0105c59
--- /dev/null
+++ b/debian/python-html5lib.install
@@ -0,0 +1 @@
+usr/lib/python2.*/
diff --git a/debian/python3-html5lib.install b/debian/python3-html5lib.install
new file mode 100644
index 0000000..eae3930
--- /dev/null
+++ b/debian/python3-html5lib.install
@@ -0,0 +1 @@
+usr/lib/python3/
diff --git a/debian/rules b/debian/rules
index 9115740..69b89e7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,11 +1,23 @@
 #!/usr/bin/make -f
 
-PYVERS:=$(shell pyversions -vr)
-pythonpath = $$(ls -d $(CURDIR)/build/lib.*-$(1))
+# PYVERS:=$(shell pyversions -vr)
+# pythonpath = $$(ls -d $(CURDIR)/build/lib.*-$(1))
+PY3REQUESTED := $(shell py3versions -r)
+PY3DEFAULT := $(shell py3versions -d)
+PYTHON3 := $(filter-out $(PY3DEFAULT),$(PY3REQUESTED)) python3
 
+export DH_VERBOSE=1
+export DH_OPTIONS=-v
 
 %:
-	dh --with python2 $@
+	dh $@ --with python2,python3
+
+override_dh_auto_build:
+	# Build for each Python 3 version
+	set -ex; for python in $(PYTHON3); do \
+		$$python setup.py build; \
+	done
+	dh_auto_build
 
 override_dh_auto_test:
 ifeq (test-suite-is-broken-again,yes)
@@ -18,6 +30,23 @@ ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
 endif
 endif
 
+# override_dh_auto_install:
+# 	dh_auto_install
+# 	find debian/python-html5lib -type d -name tests -exec rm {} \;
+
 override_dh_auto_install:
+	# The same for install; note the --install-layout=deb option
+	set -ex; for python in $(PYTHON3); do \
+		$$python setup.py install --install-layout=deb --root=debian/tmp; \
+	done
 	dh_auto_install
-	find debian/python-html5lib -type d -name tests -print0 | xargs -0 rm -r
+
+PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
+PKG  = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
+VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
+
+.PHONY: get-orig-source
+## http://wiki.debian.org/onlyjob/get-orig-source
+get-orig-source:  $(info I: $(PKG)_$(VER))
+	@echo "# Downloading..."
+	uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
diff --git a/debian/watch b/debian/watch
index 46d4421..3459364 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,2 +1,4 @@
 version=3
-http://code.google.com/p/html5lib/downloads/list //html5lib.googlecode.com/files/html5lib-([0-9.]+)\.tar\.gz
+# do not use (\d\S*) to avoid beta versions and likes
+opts=filenamemangle=s/.+\/v?(\d[\d\.]*)\.tar\.gz/html5lib-python-$1\.tar\.gz/ \
+  https://github.com/html5lib/html5lib-python/tags .*/v?(\d[\d\.]*)\.tar\.gz
\ No newline at end of file

Reply via email to