Sync from SUSE:SLFO:Main python-pyquery revision 31e41f8c93ca722e0ca0a9a66b978683

This commit is contained in:
Adrian Schröter 2024-05-03 22:15:26 +02:00
commit dcea4c70d7
6 changed files with 445 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -0,0 +1,59 @@
---
tests/test_pyquery.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Index: pyquery-2.0.0/tests/test_pyquery.py
===================================================================
--- pyquery-2.0.0.orig/tests/test_pyquery.py
+++ pyquery-2.0.0/tests/test_pyquery.py
@@ -7,9 +7,12 @@ import time
from lxml import etree
from pyquery.pyquery import PyQuery as pq, no_default
from pyquery.openers import HAS_REQUEST
-from webtest import http
-from webtest.debugapp import debug_app
-from unittest import TestCase
+from unittest import TestCase, skipIf
+try:
+ from webtest import http
+ from webtest.debugapp import debug_app
+except (ImportError, ModuleNotFoundError):
+ http = None
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
@@ -894,6 +897,7 @@ class TestXMLNamespace(TestCase):
self.assertEqual(repr(val), repr('b'))
+@skipIf(http is None, "Cannot test without WebTest")
class TestWebScrapping(TestCase):
def setUp(self):
@@ -938,6 +942,7 @@ class TestWebScrappingEncoding(TestCase)
self.assertEqual(d('#pt-login').text(), u'Войти')
+@skipIf(http is None, "Cannot test without WebTest")
class TestWebScrappingTimeouts(TestCase):
def setUp(self):
Index: pyquery-2.0.0/conftest.py
===================================================================
--- pyquery-2.0.0.orig/conftest.py
+++ pyquery-2.0.0/conftest.py
@@ -1,7 +1,12 @@
import os
import pytest
-from webtest import http
-from webtest.debugapp import debug_app
+
+try:
+ from webtest import http
+ from webtest.debugapp import debug_app
+except (ImportError, ModuleNotFoundError):
+ http = None
+
from urllib.request import urlopen

BIN
pyquery-2.0.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

268
python-pyquery.changes Normal file
View File

