Blob Blame History Raw
%global forgeurl https://github.com/googlefonts/compreffor
%global tag %{version}

Name:           python-compreffor
Version:        0.5.1.post1
%forgemeta
Release:        %autorelease
Summary:        CFF table subroutinizer for FontTools

License:        ASL 2.0
URL:            %{forgeurl}
Source0:        %{forgesource}
# Man page written by hand for Fedora in groff_man(7) format using the
# command’s --help output
Source1:        compreffor.1

# Drop the setuptools_git_ls_files dependency
#
# This dependency makes sense upstream, but we do not need it (and it is
# not packaged) in Fedora.
Patch0:         0001-Drop-the-setuptools_git_ls_files-dependency.patch

BuildRequires:  python3-devel

BuildRequires:  make
BuildRequires:  gcc-c++
# From setup.py: cython_min_version = '0.29.24'
BuildRequires:  python3dist(cython) >= 0.29.24

%global common_description %{expand:
A CFF (Compact Font Format) table subroutinizer for FontTools.}

%description %{common_description}


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

%description -n python3-compreffor %{common_description}


%prep
%forgeautosetup -p1
cp -vp '%{SOURCE1}' .

# Remove shebangs from non-script sources. The find-then-modify pattern
# preserves mtimes on sources that did not need to be modified.
find 'src' -type f -name '*.py' \
    -exec gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' |
  xargs -r sed -r -i '1{/^#!/d}'

# Remove Cython-generated sources; we must ensure they are regenerated.
find src/cython -type f -name '*.c*' -print -delete

# Do not use requirements.txt for tox dependencies, as it contains (only) an
# overly-strict pinned fonttools version.
sed -r -i '/^[[:blank:]]*-rrequirements.txt[[:blank:]]*/d' 'tox.ini'


%generate_buildrequires
export SETUPTOOLS_SCM_PRETEND_VERSION='%{version}'
%pyproject_buildrequires -t


%build
export SETUPTOOLS_SCM_PRETEND_VERSION='%{version}'
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files compreffor
install -t '%{buildroot}%{_mandir}/man1' -p -m 0644 -D 'compreffor.1'


%check
%tox


%files -n python3-compreffor -f %{pyproject_files}
%doc README.rst

%{_bindir}/compreffor
%{_mandir}/man1/compreffor.1*


%changelog
%autochangelog