From 78e6e3287942a3e489c3c76dd20b5d96c03df1ce Mon Sep 17 00:00:00 2001 From: Lyes Saadi Date: Wed, 27 Dec 2023 21:23:44 +0100 Subject: [PATCH] Initial import --- .gitignore | 1 + ...ead-of-doh-to-use-only-fonts-contrib.patch | 79 +++++++++ generate-pyfiglet-tarball.sh | 18 ++ python-pyfiglet.spec | 159 ++++++++++++++++++ sources | 1 + 5 files changed, 258 insertions(+) create mode 100644 .gitignore create mode 100644 0001-Use-slant-instead-of-doh-to-use-only-fonts-contrib.patch create mode 100755 generate-pyfiglet-tarball.sh create mode 100644 python-pyfiglet.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e77ad5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/pyfiglet-1.0.2-no-contrib-font.tar.gz diff --git a/0001-Use-slant-instead-of-doh-to-use-only-fonts-contrib.patch b/0001-Use-slant-instead-of-doh-to-use-only-fonts-contrib.patch new file mode 100644 index 0000000..9be25f9 --- /dev/null +++ b/0001-Use-slant-instead-of-doh-to-use-only-fonts-contrib.patch @@ -0,0 +1,79 @@ +From 93992dd2eb987cc70b715fbe27b8395f7f21fe29 Mon Sep 17 00:00:00 2001 +From: Lyes Saadi +Date: Wed, 27 Dec 2023 20:18:32 +0100 +Subject: [PATCH 1/1] Use slant instead of doh to use only fonts-contrib + +--- + pyfiglet/tests/test_cli.py | 46 ++++++++++---------------------------- + 1 file changed, 12 insertions(+), 34 deletions(-) + +diff --git a/pyfiglet/tests/test_cli.py b/pyfiglet/tests/test_cli.py +index fb88bbd..b79e8d0 100644 +--- a/pyfiglet/tests/test_cli.py ++++ b/pyfiglet/tests/test_cli.py +@@ -11,24 +11,13 @@ def test_font_dir(): + + + def test_strip(): +- command = "pyfiglet -f doh -s 0" ++ command = "pyfiglet -f slant -s 0" + expected = '''\ +- 000000000 +- 00:::::::::00 +- 00:::::::::::::00 +-0:::::::000:::::::0 +-0::::::0 0::::::0 +-0:::::0 0:::::0 +-0:::::0 0:::::0 +-0:::::0 000 0:::::0 +-0:::::0 000 0:::::0 +-0:::::0 0:::::0 +-0:::::0 0:::::0 +-0::::::0 0::::::0 +-0:::::::000:::::::0 +- 00:::::::::::::00 +- 00:::::::::00 +- 000000000 ++ ____ ++ / __ \\ ++ / / / / ++/ /_/ / ++\\____/ + ''' + result = subprocess.run(command, shell=True, stdout=subprocess.PIPE) + assert result.stdout.decode() == expected +@@ -58,25 +47,14 @@ def test_strip_strange_font(test_font_dir): + + # normalize is just strip with padding + def test_normalize(): +- command = "pyfiglet -f doh -n 0" ++ command = "pyfiglet -f slant -n 0" + expected = '''\ + +- 000000000 +- 00:::::::::00 +- 00:::::::::::::00 +-0:::::::000:::::::0 +-0::::::0 0::::::0 +-0:::::0 0:::::0 +-0:::::0 0:::::0 +-0:::::0 000 0:::::0 +-0:::::0 000 0:::::0 +-0:::::0 0:::::0 +-0:::::0 0:::::0 +-0::::::0 0::::::0 +-0:::::::000:::::::0 +- 00:::::::::::::00 +- 00:::::::::00 +- 000000000 ++ ____ ++ / __ \\ ++ / / / / ++/ /_/ / ++\\____/ + + ''' + result = subprocess.run(command, shell=True, stdout=subprocess.PIPE) +-- +2.43.0 + diff --git a/generate-pyfiglet-tarball.sh b/generate-pyfiglet-tarball.sh new file mode 100755 index 0000000..b1bb4ab --- /dev/null +++ b/generate-pyfiglet-tarball.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +REL=$1 +#SHORTCOMMIT=${COMMIT:0:7} + +wget https://github.com/pwaller/pyfiglet/archive/v$REL/pyfiglet-$REL.tar.gz + +tar -xzvf pyfiglet-$REL.tar.gz + +mv pyfiglet-$REL pyfiglet-$REL + +rm -rf pyfiglet-$REL/pyfiglet/fonts-contrib + +tar -czvf pyfiglet-$REL-no-contrib-font.tar.gz pyfiglet-$REL + +# Cleaning +rm -rf pyfiglet-$REL/ +rm -f pyfiglet-$REL.tar.gz diff --git a/python-pyfiglet.spec b/python-pyfiglet.spec new file mode 100644 index 0000000..7ffd74d --- /dev/null +++ b/python-pyfiglet.spec @@ -0,0 +1,159 @@ +%global pypi_name pyfiglet + +Name: python-%{pypi_name} +Version: 1.0.2 +Release: %autorelease +Summary: Pure-python FIGlet implementation + +# The following fonts are under another licence, the rest of the code is MIT. +# +# BSD: +# - banner.flf +# - big.flf +# - block.flf +# - bubble.flf +# - digital.flf +# - ivrit.flf +# - lean.flf +# - mini.flf +# - mnemonic.flf +# - script.flf +# - shadow.flf +# - slant.flf +# - small.flf +# - smscript.flf +# - smshadow.flf +# - smslant.flf +# - standard.flf +# - term.flf +# +# NTP: +# - clb6x10.flf +# - clb8x10.flf +# - clb8x8.flf +# - cli8x8.flf +# - clr4x6.flf +# - clr5x10.flf +# - clr5x6.flf +# - clr5x8.flf +# - clr6x10.flf +# - clr6x6.flf +# - clr6x8.flf +# - clr7x10.flf +# - clr7x8.flf +# - clr8x10.flf +# - clr8x8.flf +# - cour.flf +# - courb.flf +# - courbi.flf +# - couri.flf +# - helv.flf +# - helvb.flf +# - helvbi.flf +# - helvi.flf +# - sbook.flf +# - sbookb.flf +# - sbookbi.flf +# - sbooki.flf +# - times.flf +# - xcour.flf +# - xcourb.flf +# - xcourbi.flf +# - xcouri.flf +# - xhelv.flf +# - xhelvb.flf +# - xhelvbi.flf +# - xhelvi.flf +# - xsbook.flf +# - xsbookb.flf +# - xsbookbi.flf +# - xsbooki.flf +# - xtimes.flf +# +# HPND: +# - 5x8.flf +# - chartr.flf +# - chartri.flf +# - xchartr.flf +# - xchartri.flf +# +# X11: +# - 5x7.flf +# - 6x9.flf +License: MIT AND BSD-3-Clause AND NTP AND HPND AND X11 +URL: https://github.com/pwaller/pyfiglet +Source0: pyfiglet-%{version}-no-contrib-font.tar.gz +# Removes all fonts in pyfiglet/fonts-contrib +# USAGE: +# ./generate-pyfiglet-tarball.sh VERSION +Source1: generate-pyfiglet-tarball.sh + +# https://github.com/pwaller/pyfiglet/pull/137 +Patch0: 0001-Use-slant-instead-of-doh-to-use-only-fonts-contrib.patch + +BuildArch: noarch +# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval +ExcludeArch: %{ix86} + +BuildRequires: git-core +BuildRequires: glibc-common +BuildRequires: python3-devel +BuildRequires: python3dist(pytest) + + +%global _description %{expand: +pyfiglet is a full port of FIGlet (http://www.figlet.org/) into pure python. It +takes ASCII text and renders it in ASCII art fonts (like the title above, which +is the 'block' font).} + +%description %{_description} + + +%package -n python3-%{pypi_name} +Summary: %{summary} + +%description -n python3-%{pypi_name} %{_description} + + +%prep +%autosetup -n %{pypi_name}-%{version} -S git + +mv pyfiglet/fonts-standard pyfiglet/fonts + +# Resolve RPMLint errors +%py3_shebang_fix pyfiglet/{__init__,test}.py + +# Change figfont.txt encoding +iconv -f ISO8859-1 -t UTF-8 doc/figfont.txt -o figfont.txt + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install + +%pyproject_save_files %{pypi_name} + +chmod 0755 %{buildroot}%{python3_sitelib}/%{pypi_name}/{__init__,test}.py +install -Dpm 0644 -t %{buildroot}%{_mandir}/man1/ doc/%{pypi_name}.1 + + +%check +%pytest + +rm %{buildroot}%{python3_sitelib}/%{pypi_name}/fonts/TEST_ONLY.flf + + +%files -n python3-%{pypi_name} -f %{pyproject_files} +%doc README.md figfont.txt +%{_bindir}/%{pypi_name} +%{_mandir}/man1/%{pypi_name}.1.* + + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..34db809 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (pyfiglet-1.0.2-no-contrib-font.tar.gz) = 19b304d87c12f664b645653c3f5b0425fd3452af166cc50c936adb0eb28df99c229656752dc3e7ee73090c9de0ecb3f72d4fd972a7a1ed34354b5de67b34d6af