@ -0,0 +1,268 @@
-------------------------------------------------------------------
Mon Apr 24 16:44:07 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Update make_webtest_optional.patch to make the import optional in
conftest.py
-------------------------------------------------------------------
Fri Apr 21 12:31:13 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 20 07:27:05 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 2.0.0:
* Breaking change: inputs starting with "http://" or "https://" like
PyQuery("http://example.com") will no longer fetch the contents of the
URL. Users desiring the old behavior should switch to
PyQuery(url="http://example.com").
* Add nextUntil method
* .remove() no longer inserts a space in place of the removed element
* Fix escaping of top-level element text in .html() output
* Support (and require) cssselect 1.2+
* Drop support for python 3.5/3.6
-------------------------------------------------------------------
Thu Apr 13 22:43:53 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Fri Feb 17 16:46:13 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Add make_webtest_optional.patch to allow testing without
WebTest module.
-------------------------------------------------------------------
Fri Aug 19 11:41:24 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Remove coverage from build requirements -- not relevant for rpm
package
-------------------------------------------------------------------
Wed Mar 30 08:07:39 UTC 2022 - Dirk Müller <dmueller@suse.com>
- update to 1.4.3:
* No longer use a universal wheel
* Fix exception raised when calling `PyQuery("<textarea></textarea>").text()`
* python2 is no longer supported
-------------------------------------------------------------------
Sun Aug 16 16:39:56 UTC 2020 - John Vandenberg <jayvdb@gmail.com>
- Replace nose with pytest
-------------------------------------------------------------------
Sun Nov 24 17:21:55 UTC 2019 - Arun Persaud <arun@gmx.de>
- specfile:
* be more specific in %files section
- update to version 1.4.1:
* This is the latest release with py2 support
* Remove py33, py34 support
* web scraping improvements: default timeout and session support
* Add API methods to serialize form-related elements according to
spec
* Include HTML markup when querying textarea text/value
-------------------------------------------------------------------
Mon Feb 25 09:00:58 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Use _multibuild to run tests
-------------------------------------------------------------------
Mon Feb 25 03:24:33 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Add %license
- Run test suite on both Python 2 & 3
- Remove outdated build dependencies
- Add minimum versions
- Add python-coverage as build dependency as nose segfaults when missing
-------------------------------------------------------------------
Tue Dec 4 12:52:42 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Mon Aug 13 13:18:38 UTC 2018 - mcepl@suse.com
- Remove dependency on unittest2
-------------------------------------------------------------------
Wed Mar 29 07:12:38 UTC 2017 - alarrosa@suse.com
- Converted to singlespec
-------------------------------------------------------------------
Tue Oct 25 17:14:25 UTC 2016 - arun@gmx.de
- update to version 1.2.17:
* PyQuery('<input value="">').val() is ''
* PyQuery('<input>').val() is ''
- changes from version 1.2.16:
* .attr('value', '') no longer removes the value attribute
* <input type="checkbox"> without value="..." have a .val() of 'on'
* <input type="radio"> without value="..." have a .val() of 'on'
* <select> without <option selected> have the value of their first
<option> (or None if there are no options)
- changes from version 1.2.15:
* .val() should never raise
* drop py26 support
* improve .extend() by returning self
- changes from version 1.2.14:
* fix val() for <textarea> and <select>, to match jQuery behavior
-------------------------------------------------------------------
Sun May 8 07:05:11 UTC 2016 - arun@gmx.de
- specfile:
* changed to https for source url
* updated source url to files.pythonhosted.org
-------------------------------------------------------------------
Sat Apr 23 16:23:21 UTC 2016 - arun@gmx.de
- update to version 1.2.13:
* Note explicit support for Python 3.5
- changes from version 1.2.12:
* make_links_absolute now take care of whitespaces
* added pseudo selector :has()
* add cookies arguments as allowed arguments for requests
-------------------------------------------------------------------
Wed Feb 3 01:36:49 UTC 2016 - arun@gmx.de
- update to version 1.2.11:
* Preserve namespaces attribute on PyQuery copies.
* Do not raise an error when the http response code is 2XX
-------------------------------------------------------------------
Sat Jan 30 23:57:29 UTC 2016 - arun@gmx.de
- specfile:
* update copyright year
* changed from zip to tar.gz
- update to version 1.2.10:
* Fixed #118: implemented usage lxml.etree.tostring within
outer_html method
* Fixed #117: Raise HTTP Error if HTTP status code is not equal to
200
* Fixed #112: make_links_absolute does not apply to form actions
* Fixed #98: contains act like jQuery
-------------------------------------------------------------------
Thu Jul 2 18:11:08 UTC 2015 - benoit.monin@gmx.fr
- add a build conditional for the test: work around a circular
dependency between python-pyquery and python-WebTest
-------------------------------------------------------------------
Mon May 11 18:28:15 UTC 2015 - benoit.monin@gmx.fr
- update to version 1.2.9:
* Support for keyword arguments in PyQuery custom functions
* Fixed #78: items must take care or the parent
* Fixed #65 PyQuery.make_links_absolute() no longer creates
'href' attribute
* when it isn't there
* Fixed #19. is_() was broken.
* Fixed #9. .replaceWith(PyQuery element) raises error
* Remove official python3.2 support (mostly because of 3rd party
semi-deps)
- update project URL
- add new dependency python-cssselect
- set a minimum version for python-lxml
- add test dependencies python-WebOb, python-WebTest,
python-beautifulsoup, python-nose, python-restkit,
python-unittest2
- add test dependency python-ordereddict for SLE11
- run the tests during build
-------------------------------------------------------------------
Mon Jan 13 13:58:37 UTC 2014 - dmueller@suse.com
- update to 1.2.8:
* Fixed #22: Open by filename fails when file contains invalid xml
- changes from 1.2.7:
* Use pep8 name for methods but keep an alias for camel case method.
* text() now return an empty string instead of None if there is no text node
-------------------------------------------------------------------
Sun Nov 24 21:12:20 UTC 2013 - p.drouand@gmail.com
- Update to version 1.2.6
+ README_fixt.py was not include in the release. Fix #54.
- Changes from version 1.2.5
+ cssselect compat. See https://github.com/SimonSapin/cssselect/pull/22
+ tests improvments. no longer require a eth connection.
fix #55
- Add unzip BuildRequires to support format of tarball
-------------------------------------------------------------------
Thu Oct 24 11:12:17 UTC 2013 - speilicke@suse.com
- Require python-setuptools instead of distribute (upstreams merged)
-------------------------------------------------------------------
Tue Apr 30 12:34:43 UTC 2013 - dmueller@suse.com
- add buildroot
-------------------------------------------------------------------
Tue Mar 26 00:51:38 UTC 2013 - arun@gmx.de
- updated copyright year in spec file
-------------------------------------------------------------------
Tue Mar 26 00:49:40 UTC 2013 - arun@gmx.de
- updated to 1.2.4
changes as listed on https://pypi.python.org/pypi/pyquery:
1.2.4
Moved to github. So a few files are renamed from .txt to .rst
Added .xhtml_to_html() and .remove_namespaces()
Use requests to fetch urls (if available)
Use restkit's proxy instead of Paste (which will die with py3)
Allow to open https urls
python2.5 is no longer supported (may work, but tests are broken)
1.2.3
Allow to pass this in .filter() callback
Add .contents() .items()
Add tox.ini
Bug fixes: fix #35 #55 #64 #66
1.2.2
Fix cssselectpatch to match the newer implementation of cssselect. Fixes issue #62, #52 and #59 (Haoyu Bai)
Fix issue #37 (Caleb Burns)
1.2.1
Allow to use a custom css translator.
Fix issue 44: case problem with xml documents
1.2
PyQuery now use cssselect. See issue 43.
Fix issue 40: forward .html() extra arguments to lxml.etree.tostring
-------------------------------------------------------------------
Tue Jan 31 10:54:06 UTC 2012 - saschpe@suse.de
- Simplified macro usage
- Buildrequire python-distribute instead of (outdated) setuptools
- Set license to SDPX style (BSD-3-Clause)
-------------------------------------------------------------------
Sun Oct 9 09:57:45 UTC 2011 - prusnak@opensuse.org
- updated to version 1.0
-------------------------------------------------------------------
Sat Mar 05 07:02:11 CET 2011 - pascal.bleser@opensuse.org
- initial version (0.7)

