forked from pool/python-unify
Accepting request 1230268 from devel:languages:python
- Switch to autosetup and pyproject macros. - Add patch no-more-lib2to3.patch: * Don't use lib2to3, use the tokenize module. OBS-URL: https://build.opensuse.org/request/show/1230268 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-unify?expand=0&rev=7
This commit is contained in:
15
no-more-lib2to3.patch
Normal file
15
no-more-lib2to3.patch
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Index: unify-0.5/unify.py
|
||||||
|
===================================================================
|
||||||
|
--- unify-0.5.orig/unify.py
|
||||||
|
+++ unify-0.5/unify.py
|
||||||
|
@@ -122,8 +122,8 @@ def detect_encoding(filename):
|
||||||
|
"""Return file encoding."""
|
||||||
|
try:
|
||||||
|
with open(filename, 'rb') as input_file:
|
||||||
|
- from lib2to3.pgen2 import tokenize as lib2to3_tokenize
|
||||||
|
- encoding = lib2to3_tokenize.detect_encoding(input_file.readline)[0]
|
||||||
|
+ import tokenize
|
||||||
|
+ encoding = tokenize.detect_encoding(input_file.readline)[0]
|
||||||
|
|
||||||
|
# Check for correctness of encoding.
|
||||||
|
with open_with_encoding(filename, encoding) as input_file:
|
@@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Dec 12 05:44:15 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Switch to autosetup and pyproject macros.
|
||||||
|
- Add patch no-more-lib2to3.patch:
|
||||||
|
* Don't use lib2to3, use the tokenize module.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 19 12:44:31 UTC 2024 - Markéta Machová <mmachova@suse.com>
|
Tue Mar 19 12:44:31 UTC 2024 - Markéta Machová <mmachova@suse.com>
|
||||||
|
|
||||||
|
@@ -21,11 +21,14 @@ Version: 0.5
|
|||||||
Release: 0
|
Release: 0
|
||||||
Summary: Tool to modify strings to use the same quotes
|
Summary: Tool to modify strings to use the same quotes
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Python
|
|
||||||
URL: https://github.com/myint/unify
|
URL: https://github.com/myint/unify
|
||||||
Source: https://github.com/myint/unify/archive/v%{version}.tar.gz
|
Source: https://github.com/myint/unify/archive/v%{version}.tar.gz
|
||||||
Source9: README.suse
|
Source9: README.suse
|
||||||
|
# PATCH-FIX-OPENSUSE Do not use lib2to3
|
||||||
|
Patch0: no-more-lib2to3.patch
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-untokenize
|
Requires: python-untokenize
|
||||||
@@ -45,21 +48,22 @@ Note that the "unify" executable has been renamed to "unify_quotes" to
|
|||||||
avoid conflicts with the wdiff package.
|
avoid conflicts with the wdiff package.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n unify-%{version}
|
%autosetup -p1 -n unify-%{version}
|
||||||
sed -i -e '/^#!\//, 1d' unify.py
|
sed -i -e '/^#!\//, 1d' unify.py
|
||||||
cp %{SOURCE9} .
|
cp %{SOURCE9} .
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# https://github.com/myint/unify/issues/22
|
# https://github.com/myint/unify/issues/22
|
||||||
donttest="DUMMY"
|
donttest="DUMMY"
|
||||||
python312_donttest="or (TestUnitsWithFstrings and test_format_code)"
|
python312_donttest="or (TestUnitsWithFstrings and test_format_code)"
|
||||||
|
python313_donttest=$python312_donttest
|
||||||
%pytest -k "not ($donttest ${$python_donttest})"
|
%pytest -k "not ($donttest ${$python_donttest})"
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
mv %{buildroot}%{_bindir}/unify %{buildroot}%{_bindir}/unify_quotes
|
mv %{buildroot}%{_bindir}/unify %{buildroot}%{_bindir}/unify_quotes
|
||||||
%python_clone -a %{buildroot}%{_bindir}/unify_quotes
|
%python_clone -a %{buildroot}%{_bindir}/unify_quotes
|
||||||
@@ -75,7 +79,7 @@ mv %{buildroot}%{_bindir}/unify %{buildroot}%{_bindir}/unify_quotes
|
|||||||
%doc README.rst README.suse
|
%doc README.rst README.suse
|
||||||
%python_alternative %{_bindir}/unify_quotes
|
%python_alternative %{_bindir}/unify_quotes
|
||||||
%{python_sitelib}/unify.py
|
%{python_sitelib}/unify.py
|
||||||
%pycache_only %{python_sitelib}/__pycache__/unify*
|
%pycache_only %{python_sitelib}/__pycache__/unify*pyc
|
||||||
%{python_sitelib}/unify-%{version}*info
|
%{python_sitelib}/unify-%{version}.dist-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Reference in New Issue
Block a user