Accepting request 666937 from devel:languages:python

- BuildIgnore python[23]-pyparsing: python-packaging requires it
  for some actions it could perform, but we don't make use of these
  here. Ignoring this dependency allows us to break open a
  BuildCycle.

- Update to version 2.3.0+git.1546912853.bf348d6:
  * Update CHANGES to include note on fixing issue #65; generalized the note about the decaf language example; added sample code from the statemachine examples.
  * Unit test to test fix for issue #65
  * Fix inconsistency between Keyword(caseless=True) and CaselessKeyword (issue #65)
  * Fix typo: 'chemcialFormulas.py' -> 'chemicalFormulas.py'
  * Convert exception logging to use ParseException.explain()
  * Add experimental ParseException.explain() method, to return a multiline string showing the parse expressions leading to a parsing failure
  * Clean up CHANGES notes for new examples
  * Add document signoff and library book state examples;
  * Update statemachine demo code to Py3
  * Update Lucene grammar example, but remove from Travis-CI acceptance scripts

OBS-URL: https://build.opensuse.org/request/show/666937
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pyparsing?expand=0&rev=31
This commit is contained in:
Dominique Leuenberger 2019-01-28 19:46:48 +00:00 committed by Git OBS Bridge
commit 40d9250d62
7 changed files with 89 additions and 49 deletions

15
_service Normal file
View File

@ -0,0 +1,15 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="versionprefix">2.3.0+git</param>
<param name="url">https://github.com/pyparsing/pyparsing</param>
<param name="scm">git</param>
<param name="exclude">.git*</param>
<!--param name="revision">lsp-support</param-->
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="compression">xz</param>
<param name="file">*.tar</param>
</service>
<service name="set_version" mode="disabled" />
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/pyparsing/pyparsing</param>
<param name="changesrevision">bf348d6f00c58b6dbcfcc8e4e5ef2af7f904926c</param></service></servicedata>

View File

@ -1,17 +1,30 @@
--- a/examples/test_bibparse.py
+++ b/examples/test_bibparse.py
@@ -1,195 +1,193 @@
@@ -1,191 +1,192 @@
""" Test for bibparse grammar """
+import unittest
from os.path import join as pjoin, dirname
from pyparsing import ParseException
from .btpyparse import Macro
from . import btpyparse as bp
-from nose.tools import assert_true, assert_false, assert_equal, assert_raises
+class TestBibparse(unittest.TestCase):
-from nose.tools import 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):
+ # check various types of names
+ # All names can contains alphas, but not some special chars
@ -33,25 +46,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,6 +212,10 @@
- assert_equal(res.asList(), res2.asList())
- res3 = [r.asList()[0] for r, start, end in bp.definitions.scanString(txt)]
- assert_equal(res.asList(), res3)
+ self.assertRaises(ParseException, mr.parseString, char)
+ self.assertEqual(mr.parseString('simple_test')[0].name, 'simple_test')
+
+
+ def test_numbers(self):
+ self.assertEqual(bp.number.parseString('1066')[0], '1066')
+ self.assertEqual(bp.number.parseString('0')[0], '0')
@ -373,6 +372,3 @@
if __name__ == '__main__':
- import nose
- nose.main()
+ unittest.main()

View File

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

View File

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

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Thu Jan 17 15:54:39 UTC 2019 - Dominique Leuenberger <dimstar@opensuse.org>
- BuildIgnore python[23]-pyparsing: python-packaging requires it
for some actions it could perform, but we don't make use of these
here. Ignoring this dependency allows us to break open a
BuildCycle.
-------------------------------------------------------------------
Tue Jan 08 19:10:15 UTC 2019 - opensuse-packaging@opensuse.org
- Update to version 2.3.0+git.1546912853.bf348d6:
* Update CHANGES to include note on fixing issue #65; generalized the note about the decaf language example; added sample code from the statemachine examples.
* Unit test to test fix for issue #65
* Fix inconsistency between Keyword(caseless=True) and CaselessKeyword (issue #65)
* Fix typo: 'chemcialFormulas.py' -> 'chemicalFormulas.py'
* Convert exception logging to use ParseException.explain()
* Add experimental ParseException.explain() method, to return a multiline string showing the parse expressions leading to a parsing failure
* Clean up CHANGES notes for new examples
* Add document signoff and library book state examples;
* Update statemachine demo code to Py3
* Update Lucene grammar example, but remove from Travis-CI acceptance scripts
-------------------------------------------------------------------
Mon Jan 7 12:36:20 UTC 2019 - Matěj Cepl <mcepl@suse.com>

View File

@ -21,35 +21,37 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%if %{with test}
Name: python-pyparsing-%{flavor}
%else
Name: python-pyparsing
%endif
Version: 2.3.1~test5
Name: python-pyparsing%{psuffix}
Version: 2.3.0+git.1546912853.bf348d6
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
# Remove dependency on nose, gh#pyparsing/pyparsing#64
Patch: nose_to_unittest.patch
BuildRequires: %{python_module base}
# Source: https://files.pythonhosted.org/packages/source/p/pyparsing/pyparsing-%%{version}.tar.gz
Source: pyparsing-%{version}.tar.xz
# Remove dependency on nose, gh#pyparsing/pyparsing#64
Patch0: nose_to_unittest.patch
BuildRequires: %{python_module base}
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
#!BuildIgnore: python2-pyparsing
#!BuildIgnore: python3-pyparsing
# do not add dependencies on setuptools and ideally not even full "python";
# this is now a dependency of setuptools
Requires: python-base
BuildArch: noarch
%ifpython2
Provides: %{oldpython}-parsing = %{version}
Obsoletes: %{oldpython}-parsing < %{version}
@ -63,7 +65,7 @@ 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
%build
@ -81,16 +83,16 @@ cp -r pyparsing.egg-info %{buildroot}%{$python_sitelib}/pyparsing-%{version}-py%
%check
%if %{with test}
export PYTHONPATH=.:example
%{python_expand export PYTHONPATH=.
# 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
# no work simple_unit_tests.py examples.antlr_grammar_tests
$python -munittest2 -v examples.test_bibparse
$python unitTests.py
}
%endif
%files %{python_files}
%if ! %{with test}
%files %{python_files}
%license LICENSE
%doc CHANGES README.rst
%{python_sitelib}/pyparsing.py*