From owner-dev-commits-ports-all@freebsd.org Wed Apr 14 12:14:48 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C73E05D6B0F; Wed, 14 Apr 2021 12:14:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FL1cm5GY2z3C5N; Wed, 14 Apr 2021 12:14:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A36B61DC0D; Wed, 14 Apr 2021 12:14:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13ECEmp4051711; Wed, 14 Apr 2021 12:14:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ECEmHQ051710; Wed, 14 Apr 2021 12:14:48 GMT (envelope-from git) Date: Wed, 14 Apr 2021 12:14:48 GMT Message-Id: <202104141214.13ECEmHQ051710@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Sofian Brabez Subject: git: d950078a6163 - main - textproc/py-feedparser: update to 6.0.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sbz X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d950078a6163652c8350f619bdd29e9d2d2439ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Apr 2021 12:14:48 -0000 The branch main has been updated by sbz: URL: https://cgit.FreeBSD.org/ports/commit/?id=d950078a6163652c8350f619bdd29e9d2d2439ca commit d950078a6163652c8350f619bdd29e9d2d2439ca Author: Sofian Brabez AuthorDate: 2021-04-13 21:05:53 +0000 Commit: Sofian Brabez CommitDate: 2021-04-14 12:14:18 +0000 textproc/py-feedparser: update to 6.0.2 This update require adding the missing sgmllib for python3 versions and makes the license dual contributed by James French. Also update the test target and switch to github. PR: 250380 Submitted by: jbeich MFH: 2021Q2 --- textproc/py-feedparser/Makefile | 28 +- textproc/py-feedparser/distinfo | 6 +- textproc/py-feedparser/files/sgmllib.py | 547 ++++++++++++++++++++++++++++++++ 3 files changed, 570 insertions(+), 11 deletions(-) diff --git a/textproc/py-feedparser/Makefile b/textproc/py-feedparser/Makefile index acf92a2f3b74..cb8d06bf85d8 100644 --- a/textproc/py-feedparser/Makefile +++ b/textproc/py-feedparser/Makefile @@ -1,31 +1,43 @@ # Created by: ijliao PORTNAME= feedparser -PORTVERSION= 5.2.1 +PORTVERSION= 6.0.2 CATEGORIES= textproc python -MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= sbz@FreeBSD.org COMMENT= Universal feed parser written in Python -LICENSE= BSD2CLAUSE +LICENSE= BSD2CLAUSE PSFL +LICENSE_COMB= multi LICENSE_FILE= ${WRKSRC}/LICENSE USES= python:3.6+ tar:bzip2 -USE_PYTHON= distutils autoplist +USE_PYTHON= autoplist distutils +USE_GITHUB= yes + +GH_ACCOUNT= kurtmckee NO_ARCH= yes +PORTDOCS= NEWS README.rst + OPTIONS_DEFINE= DOCS -PORTDOCS= NEWS README.rst +.include + +.if ${PYTHON_REL} > 3700 +PLIST_FILES+= ${PYTHON_SITELIBDIR}/sgmllib.py + +post-install: + ${INSTALL_DATA} ${FILESDIR}/sgmllib.py ${STAGEDIR}/${PYTHON_SITELIBDIR}/sgmllib.py +.endif post-install-DOCS-on: - ${MKDIR} ${STAGEDIR}${DOCSDIR} + @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR} do-test: - @(cd ${WRKSRC}/${PORTNAME}; ${PYTHON_CMD} ${PORTNAME}test.py) + @(cd ${WRKSRC}; ${PYTHON_CMD} tests/runtests.py) -.include +.include diff --git a/textproc/py-feedparser/distinfo b/textproc/py-feedparser/distinfo index 740e0aeea36a..a11a6b96dca8 100644 --- a/textproc/py-feedparser/distinfo +++ b/textproc/py-feedparser/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1464128973 -SHA256 (feedparser-5.2.1.tar.bz2) = ce875495c90ebd74b179855449040003a1beb40cd13d5f037a0654251e260b02 -SIZE (feedparser-5.2.1.tar.bz2) = 192328 +TIMESTAMP = 1618343573 +SHA256 (kurtmckee-feedparser-6.0.2_GH0.tar.gz) = b211cfb80c4daefca64b773ade77340727187564fad9c2c94b37da8e1f03788f +SIZE (kurtmckee-feedparser-6.0.2_GH0.tar.gz) = 251508 diff --git a/textproc/py-feedparser/files/sgmllib.py b/textproc/py-feedparser/files/sgmllib.py new file mode 100644 index 000000000000..88a02a307f40 --- /dev/null +++ b/textproc/py-feedparser/files/sgmllib.py @@ -0,0 +1,547 @@ +"""A parser for SGML, using the derived class as a static DTD.""" + +# XXX This only supports those SGML features used by HTML. + +# XXX There should be a way to distinguish between PCDATA (parsed +# character data -- the normal case), RCDATA (replaceable character +# data -- only char and entity references and end tags are special) +# and CDATA (character data -- only end tags are special). RCDATA is +# not supported at all. + +import _markupbase +import re + +__all__ = ["SGMLParser", "SGMLParseError"] + +# Regular expressions used for parsing + +interesting = re.compile('[&<]') +incomplete = re.compile('&([a-zA-Z][a-zA-Z0-9]*|#[0-9]*)?|' + '<([a-zA-Z][^<>]*|' + '/([a-zA-Z][^<>]*)?|' + '![^<>]*)?') + +entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]') +charref = re.compile('&#([0-9]+)[^0-9]') + +starttagopen = re.compile('<[>a-zA-Z]') +shorttagopen = re.compile('<[a-zA-Z][-.a-zA-Z0-9]*/') +shorttag = re.compile('<([a-zA-Z][-.a-zA-Z0-9]*)/([^/]*)/') +piclose = re.compile('>') +endbracket = re.compile('[<>]') +tagfind = re.compile('[a-zA-Z][-_.a-zA-Z0-9]*') +attrfind = re.compile( + r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*' + r'(\'[^\']*\'|"[^"]*"|[][\-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*))?') + + +class SGMLParseError(RuntimeError): + """Exception raised for all parse errors.""" + pass + + +# SGML parser base class -- find tags and call handler functions. +# Usage: p = SGMLParser(); p.feed(data); ...; p.close(). +# The dtd is defined by deriving a class which defines methods +# with special names to handle tags: start_foo and end_foo to handle +# and , respectively, or do_foo to handle by itself. +# (Tags are converted to lower case for this purpose.) The data +# between tags is passed to the parser by calling self.handle_data() +# with some data as argument (the data may be split up in arbitrary +# chunks). Entity references are passed by calling +# self.handle_entityref() with the entity reference as argument. + +class SGMLParser(_markupbase.ParserBase): + # Definition of entities -- derived classes may override + entity_or_charref = re.compile('&(?:' + '([a-zA-Z][-.a-zA-Z0-9]*)|#([0-9]+)' + ')(;?)') + + def __init__(self, verbose=0): + """Initialize and reset this instance.""" + self.verbose = verbose + self.reset() + + def reset(self): + """Reset this instance. Loses all unprocessed data.""" + self.__starttag_text = None + self.rawdata = '' + self.stack = [] + self.lasttag = '???' + self.nomoretags = 0 + self.literal = 0 + _markupbase.ParserBase.reset(self) + + def setnomoretags(self): + """Enter literal mode (CDATA) till EOF. + + Intended for derived classes only. + """ + self.nomoretags = self.literal = 1 + + def setliteral(self, *args): + """Enter literal mode (CDATA). + + Intended for derived classes only. + """ + self.literal = 1 + + def feed(self, data): + """Feed some data to the parser. + + Call this as often as you want, with as little or as much text + as you want (may include '\n'). (This just saves the text, + all the processing is done by goahead().) + """ + + self.rawdata = self.rawdata + data + self.goahead(0) + + def close(self): + """Handle the remaining data.""" + self.goahead(1) + + def error(self, message): + raise SGMLParseError(message) + + # Internal -- handle data as far as reasonable. May leave state + # and data to be processed by a subsequent call. If 'end' is + # true, force handling all data as if followed by EOF marker. + def goahead(self, end): + rawdata = self.rawdata + i = 0 + n = len(rawdata) + while i < n: + if self.nomoretags: + self.handle_data(rawdata[i:n]) + i = n + break + match = interesting.search(rawdata, i) + if match: j = match.start() + else: j = n + if i < j: + self.handle_data(rawdata[i:j]) + i = j + if i == n: break + if rawdata[i] == '<': + if starttagopen.match(rawdata, i): + if self.literal: + self.handle_data(rawdata[i]) + i = i+1 + continue + k = self.parse_starttag(i) + if k < 0: break + i = k + continue + if rawdata.startswith(" (i + 1): + self.handle_data("<") + i = i+1 + else: + # incomplete + break + continue + if rawdata.startswith("