forked from pool/python-html5lib
		
	Accepting request 486515 from devel:languages:python
1 OBS-URL: https://build.opensuse.org/request/show/486515 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-html5lib?expand=0&rev=12
This commit is contained in:
		| @@ -1,65 +0,0 @@ | ||||
| From 0c551c9519e47f76f8f185089ed71cb9539b6e00 Mon Sep 17 00:00:00 2001 | ||||
| From: Geoffrey Sneddon <geoffers@gmail.com> | ||||
| Date: Mon, 23 Nov 2015 15:17:07 +0000 | ||||
| Subject: [PATCH] Make lxml tree-builder coerce comments to work with lxml 3.5. | ||||
|  | ||||
| --- | ||||
|  html5lib/ihatexml.py                | 3 +++ | ||||
|  html5lib/treebuilders/etree_lxml.py | 9 +++++---- | ||||
|  2 files changed, 8 insertions(+), 4 deletions(-) | ||||
|  | ||||
| diff --git a/html5lib/ihatexml.py b/html5lib/ihatexml.py | ||||
| index 0fc7930..5da5d93 100644 | ||||
| --- a/html5lib/ihatexml.py | ||||
| +++ b/html5lib/ihatexml.py | ||||
| @@ -225,6 +225,9 @@ def coerceComment(self, data): | ||||
|              while "--" in data: | ||||
|                  warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning) | ||||
|                  data = data.replace("--", "- -") | ||||
| +            if data.endswith("-"): | ||||
| +                warnings.warn("Comments cannot end in a dash", DataLossWarning) | ||||
| +                data += " " | ||||
|          return data | ||||
|   | ||||
|      def coerceCharacters(self, data): | ||||
| diff --git a/html5lib/treebuilders/etree_lxml.py b/html5lib/treebuilders/etree_lxml.py | ||||
| index 35d08ef..c6c981f 100644 | ||||
| --- a/html5lib/treebuilders/etree_lxml.py | ||||
| +++ b/html5lib/treebuilders/etree_lxml.py | ||||
| @@ -54,7 +54,7 @@ def _getChildNodes(self): | ||||
|  def testSerializer(element): | ||||
|      rv = [] | ||||
|      finalText = None | ||||
| -    infosetFilter = ihatexml.InfosetFilter() | ||||
| +    infosetFilter = ihatexml.InfosetFilter(preventDoubleDashComments=True) | ||||
|   | ||||
|      def serializeElement(element, indent=0): | ||||
|          if not hasattr(element, "tag"): | ||||
| @@ -189,7 +189,7 @@ class TreeBuilder(_base.TreeBuilder): | ||||
|   | ||||
|      def __init__(self, namespaceHTMLElements, fullTree=False): | ||||
|          builder = etree_builders.getETreeModule(etree, fullTree=fullTree) | ||||
| -        infosetFilter = self.infosetFilter = ihatexml.InfosetFilter() | ||||
| +        infosetFilter = self.infosetFilter = ihatexml.InfosetFilter(preventDoubleDashComments=True) | ||||
|          self.namespaceHTMLElements = namespaceHTMLElements | ||||
|   | ||||
|          class Attributes(dict): | ||||
| @@ -257,7 +257,7 @@ def _getData(self): | ||||
|              data = property(_getData, _setData) | ||||
|   | ||||
|          self.elementClass = Element | ||||
| -        self.commentClass = builder.Comment | ||||
| +        self.commentClass = Comment | ||||
|          # self.fragmentClass = builder.DocumentFragment | ||||
|          _base.TreeBuilder.__init__(self, namespaceHTMLElements) | ||||
|   | ||||
| @@ -344,7 +344,8 @@ def insertRoot(self, token): | ||||
|   | ||||
|          # Append the initial comments: | ||||
|          for comment_token in self.initial_comments: | ||||
| -            root.addprevious(etree.Comment(comment_token["data"])) | ||||
| +            comment = self.commentClass(comment_token["data"]) | ||||
| +            root.addprevious(comment._element) | ||||
|   | ||||
|          # Create the root document and add the ElementTree to it | ||||
|          self.document = self.documentClass() | ||||
| @@ -1,3 +0,0 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:2612a191a8d5842bfa057e41ba50bbb9dcb722419d2408c78cff4758d0754868 | ||||
| size 889312 | ||||
							
								
								
									
										3
									
								
								html5lib-0.999999999.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								html5lib-0.999999999.tar.gz
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:ee747c0ffd3028d2722061936b5c65ee4fe13c8e4613519b4447123fc4546298 | ||||
| size 245488 | ||||
| @@ -1,3 +1,17 @@ | ||||
| ------------------------------------------------------------------- | ||||
| Fri Apr  7 16:07:01 UTC 2017 - toddrme2178@gmail.com | ||||
|  | ||||
| - html5lib has a hard dependency on python-webencodings. | ||||
|   It will fail at import time without it. | ||||
|  | ||||
| ------------------------------------------------------------------- | ||||
| Tue Apr  4 14:54:02 UTC 2017 - aloisio@gmx.com | ||||
|  | ||||
| - Updated to version 0.999999999 (see CHANGES.rst) | ||||
| - Converted to single-spec | ||||
| - Dropped coerce_comments_to_work_with_lxml.patch (accepted | ||||
|   upstream) | ||||
|  | ||||
| ------------------------------------------------------------------- | ||||
| Fri Feb 12 14:54:04 UTC 2016 - toddrme2178@gmail.com | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| # | ||||
| # spec file for package python-html5lib | ||||
| # | ||||
| # Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. | ||||
| # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. | ||||
| # | ||||
| # All modifications and additions to the file contributed by third parties | ||||
| # remain the property of their copyright owners, unless otherwise agreed | ||||
| @@ -16,35 +16,34 @@ | ||||
| # | ||||
|  | ||||
|  | ||||
| %{?!python_module:%define python_module() python-%{**} python3-%{**}} | ||||
| Name:           python-html5lib | ||||
| Version:        0.9999999 | ||||
| Version:        0.999999999 | ||||
| Release:        0 | ||||
| Summary:        HTML parser based on the WHAT-WG Web Applications 1 | ||||
| License:        MIT | ||||
| Group:          Development/Languages/Python | ||||
| Url:            https://github.com/html5lib/html5lib-python | ||||
| Source:         http://pypi.python.org/packages/source/h/html5lib/html5lib-%{version}.tar.gz | ||||
| # PATCH-FIX-UPSTREAM coerce_comments_to_work_with_lxml.patch - fix comments for new lxml comment validation - https://github.com/html5lib/html5lib-python/issues/224 | ||||
| Patch0:         coerce_comments_to_work_with_lxml.patch | ||||
| BuildRequires:  python-Genshi >= 0.7 | ||||
| BuildRequires:  python-devel | ||||
| BuildRequires:  python-lxml | ||||
| BuildRequires:  python-mock | ||||
| BuildRequires:  python-pytest | ||||
| BuildRequires:  python-setuptools >= 18.0.1 | ||||
| BuildRequires:  python-six >= 1.9.0 | ||||
| Requires:       python-six >= 1.9.0 | ||||
| %if 0%{?suse_version} | ||||
| Recommends:     python-Genshi >= 0.7 | ||||
| Source:         https://pypi.io/packages/source/h/html5lib/html5lib-%{version}.tar.gz | ||||
| BuildRequires:  %{python_module Genshi} | ||||
| BuildRequires:  %{python_module datrie} | ||||
| BuildRequires:  %{python_module devel} | ||||
| BuildRequires:  %{python_module lxml} | ||||
| BuildRequires:  %{python_module mock} | ||||
| BuildRequires:  %{python_module pytest-expect} | ||||
| BuildRequires:  %{python_module pytest} | ||||
| BuildRequires:  %{python_module setuptools >= 18.5} | ||||
| BuildRequires:  %{python_module six} | ||||
| BuildRequires:  %{python_module webencodings} | ||||
| BuildRequires:  fdupes | ||||
| BuildRequires:  python-rpm-macros | ||||
| Requires:       python-six | ||||
| Requires:       python-webencodings | ||||
| Recommends:     python-Genshi | ||||
| Recommends:     python-lxml | ||||
| %endif | ||||
| BuildRoot:      %{_tmppath}/%{name}-%{version}-build | ||||
|  | ||||
| %if 0%{?suse_version} && 0%{?suse_version} <= 1110 | ||||
| %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} | ||||
| %else | ||||
| BuildArch:      noarch | ||||
| %endif | ||||
| %python_subpackages | ||||
|  | ||||
| %description | ||||
| HTML parser designed to follow the HTML5 | ||||
| @@ -58,24 +57,21 @@ simple custom format | ||||
|  | ||||
| %prep | ||||
| %setup -q -n html5lib-%{version} | ||||
| %patch0 -p1 | ||||
|  | ||||
| %build | ||||
| python setup.py build | ||||
| %python_build | ||||
|  | ||||
| %install | ||||
| python setup.py install --prefix=%{_prefix} --root=%{buildroot} | ||||
| %python_install | ||||
| %python_expand %fdupes -s %{buildroot}%{$python_sitelib} | ||||
|  | ||||
| %if 0%{?suse_version} && 0%{?suse_version} > 1110 | ||||
| %check | ||||
| export LANG=en_US.UTF-8  | ||||
| py.test | ||||
| %endif | ||||
| %python_expand %python_exec %{_bindir}/py.test --tb=short | ||||
|  | ||||
| %files | ||||
| %files %{python_files} | ||||
| %defattr(-,root,root,-) | ||||
| %doc CHANGES.rst LICENSE README.rst | ||||
| %{python_sitelib}/html5lib/ | ||||
| %{python_sitelib}/html5lib-%{version}-py*.egg-info | ||||
| %{python_sitelib}/html5lib-%{version}-py%{python_version}.egg-info | ||||
|  | ||||
| %changelog | ||||
|   | ||||
		Reference in New Issue
	
	Block a user