89
python-pyquery.spec Normal file
View File

@ -0,0 +1,89 @@
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define skip_python2 1
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name: python-pyquery%{psuffix}
Version: 2.0.0
Release: 0
Summary: A jQuery-like library for python
License: BSD-3-Clause
URL: https://pypi.python.org/pypi/pyquery
Source: https://files.pythonhosted.org/packages/source/p/pyquery/pyquery-%{version}.tar.gz
# PATCH-FIX-OPENSUSE make_webtest_optional.patch mcepl@suse.com
# Make it possible to run test suite (albeit partial) without WebTest module
Patch0: make_webtest_optional.patch
BuildRequires: %{python_module cssselect >= 1.2.0}
BuildRequires: %{python_module lxml >= 2.1}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-cssselect >= 1.2.0
Requires: python-lxml >= 2.1
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module WebOb > 1.1.9}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
%if 0%{?suse_version} > 1550
BuildRequires: %{python_module WebTest}
%endif
%endif
%python_subpackages
%description
Pyquery allows you to make jQuery queries on XML documents. The API is
as much as possible the similar to jQuery. Pyquery uses lxml for fast
XML and HTML manipulation.
%prep
%autosetup -p1 -n pyquery-%{version}
%build
%python_build
%install
%if !%{with test}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%if %{with test}
%check
# Disable tests which perform live fetch
# test_selector_html uses XML namespaces, which are broken with libxml2 2.10.4+
%pytest -k 'not (test_get or test_selector_html)' tests
%endif
%if !%{with test}
%files %{python_files}
%license LICENSE.txt
%doc CHANGES.rst README.rst
%{python_sitelib}/pyquery/
%{python_sitelib}/pyquery-%{version}*-info
%endif
%changelog