# # spec file for package python-Parsley # # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2013 LISA GmbH, Bingen, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: python-Parsley Version: 1.2 Release: 0 License: MIT Summary: Parsing and pattern matching made easy Url: http://github.com/washort/parsley Group: Development/Libraries/Python Source: https://pypi.python.org/packages/source/P/Parsley/Parsley-%{version}.tar.gz BuildRequires: fdupes # Documentation requirements: BuildRequires: python-Sphinx # Testing requirements: BuildRequires: python-Twisted BuildRequires: python-setuptools BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else BuildArch: noarch %endif %description Parsley is a parsing library for people who find parsers scary or annoying. I wrote it because I wanted to parse a programming language, and tools like PLY or ANTLR or Bison were very hard to understand and integrate into my Python code. Most parser generators are based on LL or LR parsing algorithms that compile to big state machine tables. It was like I had to wake up a different section of my brain to understand or work on grammar rules. Parsley, like pyparsing and ZestyParser, uses the PEG algorithm, so each expression in the grammar rules works like a Python expression. In particular, alternatives are evaluated in order, unlike table-driven parsers such as yacc, bison or PLY. The binaries are prefixed with parsley-. %package doc Summary: Parsing and pattern matching made easy Group: Development/Libraries/Python Requires: %{name} = %{version} %description doc This package contains documentation files for %{name}. %prep %setup -q -n Parsley-%{version} %build python setup.py build # Generate HTML documentation pushd doc make html && rm _build/html/.buildinfo popd %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} mkdir %{buildroot}/%{_bindir} # rename binaries in order to avoid name clashes with other system packages for f in {generate_parser,stage}; do cp -v bin/$f %{buildroot}/%{_bindir}/parsley-$f done %fdupes -s %{buildroot}/%{_prefix} %check pushd ometa/test PYTHONPATH='../..' python -m unittest test_builder test_pymeta test_runtime popd %files %defattr(-,root,root) %doc LICENSE NEWS PKG-INFO README %{_bindir}/* %{python_sitelib}/* %files doc %defattr(-,root,root) %doc doc/_build/html examples %changelog