aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing/py3-w3lib/APKBUILD11
-rw-r--r--testing/py3-w3lib/python-3.9.patch102
2 files changed, 109 insertions, 4 deletions
diff --git a/testing/py3-w3lib/APKBUILD b/testing/py3-w3lib/APKBUILD
index 81d9cd3808c..d2896c302da 100644
--- a/testing/py3-w3lib/APKBUILD
+++ b/testing/py3-w3lib/APKBUILD
@@ -3,7 +3,7 @@
pkgname=py3-w3lib
_pkgname=w3lib
pkgver=1.22.0
-pkgrel=0
+pkgrel=1
pkgdesc="A library of web-related functions"
url="https://github.com/scrapy/w3lib"
arch="noarch"
@@ -11,7 +11,9 @@ license="BSD-3-Clause"
depends="py3-six"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
-source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
+ python-3.9.patch
+ "
builddir="$srcdir/$_pkgname-$pkgver"
replaces="py-w3lib" # Backwards compatibility
@@ -22,11 +24,12 @@ build() {
}
check() {
- py.test-3
+ py.test-3 -v
}
package() {
python3 setup.py install --prefix=/usr --root="$pkgdir"
}
-sha512sums="fbc2bbc06808ec5d28e300ce00e2a59cc07a3a15e4a3690d3b6a105b6f33e6e02fab057b27733d9ea69bc99ebc1e7e8e628e1408a00194991ea05f35dae8bf10 w3lib-1.22.0.tar.gz"
+sha512sums="fbc2bbc06808ec5d28e300ce00e2a59cc07a3a15e4a3690d3b6a105b6f33e6e02fab057b27733d9ea69bc99ebc1e7e8e628e1408a00194991ea05f35dae8bf10 w3lib-1.22.0.tar.gz
+02ce9478acae629c385c7874ba4daf859d94a6b3258f17b80fd56d7f86c4830c8cbfdfe5adcb1329bfa72c05ed963081ae0fda4e989287133423e11caad80fa4 python-3.9.patch"
diff --git a/testing/py3-w3lib/python-3.9.patch b/testing/py3-w3lib/python-3.9.patch
new file mode 100644
index 00000000000..a24eefd0240
--- /dev/null
+++ b/testing/py3-w3lib/python-3.9.patch
@@ -0,0 +1,102 @@
+From fae6cc40e112cd13697cb0e8d79976f32c72491d Mon Sep 17 00:00:00 2001
+From: Eugenio Lacuesta <eugenio.lacuesta@gmail.com>
+Date: Wed, 10 Mar 2021 12:31:05 -0300
+Subject: [PATCH 2/8] [CI] Mark single add_or_replace_parameter test as xfail
+
+---
+ .gitignore | 3 ++-
+ tests/test_url.py | 25 ++++++++++++++-----------
+ 2 files changed, 16 insertions(+), 12 deletions(-)
+
+diff --git a/tests/test_url.py b/tests/test_url.py
+index 8b07c00..0f7458e 100644
+--- a/tests/test_url.py
++++ b/tests/test_url.py
+@@ -1,12 +1,14 @@
+-# -*- coding: utf-8 -*-
+ from __future__ import absolute_import
+ import os
+ import unittest
++
++import pytest
++from six.moves.urllib.parse import urlparse
++
+ from w3lib.url import (is_url, safe_url_string, safe_download_url,
+ url_query_parameter, add_or_replace_parameter, url_query_cleaner,
+ file_uri_to_path, parse_data_uri, path_to_file_uri, any_to_uri,
+ urljoin_rfc, canonicalize_url, parse_url, add_or_replace_parameters)
+-from six.moves.urllib.parse import urlparse
+
+
+ class UrlTests(unittest.TestCase):
+@@ -76,17 +78,16 @@ def test_safe_url_string_remove_ascii_tab_and_newlines(self):
+ def test_safe_url_string_unsafe_chars(self):
+ safeurl = safe_url_string(r"http://localhost:8001/unwise{,},|,\,^,[,],`?|=[]&[]=|")
+ self.assertEqual(safeurl, r"http://localhost:8001/unwise%7B,%7D,|,%5C,%5E,[,],%60?|=[]&[]=|")
+-
++
+ def test_safe_url_string_quote_path(self):
+ safeurl = safe_url_string(u'http://google.com/"hello"', quote_path=True)
+ self.assertEqual(safeurl, u'http://google.com/%22hello%22')
+-
++
+ safeurl = safe_url_string(u'http://google.com/"hello"', quote_path=False)
+ self.assertEqual(safeurl, u'http://google.com/"hello"')
+-
++
+ safeurl = safe_url_string(u'http://google.com/"hello"')
+ self.assertEqual(safeurl, u'http://google.com/%22hello%22')
+-
+
+ def test_safe_url_string_with_query(self):
+ safeurl = safe_url_string(u"http://www.example.com/£?unit=µ")
+@@ -310,10 +311,6 @@ def test_add_or_replace_parameter(self):
+ self.assertEqual(add_or_replace_parameter(url, 'arg3', 'nv3'),
+ 'http://domain/test?arg1=v1&arg2=v2&arg3=nv3')
+
+- url = 'http://domain/test?arg1=v1;arg2=v2'
+- self.assertEqual(add_or_replace_parameter(url, 'arg1', 'v3'),
+- 'http://domain/test?arg1=v3&arg2=v2')
+-
+ self.assertEqual(add_or_replace_parameter("http://domain/moreInfo.asp?prodID=", 'prodID', '20'),
+ 'http://domain/moreInfo.asp?prodID=20')
+ url = 'http://rmc-offers.co.uk/productlist.asp?BCat=2%2C60&CatID=60'
+@@ -338,6 +335,13 @@ def test_add_or_replace_parameter(self):
+ self.assertEqual(add_or_replace_parameter(url, 'arg1', 'v3'),
+ 'http://domain/test?arg1=v3&arg2=v2')
+
++ @pytest.mark.xfail(reason="https://github.com/scrapy/w3lib/issues/164")
++ def test_add_or_replace_parameter_fail(self):
++ self.assertEqual(
++ add_or_replace_parameter('http://domain/test?arg1=v1;arg2=v2', 'arg1', 'v3'),
++ 'http://domain/test?arg1=v3&arg2=v2'
++ )
++
+ def test_add_or_replace_parameters(self):
+ url = 'http://domain/test'
+ self.assertEqual(add_or_replace_parameters(url, {'arg': 'v'}),
+@@ -767,4 +771,3 @@ def test_scheme_case_insensitive(self):
+
+ if __name__ == "__main__":
+ unittest.main()
+-
+
+From 71479b659af134123857d721b6fdeb8864b9c2f3 Mon Sep 17 00:00:00 2001
+From: Eugenio Lacuesta <eugenio.lacuesta@gmail.com>
+Date: Wed, 10 Mar 2021 12:34:47 -0300
+Subject: [PATCH 3/8] Restore encoding declaration
+
+---
+ tests/test_url.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tests/test_url.py b/tests/test_url.py
+index 0f7458e..0769550 100644
+--- a/tests/test_url.py
++++ b/tests/test_url.py
+@@ -1,3 +1,4 @@
++# -*- coding: utf-8 -*-
+ from __future__ import absolute_import
+ import os
+ import unittest
+