Run the tests, fix Python 3.7

This commit is contained in:
Miro Hrončok 2018-07-04 15:25:45 +00:00
parent 559be8fd96
commit dc90bb3cfd
2 changed files with 45 additions and 2 deletions

34
pep479.patch Normal file
View File

@ -0,0 +1,34 @@
diff -r 7941677dc77d pygments/lexers/lisp.py
--- a/pygments/lexers/lisp.py Mon Mar 13 19:16:03 2017 +0000
+++ b/pygments/lexers/lisp.py Wed Jul 04 18:03:07 2018 +0200
@@ -2327,13 +2327,13 @@
token = Name.Function if token == Literal else token
yield index, token, value
- raise StopIteration
+ return
def _process_signature(self, tokens):
for index, token, value in tokens:
if token == Literal and value == '}':
yield index, Punctuation, value
- raise StopIteration
+ return
elif token in (Literal, Name.Function):
token = Name.Variable if value.istitle() else Keyword.Type
yield index, token, value
diff -r 7941677dc77d pygments/lexers/sql.py
--- a/pygments/lexers/sql.py Mon Mar 13 19:16:03 2017 +0000
+++ b/pygments/lexers/sql.py Wed Jul 04 18:03:07 2018 +0200
@@ -347,7 +347,10 @@
# Emit the output lines
out_token = Generic.Output
while 1:
- line = next(lines)
+ try:
+ line = next(lines)
+ except StopIteration:
+ return
mprompt = re_prompt.match(line)
if mprompt is not None:
# push the line back to have it processed by the prompt

View File

@ -8,13 +8,16 @@
Name: python-pygments
Version: 2.2.0
Release: 12%{?dist}
Release: 13%{?dist}
Summary: %{sum}
License: BSD
URL: http://pygments.org/
Source0: https://pypi.org/packages/source/P/%{upstream_name}/%{upstream_name}-%{version}.tar.gz
Patch0: import-directive.patch
# Support for Python 3.7:
# https://bitbucket.org/birkenfeld/pygments-main/issues/1457
Patch1: pep479.patch
BuildArch: noarch
%description
@ -79,6 +82,7 @@ need to prettify source code. Highlights are:
%prep
%setup -q -n %{upstream_name}-%{version}
%patch0 -p 1
%patch1 -p 1
%build
%{__sed} -i 's/\r//' LICENSE
@ -105,7 +109,8 @@ cp -r doc/docs doc/reST
%endif
%check
make test || :
make test PYTHON=%{__python2}
make test PYTHON=%{__python3}
%files -n python2-pygments
@ -129,6 +134,10 @@ make test || :
%endif
%changelog
* Wed Jul 04 2018 Miro Hrončok <mhroncok@redhat.com> - 2.2.0-13
- Run tests
- Add fix for 3.7
* Thu Jun 14 2018 Miro Hrončok <mhroncok@redhat.com> - 2.2.0-12
- Rebuilt for Python 3.7