Sync from SUSE:ALP:Source:Standard:1.0 python-smartypants revision e978dd6e259a7b5f66c2aa11171ec595

This commit is contained in:
Adrian Schröter 2023-10-19 04:25:27 +02:00
commit a9f7c110bd
6 changed files with 395 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

99
fix-312.patch Normal file
View File

@ -0,0 +1,99 @@
Index: smartypants.py-2.0.1/tests/test_cli.py
===================================================================
--- smartypants.py-2.0.1.orig/tests/test_cli.py
+++ smartypants.py-2.0.1/tests/test_cli.py
@@ -35,7 +35,7 @@ class TestCLI(unittest.TestCase):
E = '“foobar”'
output = self._p([sys.executable, CLI_SCRIPT], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
def test_pipe_attr(self):
@@ -43,11 +43,11 @@ class TestCLI(unittest.TestCase):
E = T
output = self._p([sys.executable, CLI_SCRIPT, '--attr', '0'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = """"foo" “bar”"""
output = self._p([sys.executable, CLI_SCRIPT, '--attr', 'b'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
def test_skipped_elements(self):
@@ -55,19 +55,19 @@ class TestCLI(unittest.TestCase):
E = '<a>&#8220;foo&#8221;</a> <b>&#8220;bar&#8221;</b>'
output = self._p([sys.executable, CLI_SCRIPT], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = '<a>"foo"</a> <b>&#8220;bar&#8221;</b>'
output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = '<a>&#8220;foo&#8221;</a> <b>"bar"</b>'
output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'b'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = T
output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a,b'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
def test_file(self):
@@ -82,4 +82,4 @@ class TestCLI(unittest.TestCase):
output = self._p([sys.executable, CLI_SCRIPT, F])
finally:
os.remove(F)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
Index: smartypants.py-2.0.1/smartypants.py
===================================================================
--- smartypants.py-2.0.1.orig/smartypants.py
+++ smartypants.py-2.0.1/smartypants.py
@@ -268,13 +268,13 @@ def smartypants(text, attr=None):
if do_quotes:
if t == "'":
# Special case: single-character ' token
- if re.match("\S", prev_token_last_char):
+ if re.match(r"\S", prev_token_last_char):
t = "&#8217;"
else:
t = "&#8216;"
elif t == '"':
# Special case: single-character " token
- if re.match("\S", prev_token_last_char):
+ if re.match(r"\S", prev_token_last_char):
t = "&#8221;"
else:
t = "&#8220;"
Index: smartypants.py-2.0.1/tests/test.py
===================================================================
--- smartypants.py-2.0.1.orig/tests/test.py
+++ smartypants.py-2.0.1/tests/test.py
@@ -24,7 +24,7 @@ class SmartyPantsTestCase(unittest.TestC
T = sp(TEXT)
E = '&#8220;foo&#8221; -- bar'
- self.assertEquals(T, E)
+ self.assertEqual(T, E)
attr = Attr.q | Attr.d
Attr.default = attr
@@ -32,7 +32,7 @@ class SmartyPantsTestCase(unittest.TestC
T = sp(TEXT)
E = '&#8220;foo&#8221; &#8212; bar'
- self.assertEquals(T, E)
+ self.assertEqual(T, E)
def test_dates(self):

126
python-smartypants.changes Normal file
View File

@ -0,0 +1,126 @@
-------------------------------------------------------------------
Mon Sep 25 08:24:56 UTC 2023 - Ondřej Súkup <mimi.vx@gmail.com>
- add fix-312.patch to fix python3.12 build
-------------------------------------------------------------------
Fri Apr 21 12:34:12 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:44:55 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Tue Mar 14 20:32:40 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add use-sys-executable.patch to run the tests with the flavor
python interpreter
-------------------------------------------------------------------
Wed Sep 8 10:03:32 UTC 2021 - pgajdos@suse.com
- %check: use %pyunittest rpm macro
- use python3 instead of python in env
-------------------------------------------------------------------
Tue May 7 15:40:36 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Activate test suite
- Update Summary and Description
- Add %doc
-------------------------------------------------------------------
Tue Dec 4 12:54:22 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Sun Jul 29 12:34:27 UTC 2018 - jengelh@inai.de
- Update descriptions.
-------------------------------------------------------------------
Thu May 24 17:45:27 UTC 2018 - toddrme2178@gmail.com
- Update to 2.0.1
* use re.match instead of re.search to improve performance on large strings
- spec file cleanups
- Switch to wheel
- Add license
-------------------------------------------------------------------
Sun May 7 16:15:51 UTC 2017 - benoit.monin@gmx.fr
- convert the package to singlespec
- call fdupes to fix duplicated files
-------------------------------------------------------------------
Thu Dec 29 14:45:52 UTC 2016 - benoit.monin@gmx.fr
- update to version 2.0.0
+ drop Pyblosxom support
+ drop str-type attr
+ drop fooBarXyz functions, such as smartyPants, educateQuotes,
and processEscapes
+ add Attr.u and Attr.h for Unicode characters and HTML named
entities outputs, respectively. The stupefy_entities has become
convert_entities to support all three types of conversions.(#6)
+ Makefile: do not build bdist_wininst --plat-name win32 per
:pep:527#bdist-dmg-bdist-msi-and-bdist-wininst
+ Makefile: test packages build in test_setup target
+ Makefile: rename target install_test to test_setup
- additional changes from version 1.8.6
+ Makefile: add LC_ALL=C test for locale setting on setup.py wrt
+ change virtualenv invocation method in install_test target
+ fix UnicodeDecodeError on opening smartypants.py, which
includes Unicode characters, when running setup.py with Python3
and specific locales
- update project url
- update source url to pythonhosted
-------------------------------------------------------------------
Thu Jul 17 19:28:18 UTC 2014 - benoit.monin@gmx.fr
- fix usage of update-alternatives
-------------------------------------------------------------------
Thu Jul 3 18:05:07 UTC 2014 - benoit.monin@gmx.fr
- update to version 1.8.5
+ fix requirement of Wheel, now optional
- remove BuildRequires python-wheel, now unneeded
-------------------------------------------------------------------
Wed Jul 2 18:50:55 UTC 2014 - benoit.monin@gmx.fr
- use update-alternatives for the smartypants binary
-------------------------------------------------------------------
Tue Jul 1 18:15:02 UTC 2014 - benoit.monin@gmx.fr
- update to version 1.8.4
+ add missing COPYING and CHANGES.rst to package
+ add bdist_wheel to the building process for Python Wheel format
+ add test_doc8 target
+ fix install_test on missing of Wheel package
+ fix argparse version option breaks CLI on Python 3
- add build dependencies python-setuptools and python-wheel
- drop chmod on README.rst, fixed upstream
- remove shebang and excutable bit on smartypants.py, not a script
- add COPYING and CHANGE.rst to package documentation
-------------------------------------------------------------------
Tue Nov 19 16:20:12 UTC 2013 - p.drouand@gmail.com
- Update to version 1.8.3
+ No changelog available
- COPYING is not provided anymore by upstream
-------------------------------------------------------------------
Mon Jul 23 13:27:55 UTC 2012 - saschpe@suse.de
- Initial version

76
python-smartypants.spec Normal file
View File

@ -0,0 +1,76 @@
#
# spec file for package python-smartypants
#
# Copyright (c) 2023 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 https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-smartypants
Version: 2.0.1
Release: 0
Summary: Python fork of perl SmartyPants
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/leohemsted/smartypants.py
Source: https://github.com/leohemsted/smartypants.py/archive/v%{version}.tar.gz#/smartypants-%{version}.tar.gz
Patch0: use-sys-executable.patch
Patch1: fix-312.patch
BuildRequires: %{python_module docutils}
BuildRequires: %{python_module pygments}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires(post): update-alternatives
Requires(postun):update-alternatives
BuildArch: noarch
%python_subpackages
%description
smartypants is a Python implementation of the perl SmartyPants,
which translates plain ASCII punctuation characters into smart
typographic punctuation HTML entities.
%prep
%autosetup -p1 -n smartypants.py-%{version}
%build
%python_build
%install
%python_install
%{python_expand sed -i '1{/^#!/d}' %{buildroot}%{$python_sitelib}/smartypants.py
%fdupes %{buildroot}%{$python_sitelib}
}
%python_clone -a %{buildroot}%{_bindir}/smartypants
%post
%python_install_alternative smartypants
%postun
%python_uninstall_alternative smartypants
%check
%pyunittest discover -v tests
%files %{python_files}
%license COPYING
%doc README.rst docs/*.rst
%python_alternative %{_bindir}/smartypants
%{python_sitelib}/smartypants.py
%{python_sitelib}/smartypants-%{version}*-info
%pycache_only %{python_sitelib}/__pycache__/*
%changelog

BIN
smartypants-2.0.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

68
use-sys-executable.patch Normal file
View File

@ -0,0 +1,68 @@
Index: smartypants.py-2.0.1/tests/test_cli.py
===================================================================
--- smartypants.py-2.0.1.orig/tests/test_cli.py
+++ smartypants.py-2.0.1/tests/test_cli.py
@@ -7,6 +7,7 @@ import os
import tempfile
import unittest
from subprocess import PIPE, Popen
+import sys
CLI_SCRIPT = './smartypants'
@@ -33,7 +34,7 @@ class TestCLI(unittest.TestCase):
T = '"foobar"'
E = '&#8220;foobar&#8221;'
- output = self._p([CLI_SCRIPT], T)
+ output = self._p([sys.executable, CLI_SCRIPT], T)
self.assertEquals(output, E)
def test_pipe_attr(self):
@@ -41,11 +42,11 @@ class TestCLI(unittest.TestCase):
T = """"foo" ``bar''"""
E = T
- output = self._p([CLI_SCRIPT, '--attr', '0'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--attr', '0'], T)
self.assertEquals(output, E)
E = """"foo" &#8220;bar&#8221;"""
- output = self._p([CLI_SCRIPT, '--attr', 'b'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--attr', 'b'], T)
self.assertEquals(output, E)
def test_skipped_elements(self):
@@ -53,19 +54,19 @@ class TestCLI(unittest.TestCase):
T = '<a>"foo"</a> <b>"bar"</b>'
E = '<a>&#8220;foo&#8221;</a> <b>&#8220;bar&#8221;</b>'
- output = self._p([CLI_SCRIPT], T)
+ output = self._p([sys.executable, CLI_SCRIPT], T)
self.assertEquals(output, E)
E = '<a>"foo"</a> <b>&#8220;bar&#8221;</b>'
- output = self._p([CLI_SCRIPT, '--skip', 'a'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a'], T)
self.assertEquals(output, E)
E = '<a>&#8220;foo&#8221;</a> <b>"bar"</b>'
- output = self._p([CLI_SCRIPT, '--skip', 'b'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'b'], T)
self.assertEquals(output, E)
E = T
- output = self._p([CLI_SCRIPT, '--skip', 'a,b'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a,b'], T)
self.assertEquals(output, E)
def test_file(self):
@@ -78,7 +79,7 @@ class TestCLI(unittest.TestCase):
with open(F, 'w') as f:
f.write(T)
- output = self._p([CLI_SCRIPT, F])
+ output = self._p([sys.executable, CLI_SCRIPT, F])
finally:
os.remove(F)
self.assertEquals(output, E)