Blob Blame History Raw
%global srcname strictyaml

Name:           python-%{srcname}
Version:        1.4.0
%global forgeurl https://github.com/crdoconnor/%{srcname}/
#%%global tag %%{version}
# Upstream failed to tag the 1.4.0 release:
%global commit ae2131a8dab9a341fd30b8334d69a4d319252cd1
%forgemeta
Release:        %autorelease
Summary:        Parses and validates a restricted subset of YAML

License:        MIT
URL:            http://hitchdev.com/%{srcname}
Source0:        %{forgesource}

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  pyproject-rpm-macros

# We do not attempt to build the documentation, since it requires an
# idiosyncratic build system (see https://hitchdev.com/) that is hopelessly
# entangled with the idea of downloading dependencies from PyPI. An offline
# build would be nearly impossible.

%global common_description %{expand:
StrictYAML is a type-safe YAML parser that parses and validates a restricted
subset of the YAML specification.

Priorities:

  • Beautiful API
  • Refusing to parse the ugly, hard to read and insecure features of YAML like
    the Norway problem.
  • Strict validation of markup and straightforward type casting.
  • Clear, readable exceptions with code snippets and line numbers.
  • Acting as a near-drop in replacement for pyyaml, ruamel.yaml or poyo.
  • Ability to read in YAML, make changes and write it out again with comments
    preserved.
  • Not speed, currently.}

%description %{common_description}


%generate_buildrequires
%pyproject_buildrequires -r


%package -n     python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{srcname} %{common_description}


%prep
%forgesetup
# Upstream’s idiosyncratic build system normally handles this:
sed -r -i 's/(__version__ *= *")DEVELOPMENT_VERSION"/\1%{version}"/' \
    'strictyaml/__init__.py'


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files %{srcname}


%check
# There are no tests. (If there were, it would be as hard to run them as it is
# to build the documentation.)
%py3_check_import %{srcname}


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE.txt
%doc CHANGELOG.md
%doc README.md


%changelog
%autochangelog