- Repackage back to plain 2.3.0 tarball with appropriate patches:

* docs_to_tarball_tests_pass_py2k.patch (gh#pyparsing/pyparsing#47)
    * pass_unitTests.patch (gh#pyparsing/pyparsing#63)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyparsing?expand=0&rev=54
This commit is contained in:
Matej Cepl 2019-01-08 14:07:22 +00:00 committed by Git OBS Bridge
parent 0a12b50e88
commit 046202169a
7 changed files with 4339 additions and 48 deletions

View File

@ -0,0 +1,82 @@
From 0499a0d795ce9d55b257dae2f39cc3ced145da79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
Date: Wed, 21 Nov 2018 11:05:16 +0100
Subject: [PATCH 1/3] Convert CRLF->CR in CHANGES, LICENSE, and add docs/ to
tarball
---
CHANGES | 5014 +++++++++++++++++++++++++--------------------------
LICENSE | 36 +-
MANIFEST.in | 1 +
3 files changed, 2526 insertions(+), 2525 deletions(-)
--- a/LICENSE
+++ b/LICENSE
@@ -1,18 +1,18 @@
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- a/examples/antlr_grammar_tests.py
+++ b/examples/antlr_grammar_tests.py
@@ -6,7 +6,7 @@ Created on 4 sept. 2010
Submitted by Luca DallOlio, September, 2010
'''
import unittest
-import antlr_grammar
+from . import antlr_grammar
class Test(unittest.TestCase):
@@ -84,4 +84,4 @@ fragment DIGIT : '0'..'9' ;"""
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testOptionsSpec']
- unittest.main()
\ No newline at end of file
+ unittest.main()
--- a/examples/test_bibparse.py
+++ b/examples/test_bibparse.py
@@ -3,8 +3,8 @@
from os.path import join as pjoin, dirname
from pyparsing import ParseException
-from btpyparse import Macro
-import btpyparse as bp
+from .btpyparse import Macro
+from . import btpyparse as bp
from nose.tools import assert_true, assert_false, assert_equal, assert_raises

View File

@ -1,6 +1,6 @@
--- a/examples/test_bibparse.py
+++ b/examples/test_bibparse.py
@@ -1,195 +1,193 @@
@@ -1,193 +1,193 @@
""" Test for bibparse grammar """
+import unittest
@ -11,8 +11,23 @@
from . import btpyparse as bp
-from nose.tools import assert_true, assert_false, assert_equal, assert_raises
-
-def test_names():
- # check various types of names
- # All names can contains alphas, but not some special chars
- bad_chars = '"#%\'(),={}'
- for name_type, dig1f in ((bp.macro_def, False),
- (bp.field_name, False),
- (bp.entry_type, False),
- (bp.cite_key, True)):
- if dig1f: # can start with digit
- assert_equal(name_type.parseString('2t')[0], '2t')
- else:
- assert_raises(ParseException, name_type.parseString, '2t')
- # All of the names cannot contain some characters
+class TestBibparse(unittest.TestCase):
+ def test_names(self):
+ def test_names():
+ # check various types of names
+ # All names can contains alphas, but not some special chars
+ bad_chars = '"#%\'(),={}'
@ -33,25 +48,7 @@
+ mr = bp.macro_ref
+ # can't start with digit
+ self.assertRaises(ParseException, mr.parseString, '2t')
+ for char in bad_chars:
+ self.assertRaises(ParseException, mr.parseString, char)
+ self.assertEqual(mr.parseString('simple_test')[0].name, 'simple_test')
-def test_names():
- # check various types of names
- # All names can contains alphas, but not some special chars
- bad_chars = '"#%\'(),={}'
- for name_type, dig1f in ((bp.macro_def, False),
- (bp.field_name, False),
- (bp.entry_type, False),
- (bp.cite_key, True)):
- if dig1f: # can start with digit
- assert_equal(name_type.parseString('2t')[0], '2t')
- else:
- assert_raises(ParseException, name_type.parseString, '2t')
- # All of the names cannot contain some characters
- for char in bad_chars:
for char in bad_chars:
- assert_raises(ParseException, name_type.parseString, char)
- # standard strings all OK
- assert_equal(name_type.parseString('simple_test')[0], 'simple_test')
@ -217,7 +214,11 @@
- assert_equal(res.asList(), res2.asList())
- res3 = [r.asList()[0] for r, start, end in bp.definitions.scanString(txt)]
- assert_equal(res.asList(), res3)
+ def test_numbers(self):
+ self.assertRaises(ParseException, mr.parseString, char)
+ self.assertEqual(mr.parseString('simple_test')[0].name, 'simple_test')
+
+
+ def test_numbers():
+ self.assertEqual(bp.number.parseString('1066')[0], '1066')
+ self.assertEqual(bp.number.parseString('0')[0], '0')
+ self.assertRaises(ParseException, bp.number.parseString, '-4')
@ -227,7 +228,7 @@
+ self.assertEqual(bp.number.parseString('0.4')[0], '0')
+
+
+ def test_parse_string(self):
+ def test_parse_string():
+ # test string building blocks
+ self.assertEqual(bp.chars_no_quotecurly.parseString('x')[0], 'x')
+ self.assertEqual(bp.chars_no_quotecurly.parseString("a string")[0], 'a string')
@ -258,7 +259,7 @@
+ self.assertEqual(bp.string.parseString('1994')[0], '1994')
+
+
+ def test_parse_field(self):
+ def test_parse_field():
+ # test field value - hashes included
+ fv = bp.field_value
+ # Macro
@ -278,7 +279,7 @@
+ ['a string', '1994', Macro('a_macro')])
+
+
+ def test_comments(self):
+ def test_comments():
+ res = bp.comment.parseString('@Comment{about something}')
+ self.assertEqual(res.asList(), ['comment', '{about something}'])
+ self.assertEqual(
@ -298,7 +299,7 @@
+ '@comment"about something')
+
+
+ def test_preamble(self):
+ def test_preamble():
+ res = bp.preamble.parseString('@preamble{"about something"}')
+ self.assertEqual(res.asList(), ['preamble', 'about something'])
+ self.assertEqual(bp.preamble.parseString(
@ -310,7 +311,7 @@
+ ['preamble', 'about something'])
+
+
+ def test_macro(self):
+ def test_macro():
+ res = bp.macro.parseString('@string{ANAME = "about something"}')
+ self.assertEqual(res.asList(), ['string', 'aname', 'about something'])
+ self.assertEqual(
@ -318,7 +319,7 @@
+ ['string', 'aname', 'about something'])
+
+
+ def test_entry(self):
+ def test_entry():
+ txt = """@some_entry{akey, aname = "about something",
+ another={something else}}"""
+ res = bp.entry.parseString(txt)
@ -334,7 +335,7 @@
+ ['aname', 'about something'], ['another', 'something else']])
+
+
+ def test_bibfile(self):
+ def test_bibfile():
+ txt = """@some_entry{akey, aname = "about something",
+ another={something else}}"""
+ res = bp.bibfile.parseString(txt)
@ -344,7 +345,7 @@
+ ['another', 'something else']]])
+
+
+ def test_bib1(self):
+ def test_bib1():
+ # First pass whole bib-like tests
+ txt = """
+ Some introductory text
@ -373,6 +374,3 @@
if __name__ == '__main__':
- import nose
- nose.main()
+ unittest.main()

4198
pass_unitTests.patch Normal file

File diff suppressed because it is too large Load Diff

3
pyparsing-2.3.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f353aab21fd474459d97b709e527b5571314ee5f067441dc9f88e33eecd96592
size 857644

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f671df9146dbf152a8475cd1703d89909d8e70ad7c33eb706c0dfd7f498e668
size 590351

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jan 8 14:58:26 CET 2019 - mcepl@suse.com
- Repackage back to plain 2.3.0 tarball with appropriate patches:
* docs_to_tarball_tests_pass_py2k.patch (gh#pyparsing/pyparsing#47)
* pass_unitTests.patch (gh#pyparsing/pyparsing#63)
-------------------------------------------------------------------
Mon Jan 7 12:36:20 UTC 2019 - Matěj Cepl <mcepl@suse.com>

View File

@ -30,21 +30,27 @@ Name: python-pyparsing-%{flavor}
%else
Name: python-pyparsing
%endif
Version: 2.3.1~test5
Version: 2.3.0
Release: 0
Summary: Grammar Parser Library for Python
License: MIT AND GPL-2.0-or-later AND GPL-3.0-or-later
Group: Development/Languages/Python
URL: https://github.com/pyparsing/pyparsing/
# Upstream tarball from the master branch with gh#pyparsing/pyparsing#47
Source: pyparsing-%{version}.tar.gz
Source: https://files.pythonhosted.org/packages/source/p/pyparsing/pyparsing-%{version}.tar.gz
# Make tests passing, gh#pyparsing/pyparsing#47
Patch0: docs_to_tarball_tests_pass_py2k.patch
# Fix unitTests.py to pass, gh#pyparsing/pyparsing#63
Patch1: pass_unitTests.patch
# Remove dependency on nose, gh#pyparsing/pyparsing#64
Patch: nose_to_unittest.patch
Patch2: nose_to_unittest.patch
BuildRequires: %{python_module base}
# Source: https://files.pythonhosted.org/packages/source/p/pyparsing/pyparsing-%%{version}.tar.gz
BuildRequires: %{python_module setuptools}
# Not necessary for python3, but tests fail with the standard unittest
# and python 2.7
BuildRequires: %{python_module unittest2}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python2-unittest2
# do not add dependencies on setuptools and ideally not even full "python";
# this is now a dependency of setuptools
Requires: python-base
@ -63,8 +69,9 @@ expressions. The pyparsing module provides a library of classes that client
code uses to construct the grammar directly in Python code.
%prep
%setup -q -n %{modname}-2.3.1
%setup -q -n %{modname}-%{version}
%autopatch -p1
sed -i -e 's/\r$//' README.md CHANGES
%build
%python_build
@ -81,18 +88,17 @@ cp -r pyparsing.egg-info %{buildroot}%{$python_sitelib}/pyparsing-%{version}-py%
%check
%if %{with test}
export PYTHONPATH=.:example
%{python_expand export PYTHONPATH=.:example
# unittest from Python 2.7 doesn't load tests correctly
python2 -munittest2 -v simple_unit_tests.py examples.test_bibparse examples.antlr_grammar_tests
python3 -munittest -v simple_unit_tests.py examples.test_bibparse examples.antlr_grammar_tests
# Fails with python2 gh#pyparsing/pyparsing#63
python3 unitTests.py
%{$python} -munittest2 -v simple_unit_tests.py examples.test_bibparse examples.antlr_grammar_tests
%{$python} unitTests.py
}
%endif
%files %{python_files}
%if ! %{with test}
%license LICENSE
%doc CHANGES README.rst
%doc CHANGES README.md
%{python_sitelib}/pyparsing.py*
%pycache_only %{python_sitelib}/__pycache__/*
%{python_sitelib}/pyparsing-%{version}-py*.egg-info/