File python-mappyfile.spec of Package python-mappyfile

# spec file for package python-mappyfile
# Copyright (c) 2020 SUSE LLC
# 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

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-mappyfile
Version:        0.8.4
Release:        0
Summary:        A pure Python MapFile parser for working with MapServer
License:        MIT
Group:          Development/Languages/Python
# We use project github tar.gz (so tests are complete)
# For reference keep this source too
# Source:{version}.tar.gz
BuildRequires:  %{python_module click}
BuildRequires:  %{python_module cov-core}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module docutils}
BuildRequires:  %{python_module flake8}
BuildRequires:  %{python_module glob2}
BuildRequires:  %{python_module jsonref} >= 0.1
BuildRequires:  %{python_module jsonschema} >= 2.0
BuildRequires:  %{python_module lark-parser} >= 0.6
BuildRequires:  %{python_module mock}
BuildRequires:  %{python_module pydot}
BuildRequires:  %{python_module pyparsing}
BuildRequires:  %{python_module pytest-attrib}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module py}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
# The not yet singlespeced module deps
# build documentation
#BuildRequires:  %%{python_module Sphinx}
# build tests need non packaged modules
#BuildRequires:  %%{python_module colorama}
#BuildRequires:  %%{python_module pluggy}
Requires:       python-click
Requires:       python-jsonref
Requires:       python-jsonschema
Requires:       python-lark-parser >= 0.6
BuildArch:      noarch

A Python 2, 3 library to create, parse, and modify MapServer Mapfiles.
Pure Python - no MapServer dependencies.

mappyfile takes a Mapfile as input and parses it into an Abstract syntax
tree (AST) using plyplus which in turn is built on PLY. mappyfile can then
transform the AST into a dictionary structure, containing keys, values,
dicts, and lists familiar to Python programmers.
This structure can be edited directly. Alternatively new objects can be
added by parsing further Mapfile text and inserting into the dictionary
structure. mappyfile also includes a “pretty printer” to export this
dictionary structure back to a Mapfile.

More on

%setup -q -n mappyfile-%{version}
rm -rf *.egg-info
sed -i "s/\r//g" LICENSE
sed -i "s/\r//g" README.rst

# Build singlehtml help
#cd doc
#make singlehtml

%python_expand %fdupes %{buildroot}%{$python_sitelib}

# Upstream issue #9
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_version} --ignore=tests/mapfiles tests/

%files %{python_files}
%license LICENSE
%doc README.rst
%python3_only %{_bindir}/*