summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/beautifulsoup')
-rw-r--r--dev-python/beautifulsoup/Manifest24
-rw-r--r--dev-python/beautifulsoup/beautifulsoup-3.1.0.1-r1.ebuild49
-rw-r--r--dev-python/beautifulsoup/beautifulsoup-4.1.3-r1.ebuild16
-rw-r--r--dev-python/beautifulsoup/beautifulsoup-4.2.0.ebuild19
-rw-r--r--dev-python/beautifulsoup/files/beautifulsoup-3.1.0.1-python-3.patch949
-rw-r--r--dev-python/beautifulsoup/files/bfs-4.2.0-no-lxml.patch67
-rw-r--r--dev-python/beautifulsoup/metadata.xml3
7 files changed, 94 insertions, 1033 deletions
diff --git a/dev-python/beautifulsoup/Manifest b/dev-python/beautifulsoup/Manifest
index cc5ca6ff8852..8e4b4c6e873a 100644
--- a/dev-python/beautifulsoup/Manifest
+++ b/dev-python/beautifulsoup/Manifest
@@ -1,29 +1,13 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
-
-AUX beautifulsoup-3.1.0.1-python-3.patch 42319 SHA256 ff316866451fa89bcd55f2a12590960df0d1c5b099cb94ca8e2d684024536a97 SHA512 7e29d0cfa4f927c9df87902adc7bd037ebeb9f2389ace2370253e453309bde7dd4a58247e24e2caa0cc2ae73ad65480973fed6397bb987bf9715fa4515dac1c1 WHIRLPOOL bcdfe4f601fb69f579bb55021c244cb9861946bfba8253c5ab5ed5426266abf798832c8eacc5208bd2e0baa9ccf0e6f74eded73e76289c5560891b86b557d489
-DIST BeautifulSoup-3.1.0.1.tar.gz 71460 SHA256 820a80f473240d9d30047f36c959d530a699a732500662dd8b03e1d3ccad12a8 SHA512 812969faf454a58d849921836ed07ec9a950f34fb31e29e118cdf1a75a533370e430f417402b5a5016d23b2d3a1c44a1cf5fde5b3bfd1bc98c50036edd51c0d6 WHIRLPOOL a199585817dcabcc6327c3836a66128605ebf92a6663b5c660125061a797485a504d300791bcd43e0e94e4f08ca59c01f65f42481da07b1240350cbfc6ea6b0c
+AUX bfs-4.2.0-no-lxml.patch 2462 SHA256 d28f5b8d33a674e6349fc5376a30d2c74a8029a7839e7f13a7701fc9a20b5563 SHA512 4d6f1db9cff0007c824340da94cfa001a7afaef2cbc6ce95f669c72221ffeb2a975688f449bd66c0163bc90328329471577d8562e31dabbff610f30bfd0a8592 WHIRLPOOL f495c2588dd7a3d11d0802212d072b3d0ef02d8c55edb9546b2117d7867b0ebcd4a41411f3a2de9e34f57db8e72030b3e290dbe60300bc4bd8f2b94d1f5193e1
DIST BeautifulSoup-3.2.0.tar.gz 31056 SHA256 a0ea3377a1055bf2e17594c0808414afb65e11f25ce8998f1ed3e9b871de6ff6 SHA512 2bee35d0d0f3909eb09fe74c5ed1ebccb9fa134e200f5e9f00266fe1f3453d1794e920dbe4129fd3f445abe19a5acaa7dab207b2e752ac0102ae5fd9441df8ce WHIRLPOOL a537228dd5b686fd8d033eb4329ecf79fdcdfaf9e5ec4eed9a2b25aba0f41ddc980dbca6cefe26b24b721a0fe0d4804974b504767e034eef35c07ad99ef51f37
DIST BeautifulSoup-3.2.1.tar.gz 31224 SHA256 f5ba85e907e7dfd78e44e4000b3eaef3a650aefc57831e8a645702db2e5b50db SHA512 365b7b045a2069cf437877543577bc0aa99256a6dc4c9743670b46bfceab5494a06628012d6eccecfe99c25d5c9e0c65814964b47026f15ba1a538444cfb7789 WHIRLPOOL c2f84b29421d0153fb1fecc87d63e00a61182e03bc0683132babca5d6c94143b4875a60a19124a36e4e6e78ce80bff9e1e81b37335700efc14084da933307e26
DIST beautifulsoup4-4.1.3.tar.gz 131292 SHA256 a295b93b30e1126f3fd64edc106f6939349280dde2ba47cef1e5a92dad9319bf SHA512 79ed4f65bcb5599a0d278d5462a67e80f532cdddcb753e0703b28347d84512165ee0bffd09795a501f3b55e6e4869354f04efdceae9de9093a4d85381fee660e WHIRLPOOL 53713ca72b5a409b3755e28d69de65b7994fb387d21ba9a1827f3e4dda2355f318660f69a706825ecb3852447823ffb8bae2cee6bacc093e6ad73347852f29c6
DIST beautifulsoup4-4.2.0.tar.gz 138400 SHA256 9565ce6f6d28808007ab6248c37d59a49934e358276da5d3ac211ea1ccfd0782 SHA512 50c7514f2a1de49df6300d292e1f00e746b341e9c70dbfc3508663870ddf92f5c8e0ea981dc7742f888428845e90bce2cce8b158e8548039be4c2c06ee76db97 WHIRLPOOL 95db573c6c291d27187af9403694bcff27add7ad378b105df96f988074480b7a1491710681a93f1396dfa33cfa8c493637564ab7fc228e9e92659c385aa769a2
-EBUILD beautifulsoup-3.1.0.1-r1.ebuild 1322 SHA256 1842b02302d10443ccb2fd8936fcdcc27ea4f13b0a81b65c96e5cbfaa7aa4b70 SHA512 ce26dc242f5c0e8535431dfc30b67262f628f8431fe4cd6c7cc1ff7ff79c41e5d7c050300bd4598d7e0e7125d099008ac47f0641cbd95cc5297495cd5293c316 WHIRLPOOL 764fbfeb89a37d8ad8b0891343f9e992edff735d6108281f61c83aa14978239bc8a3a4da19f7bcdbb19c447cdf638f13596cf2c6891b28786d9e84aad8e6ad13
EBUILD beautifulsoup-3.2.0.ebuild 1128 SHA256 562ccb3c02dedd76df2e0853bf040443b94d44450162daa39339f00adcdfb82a SHA512 b54870de0e10b191d90b17a7695eb74cad253a6a3f06621cdd86c722bc4ffba2f0d2e216c8d3da13d4a4894d2aa5c08f21299748351224e21772d985fcccfffb WHIRLPOOL 8aeaf761c91bd819860a68b910d252e07e55a0461b3d5a75ecbf0edcc051d43f34cbce4df6b5a0aa0d182b727d8e5b5d807e7091ff1d206bd3411f3a711bb814
EBUILD beautifulsoup-3.2.1-r1.ebuild 1009 SHA256 1800cc0ed032ee002d4f29ca805e2c0abd6dd81954a5aa098e37bd3bf843fb95 SHA512 379e343e470447eb37e61c40c79692a44e17b0b6f3d12f6d2663d9cf2d47ab00ccb66e6ea184502bf40f755277b16eafb53685efdaddbd1dbe36649fe5370327 WHIRLPOOL bc3b3d3719d90672f8492c6df4d74ac09330c370b1b8653e8c3d02f9b73a5971a50d5fb3b1b13fa9c986944e2495d228841ae1e901a0af4b2481735406e1e732
EBUILD beautifulsoup-3.2.1.ebuild 1136 SHA256 7f64d7e6d2877eec779d5df93d7612647a205ef62b066c7aee5606f7cb080d52 SHA512 6fa414de24084e6cb9f37db24fb40c8fca01104ccefe7114b5d880899284fa12aed02d25cd9247ed9ce0d0780bc234bfd68347638d8beef9c39d82ae9a8f11e7 WHIRLPOOL 154e07b1641bb6c73151fa2f7fac00a273ca20f6fb22129876ded9c8a9101437e66f44a49d74bac70290a2bbead9d123deda55322fdfe544235666c2b97125e7
-EBUILD beautifulsoup-4.1.3-r1.ebuild 1284 SHA256 affe563f8db2596b0c5acf71092dd8cd22147ea70c8603b32cb01c2246588998 SHA512 3fa663b4a77754d758af79da0fea4def7ade81f7f05980f5d9cfe9f7f9199a41a5b02adaf91b9c907b6308bf4cb4e97c883332076f57820e5c62855dbe1a7842 WHIRLPOOL 3b6feef4a1d758ea6f3bcb1f7ea8060086d548aa60fb41f04af5efa1455fa2f1d260c22690bd90e84bc2cb4936603915194e4706f0306f52d8ac6dbc177c8d74
+EBUILD beautifulsoup-4.1.3-r1.ebuild 1465 SHA256 53d33b66e0935b093f32ed5bc27aee8a16f2e51dcd0234ce210c56432a972d6c SHA512 1550d56bd7c868ffba7bd7c321a29bd6a7b3e8f5390571c30e6892fd379b2c8b77b160f7780f9d411c6c97f5fbd4947d3d8042b889069627d45770de7740a4db WHIRLPOOL 34420738bca71d6be877cd376eff35443fa3ccfa58fb540c84bc3df5e3d702ce8581eca4fa7ae1932b1b0a9f226053658d712178e3ea57a273b697ba3e070024
EBUILD beautifulsoup-4.1.3.ebuild 1373 SHA256 213867555347809a1fa6e5c4e9a41a1459ddc17d0cc6a763a6f53f92de251b47 SHA512 38bee8dc5953bfcc6ef1e9e0a30dc52463c07b088d6f3cbceafedb1e7981f3873ef7a0645b99c9aa86a15a021127e48b76666de4675a5bccadf43e5d16f9f0be WHIRLPOOL cbbf07d608bea1f533aad98e13a7169e30059cbe47c23def7b0e6406ccfee0c4de96b6fa04593d383e929bea958a5fc3446a669a70295dffc8ea8888a89c833c
-EBUILD beautifulsoup-4.2.0.ebuild 1262 SHA256 8e5c585ff7124c1678f03c5e4c623b37cacef011558ac06aefb0018812176175 SHA512 862161e93cf187ab62a6424f151a7df4ae31a411d4d471f8ff8716eeafa72d9e4b8bd2ec0e073d586f3185c45651558d07d9b814ac71ff4340aa5fc6fe4e7b73 WHIRLPOOL aac7256e3ee8c9344527e79e6109a3fe4ad19dedbc23d97d1faa63e48cfed2f12d31206b9494df6a4ec58b0c41a110cad0eb2373e9496d4cb2c774149c6b69e8
+EBUILD beautifulsoup-4.2.0.ebuild 1545 SHA256 c897a253f4a7c119547be9fa9ffe042f97084eaf0bea45cede01c294667c6df9 SHA512 51956b04517aff0f3c2f8586fe4e86e3ebccd2b4cb6668103bb88f47e484f2af662cdf8c43a70cfb4542ccbdcdaaaa6db13f6ad107fb38e1d1a10f9234eb3375 WHIRLPOOL 2c842ec4f7fea3d798ea74a3874511442ca49d01b6f3a4bbfa1b54d015ff5f7b35a7e67f905ae346cce88978fda66e685f8b251b0bdc9cb6b3a9115c4769f962
MISC ChangeLog 12047 SHA256 474be0b21284a6a09a9a18767efcfbdaee0e60e0b86d101e0945197ca9423030 SHA512 f2a5a9180e9cebf8e0a6b15ad5ff938912fddf50c53dd60d5e40195e04741cc5a6b5982a6f1e3b4d95c1758065dcea45fb9b629f2bd941c71709c815a3d9923d WHIRLPOOL 4ea37c60a59486b0f378cbb61b8c6e1007b1a7a0ba474ff9b0b50b6862d192623d73105096da5f1015d5c374c3eb55fe13585d07ab02561b48b9b0c330eaa516
-MISC metadata.xml 640 SHA256 c24a9868c6b553732e13ee16e41586d8003da55cbdde41d684e4260108f6da51 SHA512 db0d5d29bc3a9de492c06a8c46d34797ade006804ade98b889acfa143417d4aca83ae0b0e73e0207a602fcc3bf0a96d3bb6b60a083a5407e3ab700dc4c4d9433 WHIRLPOOL 930aeab34aca3409796fc06941389e6d3d65f666abe6b30033b5da7af1fa78fab8c16c4190d0276e936c20ca6f0a14929815acd32331f3017458f9ff94bdd456
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.19 (GNU/Linux)
-
-iQEcBAEBCAAGBQJRlyc3AAoJEEqz6FtPBkyjmIUIAJyFV5NAXvniCvN+yGCWxc8M
-lH4qKH/z/WygirMDucF7TbAH6cd9q2gqtMwpYmpM92jHpx44hUlYhcIRfNnd2dmU
-R56q0oVkTuYham+7Z3zwvzXyJErgxneNDFFSA9qMdkjiJGfZKEe9lA+szKkMB0S8
-bcO2TgQEkCyMr4+bVT+ZEvsL00p3j26gmjPRvrSmM9W9jqaZ6tp4eDVgrjASJblh
-f2HBVmeBuQryJyvIZE/MClZfXSPfxtC4/qmTVcEjWBZBzU2hhBSpDH6qyNKEdmXE
-yc/Tw/b2r1Lo85qw1HzFxv4WQ6uU9XLQcd5DG7kD1bULJ1PxFnbzZhSpyYyZfCM=
-=guvV
------END PGP SIGNATURE-----
+MISC metadata.xml 705 SHA256 3cf5d32b59791adafd4388a987fe8cf8b60c1c86a67d94b4ff1de8fb76881caf SHA512 9d6f5cdef3b1b438a23086c3312e9d8059cea96557d5676d8e80fb4ca597d4525eab0ca0f9f237348aa243e8598fb3d24a461fcac679808fd2c740ee7b86f25c WHIRLPOOL 4a107e5e9f57e14f029cc444eb2529c25eb4717512d5776e3c99b27e920a62fe9ecb47c351489b0583a31ce363a5c693d1ee1c666e48267afff6c3daf666173f
diff --git a/dev-python/beautifulsoup/beautifulsoup-3.1.0.1-r1.ebuild b/dev-python/beautifulsoup/beautifulsoup-3.1.0.1-r1.ebuild
deleted file mode 100644
index 6e1bdb067e77..000000000000
--- a/dev-python/beautifulsoup/beautifulsoup-3.1.0.1-r1.ebuild
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/beautifulsoup/beautifulsoup-3.1.0.1-r1.ebuild,v 1.16 2012/10/13 18:41:14 armin76 Exp $
-
-EAPI="3"
-PYTHON_DEPEND="3"
-SUPPORT_PYTHON_ABIS="1"
-# Avoid collisions with python-2 slot.
-RESTRICT_PYTHON_ABIS="2.* *-jython"
-
-inherit distutils eutils
-
-MY_PN="BeautifulSoup"
-MY_P="${MY_PN}-${PV}"
-
-DESCRIPTION="HTML/XML parser for quick-turnaround applications like screen-scraping."
-HOMEPAGE="http://www.crummy.com/software/BeautifulSoup/ http://pypi.python.org/pypi/BeautifulSoup"
-SRC_URI="http://www.crummy.com/software/${MY_PN}/download/${MY_P}.tar.gz"
-
-LICENSE="BSD"
-SLOT="python-3"
-KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ppc ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
-IUSE=""
-
-DEPEND=""
-RDEPEND="!dev-python/beautifulsoup:0"
-
-S="${WORKDIR}/${MY_P}"
-
-PYTHON_MODNAME="BeautifulSoup.py BeautifulSoupTests.py"
-
-src_prepare() {
- distutils_src_prepare
- epatch "${FILESDIR}/${P}-python-3.patch"
-}
-
-src_test() {
- testing() {
- PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" BeautifulSoupTests.py
- }
- python_execute_function testing
-}
-
-src_install() {
- distutils_src_install
-
- # Delete useless files.
- rm -fr "${ED}usr/bin"
-}
diff --git a/dev-python/beautifulsoup/beautifulsoup-4.1.3-r1.ebuild b/dev-python/beautifulsoup/beautifulsoup-4.1.3-r1.ebuild
index 042a0e937eaf..22f4c60b2b77 100644
--- a/dev-python/beautifulsoup/beautifulsoup-4.1.3-r1.ebuild
+++ b/dev-python/beautifulsoup/beautifulsoup-4.1.3-r1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/beautifulsoup/beautifulsoup-4.1.3-r1.ebuild,v 1.6 2013/05/03 07:07:04 idella4 Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/beautifulsoup/beautifulsoup-4.1.3-r1.ebuild,v 1.7 2013/05/22 15:29:59 idella4 Exp $
EAPI=5
@@ -18,12 +18,14 @@ SRC_URI="mirror://pypi/${MY_P:0:1}/${MY_PN}/${MY_P}.tar.gz"
LICENSE="MIT"
SLOT="4"
KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
-IUSE="doc test"
-
-DEPEND="doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
- test? ( dev-python/nose[${PYTHON_USEDEP}]
- dev-python/lxml[${PYTHON_USEDEP}] )"
-RDEPEND=""
+# new html5 awaits keywording of html5lib in Bug 471002
+IUSE="doc +lxml test"
+# pending Bug 471002; html5? ( dev-python/html5lib[$(python_gen_usedep 'python{2_6,2_7}' pypy2_0)] )
+
+RDEPEND="lxml? ( dev-python/lxml[${PYTHON_USEDEP}] )"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
+ test? ( dev-python/nose[${PYTHON_USEDEP}] )"
S="${WORKDIR}/${MY_P}"
diff --git a/dev-python/beautifulsoup/beautifulsoup-4.2.0.ebuild b/dev-python/beautifulsoup/beautifulsoup-4.2.0.ebuild
index 35f90600d2a6..cd5beb513e45 100644
--- a/dev-python/beautifulsoup/beautifulsoup-4.2.0.ebuild
+++ b/dev-python/beautifulsoup/beautifulsoup-4.2.0.ebuild
@@ -1,9 +1,9 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/beautifulsoup/beautifulsoup-4.2.0.ebuild,v 1.1 2013/05/18 07:01:07 radhermit Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/beautifulsoup/beautifulsoup-4.2.0.ebuild,v 1.2 2013/05/22 15:29:59 idella4 Exp $
EAPI=5
-PYTHON_COMPAT=( python{2_6,2_7,3_1,3_2,3_3} )
+PYTHON_COMPAT=( python{2_6,2_7,3_1,3_2,3_3} pypy2_0 )
inherit distutils-r1
@@ -18,16 +18,19 @@ SRC_URI="mirror://pypi/${MY_P:0:1}/${MY_PN}/${MY_P}.tar.gz"
LICENSE="MIT"
SLOT="4"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
-IUSE="doc test"
+# new html5 awaits keywording of html5lib in Bug 471002
+IUSE="doc +lxml test"
+# pending Bug 471002; html5? ( dev-python/html5lib[$(python_gen_usedep 'python{2_6,2_7}' pypy2_0)] )
-DEPEND="doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
- test? (
- dev-python/nose[${PYTHON_USEDEP}]
- dev-python/lxml[${PYTHON_USEDEP}]
- )"
+RDEPEND="lxml? ( dev-python/lxml[$(python_gen_usedep 'python{2_6,2_7}' 'python3*')] )"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
+ test? ( dev-python/nose[${PYTHON_USEDEP}] )"
S=${WORKDIR}/${MY_P}
+PATCHES=( "${FILESDIR}"/bfs-${PV}-no-lxml.patch )
+
python_compile_all() {
if use doc; then
emake -C doc html
diff --git a/dev-python/beautifulsoup/files/beautifulsoup-3.1.0.1-python-3.patch b/dev-python/beautifulsoup/files/beautifulsoup-3.1.0.1-python-3.patch
deleted file mode 100644
index adcbb43dd078..000000000000
--- a/dev-python/beautifulsoup/files/beautifulsoup-3.1.0.1-python-3.patch
+++ /dev/null
@@ -1,949 +0,0 @@
---- BeautifulSoup.py
-+++ BeautifulSoup.py
-@@ -76,7 +76,7 @@
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE, DAMMIT.
-
- """
--from __future__ import generators
-+
-
- __author__ = "Leonard Richardson (leonardr@segfault.org)"
- __version__ = "3.1.0.1"
-@@ -84,12 +84,12 @@
- __license__ = "New-style BSD"
-
- import codecs
--import markupbase
-+import _markupbase
- import types
- import re
--from HTMLParser import HTMLParser, HTMLParseError
-+from html.parser import HTMLParser, HTMLParseError
- try:
-- from htmlentitydefs import name2codepoint
-+ from html.entities import name2codepoint
- except ImportError:
- name2codepoint = {}
- try:
-@@ -98,18 +98,18 @@
- from sets import Set as set
-
- #These hacks make Beautiful Soup able to parse XML with namespaces
--markupbase._declname_match = re.compile(r'[a-zA-Z][-_.:a-zA-Z0-9]*\s*').match
-+_markupbase._declname_match = re.compile(r'[a-zA-Z][-_.:a-zA-Z0-9]*\s*').match
-
- DEFAULT_OUTPUT_ENCODING = "utf-8"
-
- # First, the classes that represent markup elements.
-
--def sob(unicode, encoding):
-+def sob(str, encoding):
- """Returns either the given Unicode string or its encoding."""
- if encoding is None:
-- return unicode
-+ return str
- else:
-- return unicode.encode(encoding)
-+ return str.encode(encoding)
-
- class PageElement:
- """Contains the navigational information for some part of the page
-@@ -178,8 +178,8 @@
- return lastChild
-
- def insert(self, position, newChild):
-- if (isinstance(newChild, basestring)
-- or isinstance(newChild, unicode)) \
-+ if (isinstance(newChild, str)
-+ or isinstance(newChild, str)) \
- and not isinstance(newChild, NavigableString):
- newChild = NavigableString(newChild)
-
-@@ -334,7 +334,7 @@
- g = generator()
- while True:
- try:
-- i = g.next()
-+ i = g.__next__()
- except StopIteration:
- break
- if i:
-@@ -385,22 +385,22 @@
- def toEncoding(self, s, encoding=None):
- """Encodes an object to a string in some encoding, or to Unicode.
- ."""
-- if isinstance(s, unicode):
-+ if isinstance(s, str):
- if encoding:
- s = s.encode(encoding)
- elif isinstance(s, str):
- if encoding:
- s = s.encode(encoding)
- else:
-- s = unicode(s)
-+ s = str(s)
- else:
- if encoding:
- s = self.toEncoding(str(s), encoding)
- else:
-- s = unicode(s)
-+ s = str(s)
- return s
-
--class NavigableString(unicode, PageElement):
-+class NavigableString(str, PageElement):
-
- def __new__(cls, value):
- """Create a new NavigableString.
-@@ -410,12 +410,12 @@
- passed in to the superclass's __new__ or the superclass won't know
- how to handle non-ASCII characters.
- """
-- if isinstance(value, unicode):
-- return unicode.__new__(cls, value)
-- return unicode.__new__(cls, value, DEFAULT_OUTPUT_ENCODING)
-+ if isinstance(value, str):
-+ return str.__new__(cls, value)
-+ return str.__new__(cls, value, DEFAULT_OUTPUT_ENCODING)
-
- def __getnewargs__(self):
-- return (unicode(self),)
-+ return (str(self),)
-
- def __getattr__(self, attr):
- """text.string gives you text. This is for backwards
-@@ -424,7 +424,7 @@
- if attr == 'string':
- return self
- else:
-- raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__, attr)
-+ raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, attr))
-
- def encode(self, encoding=DEFAULT_OUTPUT_ENCODING):
- return self.decode().encode(encoding)
-@@ -435,23 +435,23 @@
- class CData(NavigableString):
-
- def decodeGivenEventualEncoding(self, eventualEncoding):
-- return u'<![CDATA[' + self + u']]>'
-+ return '<![CDATA[' + self + ']]>'
-
- class ProcessingInstruction(NavigableString):
-
- def decodeGivenEventualEncoding(self, eventualEncoding):
- output = self
-- if u'%SOUP-ENCODING%' in output:
-+ if '%SOUP-ENCODING%' in output:
- output = self.substituteEncoding(output, eventualEncoding)
-- return u'<?' + output + u'?>'
-+ return '<?' + output + '?>'
-
- class Comment(NavigableString):
- def decodeGivenEventualEncoding(self, eventualEncoding):
-- return u'<!--' + self + u'-->'
-+ return '<!--' + self + '-->'
-
- class Declaration(NavigableString):
- def decodeGivenEventualEncoding(self, eventualEncoding):
-- return u'<!' + self + u'>'
-+ return '<!' + self + '>'
-
- class Tag(PageElement):
-
-@@ -460,7 +460,7 @@
- def _invert(h):
- "Cheap function to invert a hash."
- i = {}
-- for k,v in h.items():
-+ for k,v in list(h.items()):
- i[v] = k
- return i
-
-@@ -479,23 +479,23 @@
- escaped."""
- x = match.group(1)
- if self.convertHTMLEntities and x in name2codepoint:
-- return unichr(name2codepoint[x])
-+ return chr(name2codepoint[x])
- elif x in self.XML_ENTITIES_TO_SPECIAL_CHARS:
- if self.convertXMLEntities:
- return self.XML_ENTITIES_TO_SPECIAL_CHARS[x]
- else:
-- return u'&%s;' % x
-+ return '&%s;' % x
- elif len(x) > 0 and x[0] == '#':
- # Handle numeric entities
- if len(x) > 1 and x[1] == 'x':
-- return unichr(int(x[2:], 16))
-+ return chr(int(x[2:], 16))
- else:
-- return unichr(int(x[1:]))
-+ return chr(int(x[1:]))
-
- elif self.escapeUnrecognizedEntities:
-- return u'&amp;%s;' % x
-+ return '&amp;%s;' % x
- else:
-- return u'&%s;' % x
-+ return '&%s;' % x
-
- def __init__(self, parser, name, attrs=None, parent=None,
- previous=None):
-@@ -524,7 +524,7 @@
- return kval
- return (k, re.sub("&(#\d+|#x[0-9a-fA-F]+|\w+);",
- self._convertEntities, val))
-- self.attrs = map(convert, self.attrs)
-+ self.attrs = list(map(convert, self.attrs))
-
- def get(self, key, default=None):
- """Returns the value of the 'key' attribute for the tag, or
-@@ -533,7 +533,7 @@
- return self._getAttrMap().get(key, default)
-
- def has_key(self, key):
-- return self._getAttrMap().has_key(key)
-+ return key in self._getAttrMap()
-
- def __getitem__(self, key):
- """tag[key] returns the value of the 'key' attribute for the tag,
-@@ -551,7 +551,7 @@
- def __contains__(self, x):
- return x in self.contents
-
-- def __nonzero__(self):
-+ def __bool__(self):
- "A tag is non-None even if it has no contents."
- return True
-
-@@ -577,14 +577,14 @@
- #We don't break because bad HTML can define the same
- #attribute multiple times.
- self._getAttrMap()
-- if self.attrMap.has_key(key):
-+ if key in self.attrMap:
- del self.attrMap[key]
-
- def __call__(self, *args, **kwargs):
- """Calling a tag like a function is the same as calling its
- findAll() method. Eg. tag('a') returns a list of all the A tags
- found within this tag."""
-- return apply(self.findAll, args, kwargs)
-+ return self.findAll(*args, **kwargs)
-
- def __getattr__(self, tag):
- #print "Getattr %s.%s" % (self.__class__, tag)
-@@ -592,7 +592,7 @@
- return self.find(tag[:-3])
- elif tag.find('__') != 0:
- return self.find(tag)
-- raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__, tag)
-+ raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__, tag))
-
- def __eq__(self, other):
- """Returns true iff this tag has the same name, the same attributes,
-@@ -868,7 +868,7 @@
- if isinstance(markupName, Tag):
- markup = markupName
- markupAttrs = markup
-- callFunctionWithTagData = callable(self.name) \
-+ callFunctionWithTagData = hasattr(self.name, '__call__') \
- and not isinstance(markupName, Tag)
-
- if (not self.name) \
-@@ -880,7 +880,7 @@
- else:
- match = True
- markupAttrMap = None
-- for attr, matchAgainst in self.attrs.items():
-+ for attr, matchAgainst in list(self.attrs.items()):
- if not markupAttrMap:
- if hasattr(markupAttrs, 'get'):
- markupAttrMap = markupAttrs
-@@ -921,16 +921,16 @@
- if self._matches(markup, self.text):
- found = markup
- else:
-- raise Exception, "I don't know how to match against a %s" \
-- % markup.__class__
-+ raise Exception("I don't know how to match against a %s" \
-+ % markup.__class__)
- return found
-
- def _matches(self, markup, matchAgainst):
- #print "Matching %s against %s" % (markup, matchAgainst)
- result = False
-- if matchAgainst == True and type(matchAgainst) == types.BooleanType:
-+ if matchAgainst == True and type(matchAgainst) == bool:
- result = markup != None
-- elif callable(matchAgainst):
-+ elif hasattr(matchAgainst, '__call__'):
- result = matchAgainst(markup)
- else:
- #Custom match methods take the tag as an argument, but all
-@@ -938,7 +938,7 @@
- if isinstance(markup, Tag):
- markup = markup.name
- if markup is not None and not isString(markup):
-- markup = unicode(markup)
-+ markup = str(markup)
- #Now we know that chunk is either a string, or None.
- if hasattr(matchAgainst, 'match'):
- # It's a regexp object.
-@@ -947,10 +947,10 @@
- and (markup is not None or not isString(matchAgainst))):
- result = markup in matchAgainst
- elif hasattr(matchAgainst, 'items'):
-- result = markup.has_key(matchAgainst)
-+ result = matchAgainst in markup
- elif matchAgainst and isString(markup):
-- if isinstance(markup, unicode):
-- matchAgainst = unicode(matchAgainst)
-+ if isinstance(markup, str):
-+ matchAgainst = str(matchAgainst)
- else:
- matchAgainst = str(matchAgainst)
-
-@@ -971,13 +971,13 @@
- """Convenience method that works with all 2.x versions of Python
- to determine whether or not something is listlike."""
- return ((hasattr(l, '__iter__') and not isString(l))
-- or (type(l) in (types.ListType, types.TupleType)))
-+ or (type(l) in (list, tuple)))
-
- def isString(s):
- """Convenience method that works with all 2.x versions of Python
- to determine whether or not something is stringlike."""
- try:
-- return isinstance(s, unicode) or isinstance(s, basestring)
-+ return isinstance(s, str) or isinstance(s, str)
- except NameError:
- return isinstance(s, str)
-
-@@ -989,7 +989,7 @@
- for portion in args:
- if hasattr(portion, 'items'):
- #It's a map. Merge it.
-- for k,v in portion.items():
-+ for k,v in list(portion.items()):
- built[k] = v
- elif isList(portion) and not isString(portion):
- #It's a list. Map each item to the default.
-@@ -1034,7 +1034,7 @@
- object, possibly one with a %SOUP-ENCODING% slot into which an
- encoding will be plugged later."""
- if text[:3] == "xml":
-- text = u"xml version='1.0' encoding='%SOUP-ENCODING%'"
-+ text = "xml version='1.0' encoding='%SOUP-ENCODING%'"
- self._toStringSubclass(text, ProcessingInstruction)
-
- def handle_comment(self, text):
-@@ -1044,7 +1044,7 @@
- def handle_charref(self, ref):
- "Handle character references as data."
- if self.soup.convertEntities:
-- data = unichr(int(ref))
-+ data = chr(int(ref))
- else:
- data = '&#%s;' % ref
- self.handle_data(data)
-@@ -1056,7 +1056,7 @@
- data = None
- if self.soup.convertHTMLEntities:
- try:
-- data = unichr(name2codepoint[ref])
-+ data = chr(name2codepoint[ref])
- except KeyError:
- pass
-
-@@ -1147,7 +1147,7 @@
- lambda x: '<!' + x.group(1) + '>')
- ]
-
-- ROOT_TAG_NAME = u'[document]'
-+ ROOT_TAG_NAME = '[document]'
-
- HTML_ENTITIES = "html"
- XML_ENTITIES = "xml"
-@@ -1236,14 +1236,14 @@
- def _feed(self, inDocumentEncoding=None, isHTML=False):
- # Convert the document to Unicode.
- markup = self.markup
-- if isinstance(markup, unicode):
-+ if isinstance(markup, str):
- if not hasattr(self, 'originalEncoding'):
- self.originalEncoding = None
- else:
- dammit = UnicodeDammit\
- (markup, [self.fromEncoding, inDocumentEncoding],
- smartQuotesTo=self.smartQuotesTo, isHTML=isHTML)
-- markup = dammit.unicode
-+ markup = dammit.str
- self.originalEncoding = dammit.originalEncoding
- self.declaredHTMLEncoding = dammit.declaredHTMLEncoding
- if markup:
-@@ -1269,8 +1269,8 @@
- def isSelfClosingTag(self, name):
- """Returns true iff the given string is the name of a
- self-closing tag according to this parser."""
-- return self.SELF_CLOSING_TAGS.has_key(name) \
-- or self.instanceSelfClosingTags.has_key(name)
-+ return name in self.SELF_CLOSING_TAGS \
-+ or name in self.instanceSelfClosingTags
-
- def reset(self):
- Tag.__init__(self, self, self.ROOT_TAG_NAME)
-@@ -1305,7 +1305,7 @@
-
- def endData(self, containerClass=NavigableString):
- if self.currentData:
-- currentData = u''.join(self.currentData)
-+ currentData = ''.join(self.currentData)
- if (currentData.translate(self.STRIP_ASCII_SPACES) == '' and
- not set([tag.name for tag in self.tagStack]).intersection(
- self.PRESERVE_WHITESPACE_TAGS)):
-@@ -1368,7 +1368,7 @@
-
- nestingResetTriggers = self.NESTABLE_TAGS.get(name)
- isNestable = nestingResetTriggers != None
-- isResetNesting = self.RESET_NESTING_TAGS.has_key(name)
-+ isResetNesting = name in self.RESET_NESTING_TAGS
- popTo = None
- inclusive = True
- for i in range(len(self.tagStack)-1, 0, -1):
-@@ -1381,7 +1381,7 @@
- if (nestingResetTriggers != None
- and p.name in nestingResetTriggers) \
- or (nestingResetTriggers == None and isResetNesting
-- and self.RESET_NESTING_TAGS.has_key(p.name)):
-+ and p.name in self.RESET_NESTING_TAGS):
-
- #If we encounter one of the nesting reset triggers
- #peculiar to this tag, or we encounter another tag
-@@ -1399,7 +1399,7 @@
- if self.quoteStack:
- #This is not a real tag.
- #print "<%s> is not real!" % name
-- attrs = ''.join(map(lambda(x, y): ' %s="%s"' % (x, y), attrs))
-+ attrs = ''.join([' %s="%s"' % (x_y[0], x_y[1]) for x_y in attrs])
- self.handle_data('<%s%s>' % (name, attrs))
- return
- self.endData()
-@@ -1493,7 +1493,7 @@
- BeautifulStoneSoup before writing your own subclass."""
-
- def __init__(self, *args, **kwargs):
-- if not kwargs.has_key('smartQuotesTo'):
-+ if 'smartQuotesTo' not in kwargs:
- kwargs['smartQuotesTo'] = self.HTML_ENTITIES
- kwargs['isHTML'] = True
- BeautifulStoneSoup.__init__(self, *args, **kwargs)
-@@ -1677,7 +1677,7 @@
- parent._getAttrMap()
- if (isinstance(tag, Tag) and len(tag.contents) == 1 and
- isinstance(tag.contents[0], NavigableString) and
-- not parent.attrMap.has_key(tag.name)):
-+ tag.name not in parent.attrMap):
- parent[tag.name] = tag.contents[0]
- BeautifulStoneSoup.popTag(self)
-
-@@ -1751,9 +1751,9 @@
- self._detectEncoding(markup, isHTML)
- self.smartQuotesTo = smartQuotesTo
- self.triedEncodings = []
-- if markup == '' or isinstance(markup, unicode):
-+ if markup == '' or isinstance(markup, str):
- self.originalEncoding = None
-- self.unicode = unicode(markup)
-+ self.str = str(markup)
- return
-
- u = None
-@@ -1766,7 +1766,7 @@
- if u: break
-
- # If no luck and we have auto-detection library, try that:
-- if not u and chardet and not isinstance(self.markup, unicode):
-+ if not u and chardet and not isinstance(self.markup, str):
- u = self._convertFrom(chardet.detect(self.markup)['encoding'])
-
- # As a last resort, try utf-8 and windows-1252:
-@@ -1775,7 +1775,7 @@
- u = self._convertFrom(proposed_encoding)
- if u: break
-
-- self.unicode = u
-+ self.str = u
- if not u: self.originalEncoding = None
-
- def _subMSChar(self, match):
-@@ -1783,7 +1783,7 @@
- entity."""
- orig = match.group(1)
- sub = self.MS_CHARS.get(orig)
-- if type(sub) == types.TupleType:
-+ if type(sub) == tuple:
- if self.smartQuotesTo == 'xml':
- sub = '&#x'.encode() + sub[1].encode() + ';'.encode()
- else:
-@@ -1804,7 +1804,7 @@
- if self.smartQuotesTo and proposed.lower() in("windows-1252",
- "iso-8859-1",
- "iso-8859-2"):
-- smart_quotes_re = "([\x80-\x9f])"
-+ smart_quotes_re = b"([\x80-\x9f])"
- smart_quotes_compiled = re.compile(smart_quotes_re)
- markup = smart_quotes_compiled.sub(self._subMSChar, markup)
-
-@@ -1813,7 +1813,7 @@
- u = self._toUnicode(markup, proposed)
- self.markup = u
- self.originalEncoding = proposed
-- except Exception, e:
-+ except Exception as e:
- # print "That didn't work!"
- # print e
- return None
-@@ -1842,7 +1842,7 @@
- elif data[:4] == '\xff\xfe\x00\x00':
- encoding = 'utf-32le'
- data = data[4:]
-- newdata = unicode(data, encoding)
-+ newdata = str(data, encoding)
- return newdata
-
- def _detectEncoding(self, xml_data, isHTML=False):
-@@ -1855,41 +1855,41 @@
- elif xml_data[:4] == '\x00\x3c\x00\x3f':
- # UTF-16BE
- sniffed_xml_encoding = 'utf-16be'
-- xml_data = unicode(xml_data, 'utf-16be').encode('utf-8')
-+ xml_data = str(xml_data, 'utf-16be').encode('utf-8')
- elif (len(xml_data) >= 4) and (xml_data[:2] == '\xfe\xff') \
- and (xml_data[2:4] != '\x00\x00'):
- # UTF-16BE with BOM
- sniffed_xml_encoding = 'utf-16be'
-- xml_data = unicode(xml_data[2:], 'utf-16be').encode('utf-8')
-+ xml_data = str(xml_data[2:], 'utf-16be').encode('utf-8')
- elif xml_data[:4] == '\x3c\x00\x3f\x00':
- # UTF-16LE
- sniffed_xml_encoding = 'utf-16le'
-- xml_data = unicode(xml_data, 'utf-16le').encode('utf-8')
-+ xml_data = str(xml_data, 'utf-16le').encode('utf-8')
- elif (len(xml_data) >= 4) and (xml_data[:2] == '\xff\xfe') and \
- (xml_data[2:4] != '\x00\x00'):
- # UTF-16LE with BOM
- sniffed_xml_encoding = 'utf-16le'
-- xml_data = unicode(xml_data[2:], 'utf-16le').encode('utf-8')
-+ xml_data = str(xml_data[2:], 'utf-16le').encode('utf-8')
- elif xml_data[:4] == '\x00\x00\x00\x3c':
- # UTF-32BE
- sniffed_xml_encoding = 'utf-32be'
-- xml_data = unicode(xml_data, 'utf-32be').encode('utf-8')
-+ xml_data = str(xml_data, 'utf-32be').encode('utf-8')
- elif xml_data[:4] == '\x3c\x00\x00\x00':
- # UTF-32LE
- sniffed_xml_encoding = 'utf-32le'
-- xml_data = unicode(xml_data, 'utf-32le').encode('utf-8')
-+ xml_data = str(xml_data, 'utf-32le').encode('utf-8')
- elif xml_data[:4] == '\x00\x00\xfe\xff':
- # UTF-32BE with BOM
- sniffed_xml_encoding = 'utf-32be'
-- xml_data = unicode(xml_data[4:], 'utf-32be').encode('utf-8')
-+ xml_data = str(xml_data[4:], 'utf-32be').encode('utf-8')
- elif xml_data[:4] == '\xff\xfe\x00\x00':
- # UTF-32LE with BOM
- sniffed_xml_encoding = 'utf-32le'
-- xml_data = unicode(xml_data[4:], 'utf-32le').encode('utf-8')
-+ xml_data = str(xml_data[4:], 'utf-32le').encode('utf-8')
- elif xml_data[:3] == '\xef\xbb\xbf':
- # UTF-8 with BOM
- sniffed_xml_encoding = 'utf-8'
-- xml_data = unicode(xml_data[3:], 'utf-8').encode('utf-8')
-+ xml_data = str(xml_data[3:], 'utf-8').encode('utf-8')
- else:
- sniffed_xml_encoding = 'ascii'
- pass
-@@ -1954,41 +1954,41 @@
- 250,251,252,253,254,255)
- import string
- c.EBCDIC_TO_ASCII_MAP = string.maketrans( \
-- ''.join(map(chr, range(256))), ''.join(map(chr, emap)))
-+ ''.join(map(chr, list(range(256)))), ''.join(map(chr, emap)))
- return s.translate(c.EBCDIC_TO_ASCII_MAP)
-
-- MS_CHARS = { '\x80' : ('euro', '20AC'),
-- '\x81' : ' ',
-- '\x82' : ('sbquo', '201A'),
-- '\x83' : ('fnof', '192'),
-- '\x84' : ('bdquo', '201E'),
-- '\x85' : ('hellip', '2026'),
-- '\x86' : ('dagger', '2020'),
-- '\x87' : ('Dagger', '2021'),
-- '\x88' : ('circ', '2C6'),
-- '\x89' : ('permil', '2030'),
-- '\x8A' : ('Scaron', '160'),
-- '\x8B' : ('lsaquo', '2039'),
-- '\x8C' : ('OElig', '152'),
-- '\x8D' : '?',
-- '\x8E' : ('#x17D', '17D'),
-- '\x8F' : '?',
-- '\x90' : '?',
-- '\x91' : ('lsquo', '2018'),
-- '\x92' : ('rsquo', '2019'),
-- '\x93' : ('ldquo', '201C'),
-- '\x94' : ('rdquo', '201D'),
-- '\x95' : ('bull', '2022'),
-- '\x96' : ('ndash', '2013'),
-- '\x97' : ('mdash', '2014'),
-- '\x98' : ('tilde', '2DC'),
-- '\x99' : ('trade', '2122'),
-- '\x9a' : ('scaron', '161'),
-- '\x9b' : ('rsaquo', '203A'),
-- '\x9c' : ('oelig', '153'),
-- '\x9d' : '?',
-- '\x9e' : ('#x17E', '17E'),
-- '\x9f' : ('Yuml', ''),}
-+ MS_CHARS = { b'\x80' : ('euro', '20AC'),
-+ b'\x81' : ' ',
-+ b'\x82' : ('sbquo', '201A'),
-+ b'\x83' : ('fnof', '192'),
-+ b'\x84' : ('bdquo', '201E'),
-+ b'\x85' : ('hellip', '2026'),
-+ b'\x86' : ('dagger', '2020'),
-+ b'\x87' : ('Dagger', '2021'),
-+ b'\x88' : ('circ', '2C6'),
-+ b'\x89' : ('permil', '2030'),
-+ b'\x8A' : ('Scaron', '160'),
-+ b'\x8B' : ('lsaquo', '2039'),
-+ b'\x8C' : ('OElig', '152'),
-+ b'\x8D' : '?',
-+ b'\x8E' : ('#x17D', '17D'),
-+ b'\x8F' : '?',
-+ b'\x90' : '?',
-+ b'\x91' : ('lsquo', '2018'),
-+ b'\x92' : ('rsquo', '2019'),
-+ b'\x93' : ('ldquo', '201C'),
-+ b'\x94' : ('rdquo', '201D'),
-+ b'\x95' : ('bull', '2022'),
-+ b'\x96' : ('ndash', '2013'),
-+ b'\x97' : ('mdash', '2014'),
-+ b'\x98' : ('tilde', '2DC'),
-+ b'\x99' : ('trade', '2122'),
-+ b'\x9a' : ('scaron', '161'),
-+ b'\x9b' : ('rsaquo', '203A'),
-+ b'\x9c' : ('oelig', '153'),
-+ b'\x9d' : '?',
-+ b'\x9e' : ('#x17E', '17E'),
-+ b'\x9f' : ('Yuml', ''),}
-
- #######################################################################
-
-@@ -1997,4 +1997,4 @@
- if __name__ == '__main__':
- import sys
- soup = BeautifulSoup(sys.stdin)
-- print soup.prettify()
-+ print(soup.prettify())
---- BeautifulSoupTests.py
-+++ BeautifulSoupTests.py
-@@ -82,7 +82,7 @@
- def testFindAllText(self):
- soup = BeautifulSoup("<html>\xbb</html>")
- self.assertEqual(soup.findAll(text=re.compile('.*')),
-- [u'\xbb'])
-+ ['\xbb'])
-
- def testFindAllByRE(self):
- import re
-@@ -215,7 +215,7 @@
- soup = BeautifulSoup(self.x, parseOnlyThese=strainer)
- self.assertEquals(len(soup), 10)
-
-- strainer = SoupStrainer(text=lambda(x):x[8]=='3')
-+ strainer = SoupStrainer(text=lambda x:x[8]=='3')
- soup = BeautifulSoup(self.x, parseOnlyThese=strainer)
- self.assertEquals(len(soup), 3)
-
-@@ -256,7 +256,7 @@
- self.assertEqual(copied.decode(), self.soup.decode())
-
- def testUnicodePickle(self):
-- import cPickle as pickle
-+ import pickle as pickle
- html = "<b>" + chr(0xc3) + "</b>"
- soup = BeautifulSoup(html)
- dumped = pickle.dumps(soup, pickle.HIGHEST_PROTOCOL)
-@@ -586,23 +586,23 @@
- self.assertEquals(soup.decode(), "<<sacr&eacute; bleu!>>")
-
- soup = BeautifulStoneSoup(text, convertEntities=htmlEnt)
-- self.assertEquals(soup.decode(), u"<<sacr\xe9 bleu!>>")
-+ self.assertEquals(soup.decode(), "<<sacr\xe9 bleu!>>")
-
- # Make sure the "XML", "HTML", and "XHTML" settings work.
- text = "&lt;&trade;&apos;"
- soup = BeautifulStoneSoup(text, convertEntities=xmlEnt)
-- self.assertEquals(soup.decode(), u"<&trade;'")
-+ self.assertEquals(soup.decode(), "<&trade;'")
-
- soup = BeautifulStoneSoup(text, convertEntities=htmlEnt)
-- self.assertEquals(soup.decode(), u"<\u2122&apos;")
-+ self.assertEquals(soup.decode(), "<\u2122&apos;")
-
- soup = BeautifulStoneSoup(text, convertEntities=xhtmlEnt)
-- self.assertEquals(soup.decode(), u"<\u2122'")
-+ self.assertEquals(soup.decode(), "<\u2122'")
-
- def testNonBreakingSpaces(self):
- soup = BeautifulSoup("<a>&nbsp;&nbsp;</a>",
- convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
-- self.assertEquals(soup.decode(), u"<a>\xa0\xa0</a>")
-+ self.assertEquals(soup.decode(), "<a>\xa0\xa0</a>")
-
- def testWhitespaceInDeclaration(self):
- self.assertSoupEquals('<! DOCTYPE>', '<!DOCTYPE>')
-@@ -617,27 +617,27 @@
- self.assertSoupEquals('<b>hello&nbsp;there</b>')
-
- def testEntitiesInAttributeValues(self):
-- self.assertSoupEquals('<x t="x&#241;">', '<x t="x\xc3\xb1"></x>',
-+ self.assertSoupEquals('<x t="x&#241;">', b'<x t="x\xc3\xb1"></x>',
- encoding='utf-8')
-- self.assertSoupEquals('<x t="x&#xf1;">', '<x t="x\xc3\xb1"></x>',
-+ self.assertSoupEquals('<x t="x&#xf1;">', b'<x t="x\xc3\xb1"></x>',
- encoding='utf-8')
-
- soup = BeautifulSoup('<x t="&gt;&trade;">',
- convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
-- self.assertEquals(soup.decode(), u'<x t="&gt;\u2122"></x>')
-+ self.assertEquals(soup.decode(), '<x t="&gt;\u2122"></x>')
-
- uri = "http://crummy.com?sacr&eacute;&amp;bleu"
- link = '<a href="%s"></a>' % uri
-
- soup = BeautifulSoup(link, convertEntities=BeautifulSoup.HTML_ENTITIES)
- self.assertEquals(soup.decode(),
-- link.replace("&eacute;", u"\xe9"))
-+ link.replace("&eacute;", "\xe9"))
-
- uri = "http://crummy.com?sacr&eacute;&bleu"
- link = '<a href="%s"></a>' % uri
- soup = BeautifulSoup(link, convertEntities=BeautifulSoup.HTML_ENTITIES)
- self.assertEquals(soup.a['href'],
-- uri.replace("&eacute;", u"\xe9"))
-+ uri.replace("&eacute;", "\xe9"))
-
- def testNakedAmpersands(self):
- html = {'convertEntities':BeautifulStoneSoup.HTML_ENTITIES}
-@@ -663,13 +663,13 @@
- smart quote fixes."""
-
- def testUnicodeDammitStandalone(self):
-- markup = "<foo>\x92</foo>"
-+ markup = b"<foo>\x92</foo>"
- dammit = UnicodeDammit(markup)
-- self.assertEquals(dammit.unicode, "<foo>&#x2019;</foo>")
-+ self.assertEquals(dammit.str, "<foo>&#x2019;</foo>")
-
-- hebrew = "\xed\xe5\xec\xf9"
-+ hebrew = b"\xed\xe5\xec\xf9"
- dammit = UnicodeDammit(hebrew, ["iso-8859-8"])
-- self.assertEquals(dammit.unicode, u'\u05dd\u05d5\u05dc\u05e9')
-+ self.assertEquals(dammit.str, '\u05dd\u05d5\u05dc\u05e9')
- self.assertEquals(dammit.originalEncoding, 'iso-8859-8')
-
- def testGarbageInGarbageOut(self):
-@@ -677,13 +677,13 @@
- asciiSoup = BeautifulStoneSoup(ascii)
- self.assertEquals(ascii, asciiSoup.decode())
-
-- unicodeData = u"<foo>\u00FC</foo>"
-+ unicodeData = "<foo>\u00FC</foo>"
- utf8 = unicodeData.encode("utf-8")
-- self.assertEquals(utf8, '<foo>\xc3\xbc</foo>')
-+ self.assertEquals(utf8, b'<foo>\xc3\xbc</foo>')
-
- unicodeSoup = BeautifulStoneSoup(unicodeData)
- self.assertEquals(unicodeData, unicodeSoup.decode())
-- self.assertEquals(unicodeSoup.foo.string, u'\u00FC')
-+ self.assertEquals(unicodeSoup.foo.string, '\u00FC')
-
- utf8Soup = BeautifulStoneSoup(utf8, fromEncoding='utf-8')
- self.assertEquals(utf8, utf8Soup.encode('utf-8'))
-@@ -696,18 +696,18 @@
-
- def testHandleInvalidCodec(self):
- for bad_encoding in ['.utf8', '...', 'utF---16.!']:
-- soup = BeautifulSoup(u"Räksmörgås".encode("utf-8"),
-+ soup = BeautifulSoup("Räksmörgås".encode("utf-8"),
- fromEncoding=bad_encoding)
- self.assertEquals(soup.originalEncoding, 'utf-8')
-
- def testUnicodeSearch(self):
-- html = u'<html><body><h1>Räksmörgås</h1></body></html>'
-+ html = '<html><body><h1>Räksmörgås</h1></body></html>'
- soup = BeautifulSoup(html)
-- self.assertEqual(soup.find(text=u'Räksmörgås'),u'Räksmörgås')
-+ self.assertEqual(soup.find(text='Räksmörgås'),'Räksmörgås')
-
- def testRewrittenXMLHeader(self):
-- euc_jp = '<?xml version="1.0 encoding="euc-jp"?>\n<foo>\n\xa4\xb3\xa4\xec\xa4\xcfEUC-JP\xa4\xc7\xa5\xb3\xa1\xbc\xa5\xc7\xa5\xa3\xa5\xf3\xa5\xb0\xa4\xb5\xa4\xec\xa4\xbf\xc6\xfc\xcb\xdc\xb8\xec\xa4\xce\xa5\xd5\xa5\xa1\xa5\xa4\xa5\xeb\xa4\xc7\xa4\xb9\xa1\xa3\n</foo>\n'
-- utf8 = "<?xml version='1.0' encoding='utf-8'?>\n<foo>\n\xe3\x81\x93\xe3\x82\x8c\xe3\x81\xafEUC-JP\xe3\x81\xa7\xe3\x82\xb3\xe3\x83\xbc\xe3\x83\x87\xe3\x82\xa3\xe3\x83\xb3\xe3\x82\xb0\xe3\x81\x95\xe3\x82\x8c\xe3\x81\x9f\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e\xe3\x81\xae\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82\n</foo>\n"
-+ euc_jp = b'<?xml version="1.0 encoding="euc-jp"?>\n<foo>\n\xa4\xb3\xa4\xec\xa4\xcfEUC-JP\xa4\xc7\xa5\xb3\xa1\xbc\xa5\xc7\xa5\xa3\xa5\xf3\xa5\xb0\xa4\xb5\xa4\xec\xa4\xbf\xc6\xfc\xcb\xdc\xb8\xec\xa4\xce\xa5\xd5\xa5\xa1\xa5\xa4\xa5\xeb\xa4\xc7\xa4\xb9\xa1\xa3\n</foo>\n'
-+ utf8 = b"<?xml version='1.0' encoding='utf-8'?>\n<foo>\n\xe3\x81\x93\xe3\x82\x8c\xe3\x81\xafEUC-JP\xe3\x81\xa7\xe3\x82\xb3\xe3\x83\xbc\xe3\x83\x87\xe3\x82\xa3\xe3\x83\xb3\xe3\x82\xb0\xe3\x81\x95\xe3\x82\x8c\xe3\x81\x9f\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e\xe3\x81\xae\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82\n</foo>\n"
- soup = BeautifulStoneSoup(euc_jp)
- if soup.originalEncoding != "euc-jp":
- raise Exception("Test failed when parsing euc-jp document. "
-@@ -718,12 +718,12 @@
- self.assertEquals(soup.originalEncoding, "euc-jp")
- self.assertEquals(soup.renderContents('utf-8'), utf8)
-
-- old_text = "<?xml encoding='windows-1252'><foo>\x92</foo>"
-+ old_text = b"<?xml encoding='windows-1252'><foo>\x92</foo>"
- new_text = "<?xml version='1.0' encoding='utf-8'?><foo>&rsquo;</foo>"
- self.assertSoupEquals(old_text, new_text)
-
- def testRewrittenMetaTag(self):
-- no_shift_jis_html = '''<html><head>\n<meta http-equiv="Content-language" content="ja" /></head><body><pre>\n\x82\xb1\x82\xea\x82\xcdShift-JIS\x82\xc5\x83R\x81[\x83f\x83B\x83\x93\x83O\x82\xb3\x82\xea\x82\xbd\x93\xfa\x96{\x8c\xea\x82\xcc\x83t\x83@\x83C\x83\x8b\x82\xc5\x82\xb7\x81B\n</pre></body></html>'''
-+ no_shift_jis_html = b'''<html><head>\n<meta http-equiv="Content-language" content="ja" /></head><body><pre>\n\x82\xb1\x82\xea\x82\xcdShift-JIS\x82\xc5\x83R\x81[\x83f\x83B\x83\x93\x83O\x82\xb3\x82\xea\x82\xbd\x93\xfa\x96{\x8c\xea\x82\xcc\x83t\x83@\x83C\x83\x8b\x82\xc5\x82\xb7\x81B\n</pre></body></html>'''
- soup = BeautifulSoup(no_shift_jis_html)
-
- # Beautiful Soup used to try to rewrite the meta tag even if the
-@@ -733,16 +733,16 @@
- soup = BeautifulSoup(no_shift_jis_html, parseOnlyThese=strainer)
- self.assertEquals(soup.contents[0].name, 'pre')
-
-- meta_tag = ('<meta content="text/html; charset=x-sjis" '
-- 'http-equiv="Content-type" />')
-+ meta_tag = (b'<meta content="text/html; charset=x-sjis" '
-+ b'http-equiv="Content-type" />')
- shift_jis_html = (
-- '<html><head>\n%s\n'
-- '<meta http-equiv="Content-language" content="ja" />'
-- '</head><body><pre>\n'
-- '\x82\xb1\x82\xea\x82\xcdShift-JIS\x82\xc5\x83R\x81[\x83f'
-- '\x83B\x83\x93\x83O\x82\xb3\x82\xea\x82\xbd\x93\xfa\x96{\x8c'
-- '\xea\x82\xcc\x83t\x83@\x83C\x83\x8b\x82\xc5\x82\xb7\x81B\n'
-- '</pre></body></html>') % meta_tag
-+ b'<html><head>\n' + meta_tag + b'\n'
-+ b'<meta http-equiv="Content-language" content="ja" />'
-+ b'</head><body><pre>\n'
-+ b'\x82\xb1\x82\xea\x82\xcdShift-JIS\x82\xc5\x83R\x81[\x83f'
-+ b'\x83B\x83\x93\x83O\x82\xb3\x82\xea\x82\xbd\x93\xfa\x96{\x8c'
-+ b'\xea\x82\xcc\x83t\x83@\x83C\x83\x8b\x82\xc5\x82\xb7\x81B\n'
-+ b'</pre></body></html>')
- soup = BeautifulSoup(shift_jis_html)
- if soup.originalEncoding != "shift-jis":
- raise Exception("Test failed when parsing shift-jis document "
-@@ -755,59 +755,59 @@
- content_type_tag = soup.meta['content']
- self.assertEquals(content_type_tag[content_type_tag.find('charset='):],
- 'charset=%SOUP-ENCODING%')
-- content_type = str(soup.meta)
-+ content_type = soup.meta.decode()
- index = content_type.find('charset=')
- self.assertEqual(content_type[index:index+len('charset=utf8')+1],
- 'charset=utf-8')
- content_type = soup.meta.encode('shift-jis')
-- index = content_type.find('charset=')
-+ index = content_type.find(b'charset=')
- self.assertEqual(content_type[index:index+len('charset=shift-jis')],
- 'charset=shift-jis'.encode())
-
- self.assertEquals(soup.encode('utf-8'), (
-- '<html><head>\n'
-- '<meta content="text/html; charset=utf-8" '
-- 'http-equiv="Content-type" />\n'
-- '<meta http-equiv="Content-language" content="ja" />'
-- '</head><body><pre>\n'
-- '\xe3\x81\x93\xe3\x82\x8c\xe3\x81\xafShift-JIS\xe3\x81\xa7\xe3'
-- '\x82\xb3\xe3\x83\xbc\xe3\x83\x87\xe3\x82\xa3\xe3\x83\xb3\xe3'
-- '\x82\xb0\xe3\x81\x95\xe3\x82\x8c\xe3\x81\x9f\xe6\x97\xa5\xe6'
-- '\x9c\xac\xe8\xaa\x9e\xe3\x81\xae\xe3\x83\x95\xe3\x82\xa1\xe3'
-- '\x82\xa4\xe3\x83\xab\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82\n'
-- '</pre></body></html>'))
-+ b'<html><head>\n'
-+ b'<meta content="text/html; charset=utf-8" '
-+ b'http-equiv="Content-type" />\n'
-+ b'<meta http-equiv="Content-language" content="ja" />'
-+ b'</head><body><pre>\n'
-+ b'\xe3\x81\x93\xe3\x82\x8c\xe3\x81\xafShift-JIS\xe3\x81\xa7\xe3'
-+ b'\x82\xb3\xe3\x83\xbc\xe3\x83\x87\xe3\x82\xa3\xe3\x83\xb3\xe3'
-+ b'\x82\xb0\xe3\x81\x95\xe3\x82\x8c\xe3\x81\x9f\xe6\x97\xa5\xe6'
-+ b'\x9c\xac\xe8\xaa\x9e\xe3\x81\xae\xe3\x83\x95\xe3\x82\xa1\xe3'
-+ b'\x82\xa4\xe3\x83\xab\xe3\x81\xa7\xe3\x81\x99\xe3\x80\x82\n'
-+ b'</pre></body></html>'))
- self.assertEquals(soup.encode("shift-jis"),
- shift_jis_html.replace('x-sjis'.encode(),
- 'shift-jis'.encode()))
-
-- isolatin = """<html><meta http-equiv="Content-type" content="text/html; charset=ISO-Latin-1" />Sacr\xe9 bleu!</html>"""
-+ isolatin = b"""<html><meta http-equiv="Content-type" content="text/html; charset=ISO-Latin-1" />Sacr\xe9 bleu!</html>"""
- soup = BeautifulSoup(isolatin)
-
- utf8 = isolatin.replace("ISO-Latin-1".encode(), "utf-8".encode())
-- utf8 = utf8.replace("\xe9", "\xc3\xa9")
-+ utf8 = utf8.replace(b"\xe9", b"\xc3\xa9")
- self.assertSoupEquals(soup.encode("utf-8"), utf8, encoding='utf-8')
-
- def testHebrew(self):
-- iso_8859_8= '<HEAD>\n<TITLE>Hebrew (ISO 8859-8) in Visual Directionality</TITLE>\n\n\n\n</HEAD>\n<BODY>\n<H1>Hebrew (ISO 8859-8) in Visual Directionality</H1>\n\xed\xe5\xec\xf9\n</BODY>\n'
-- utf8 = '<head>\n<title>Hebrew (ISO 8859-8) in Visual Directionality</title>\n</head>\n<body>\n<h1>Hebrew (ISO 8859-8) in Visual Directionality</h1>\n\xd7\x9d\xd7\x95\xd7\x9c\xd7\xa9\n</body>\n'
-+ iso_8859_8= b'<HEAD>\n<TITLE>Hebrew (ISO 8859-8) in Visual Directionality</TITLE>\n\n\n\n</HEAD>\n<BODY>\n<H1>Hebrew (ISO 8859-8) in Visual Directionality</H1>\n\xed\xe5\xec\xf9\n</BODY>\n'
-+ utf8 = b'<head>\n<title>Hebrew (ISO 8859-8) in Visual Directionality</title>\n</head>\n<body>\n<h1>Hebrew (ISO 8859-8) in Visual Directionality</h1>\n\xd7\x9d\xd7\x95\xd7\x9c\xd7\xa9\n</body>\n'
- soup = BeautifulStoneSoup(iso_8859_8, fromEncoding="iso-8859-8")
- self.assertEquals(soup.encode('utf-8'), utf8)
-
- def testSmartQuotesNotSoSmartAnymore(self):
-- self.assertSoupEquals("\x91Foo\x92 <!--blah-->",
-+ self.assertSoupEquals(b"\x91Foo\x92 <!--blah-->",
- '&lsquo;Foo&rsquo; <!--blah-->')
-
- def testDontConvertSmartQuotesWhenAlsoConvertingEntities(self):
-- smartQuotes = "Il a dit, \x8BSacr&eacute; bl&#101;u!\x9b"
-+ smartQuotes = b"Il a dit, \x8BSacr&eacute; bl&#101;u!\x9b"
- soup = BeautifulSoup(smartQuotes)
- self.assertEquals(soup.decode(),
- 'Il a dit, &lsaquo;Sacr&eacute; bl&#101;u!&rsaquo;')
- soup = BeautifulSoup(smartQuotes, convertEntities="html")
- self.assertEquals(soup.encode('utf-8'),
-- 'Il a dit, \xe2\x80\xb9Sacr\xc3\xa9 bleu!\xe2\x80\xba')
-+ b'Il a dit, \xe2\x80\xb9Sacr\xc3\xa9 bleu!\xe2\x80\xba')
-
- def testDontSeeSmartQuotesWhereThereAreNone(self):
-- utf_8 = "\343\202\261\343\203\274\343\202\277\343\202\244 Watch"
-+ utf_8 = b"\343\202\261\343\203\274\343\202\277\343\202\244 Watch"
- self.assertSoupEquals(utf_8, encoding='utf-8')
-
-
---- setup.py
-+++ setup.py
-@@ -19,19 +19,19 @@
- suite = loader.loadTestsFromModule(BeautifulSoupTests)
- suite.run(result)
- if not result.wasSuccessful():
-- print "Unit tests have failed!"
-+ print("Unit tests have failed!")
- for l in result.errors, result.failures:
- for case, error in l:
-- print "-" * 80
-+ print("-" * 80)
- desc = case.shortDescription()
- if desc:
-- print desc
-- print error
-- print '''If you see an error like: "'ascii' codec can't encode character...", see\nthe Beautiful Soup documentation:\n http://www.crummy.com/software/BeautifulSoup/documentation.html#Why%20can't%20Beautiful%20Soup%20print%20out%20the%20non-ASCII%20characters%20I%20gave%20it?'''
-- print "This might or might not be a problem depending on what you plan to do with\nBeautiful Soup."
-+ print(desc)
-+ print(error)
-+ print('''If you see an error like: "'ascii' codec can't encode character...", see\nthe Beautiful Soup documentation:\n http://www.crummy.com/software/BeautifulSoup/documentation.html#Why%20can't%20Beautiful%20Soup%20print%20out%20the%20non-ASCII%20characters%20I%20gave%20it?''')
-+ print("This might or might not be a problem depending on what you plan to do with\nBeautiful Soup.")
- if sys.argv[1] == 'sdist':
-- print
-- print "I'm not going to make a source distribution since the tests don't pass."
-+ print()
-+ print("I'm not going to make a source distribution since the tests don't pass.")
- sys.exit(1)
-
- setup(name="BeautifulSoup",
diff --git a/dev-python/beautifulsoup/files/bfs-4.2.0-no-lxml.patch b/dev-python/beautifulsoup/files/bfs-4.2.0-no-lxml.patch
new file mode 100644
index 000000000000..75ae98b1ef45
--- /dev/null
+++ b/dev-python/beautifulsoup/files/bfs-4.2.0-no-lxml.patch
@@ -0,0 +1,67 @@
+=== modified file 'bs4/testing.py'
+--- bs4/testing.py 2013-05-07 12:19:02 +0000
++++ bs4/testing.py 2013-05-20 13:19:16 +0000
+@@ -464,6 +464,18 @@
+ self.assertEqual(
+ soup.encode("utf-8"), markup)
+
++ def test_formatter_processes_script_tag_for_xml_documents(self):
++ doc = """
++ <script type="text/javascript">
++ </script>
++"""
++ soup = BeautifulSoup(doc, "xml")
++ # lxml would have stripped this while parsing, but we can add
++ # it later.
++ soup.script.string = 'console.log("< < hey > > ");'
++ encoded = soup.encode()
++ self.assertTrue(b"&lt; &lt; hey &gt; &gt;" in encoded)
++
+ def test_popping_namespaced_tag(self):
+ markup = '<rss xmlns:dc="foo"><dc:creator>b</dc:creator><dc:date>2012-07-02T20:33:42Z</dc:date><dc:rights>c</dc:rights><image>d</image></rss>'
+ soup = self.soup(markup)
+
+=== modified file 'bs4/tests/test_lxml.py'
+--- bs4/tests/test_lxml.py 2013-05-09 19:36:30 +0000
++++ bs4/tests/test_lxml.py 2013-05-20 13:19:16 +0000
+@@ -10,6 +10,7 @@
+ LXML_VERSION = lxml.etree.LXML_VERSION
+ except ImportError, e:
+ LXML_PRESENT = False
++ LXML_VERSION = (0,)
+
+ from bs4 import (
+ BeautifulSoup,
+@@ -47,7 +48,7 @@
+ # test if an old version of lxml is installed.
+
+ @skipIf(
+- LXML_VERSION < (2,3,5,0),
++ not LXML_PRESENT or LXML_VERSION < (2,3,5,0),
+ "Skipping doctype test for old version of lxml to avoid segfault.")
+ def test_empty_doctype(self):
+ soup = self.soup("<!DOCTYPE>")
+
+=== modified file 'bs4/tests/test_tree.py'
+--- bs4/tests/test_tree.py 2013-05-14 12:39:16 +0000
++++ bs4/tests/test_tree.py 2013-05-20 13:19:16 +0000
+@@ -1344,18 +1344,6 @@
+ encoded = BeautifulSoup(doc).encode()
+ self.assertTrue(b"< < hey > >" in encoded)
+
+- def test_formatter_processes_script_tag_for_xml_documents(self):
+- doc = """
+- <script type="text/javascript">
+- </script>
+-"""
+- soup = BeautifulSoup(doc, "xml")
+- # lxml would have stripped this while parsing, but we can add
+- # it later.
+- soup.script.string = 'console.log("< < hey > > ");'
+- encoded = soup.encode()
+- self.assertTrue(b"&lt; &lt; hey &gt; &gt;" in encoded)
+-
+ def test_prettify_leaves_preformatted_text_alone(self):
+ soup = self.soup("<div> foo <pre> \tbar\n \n </pre> baz ")
+ # Everything outside the <pre> tag is reformatted, but everything
+
diff --git a/dev-python/beautifulsoup/metadata.xml b/dev-python/beautifulsoup/metadata.xml
index 236732af0c82..d0eccb96021d 100644
--- a/dev-python/beautifulsoup/metadata.xml
+++ b/dev-python/beautifulsoup/metadata.xml
@@ -13,4 +13,7 @@
<upstream>
<remote-id type="pypi">beautifulsoup4</remote-id>
</upstream>
+ <use>
+ <flag name='lxml'>An optional serialiser</flag>
+ </use>
</pkgmetadata>