From 3ae6d4d425b8aba90f5de8c02c6dfd60ea053ff22604eb59eb3bc25981cbd1ec Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 12 Dec 2024 05:46:20 +0000 Subject: [PATCH] - 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/package/show/devel:languages:python/python-unify?expand=0&rev=18 --- .gitattributes | 23 ++++++++++++ .gitignore | 1 + README.suse | 2 + no-more-lib2to3.patch | 15 ++++++++ python-unify.changes | 63 ++++++++++++++++++++++++++++++++ python-unify.spec | 85 +++++++++++++++++++++++++++++++++++++++++++ v0.5.tar.gz | 3 ++ 7 files changed, 192 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 README.suse create mode 100644 no-more-lib2to3.patch create mode 100644 python-unify.changes create mode 100644 python-unify.spec create mode 100644 v0.5.tar.gz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/README.suse b/README.suse new file mode 100644 index 0000000..9771ae9 --- /dev/null +++ b/README.suse @@ -0,0 +1,2 @@ +Note that the "unify" executable has been renamed to "unify_quotes" to +avoid conflicts with the wdiff package. diff --git a/no-more-lib2to3.patch b/no-more-lib2to3.patch new file mode 100644 index 0000000..d7328c6 --- /dev/null +++ b/no-more-lib2to3.patch @@ -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: diff --git a/python-unify.changes b/python-unify.changes new file mode 100644 index 0000000..7dd4e7f --- /dev/null +++ b/python-unify.changes @@ -0,0 +1,63 @@ +------------------------------------------------------------------- +Thu Dec 12 05:44:15 UTC 2024 - Steve Kowalik + +- 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á + +- Skip failing tests on Python 3.12 + +------------------------------------------------------------------- +Mon May 18 09:10:41 UTC 2020 - Petr Gajdos + +- %python3_only -> %python_alternative + +------------------------------------------------------------------- +Tue Sep 10 09:32:34 UTC 2019 - Tomáš Chvátal + +- Update to 0.5: + * Provide license + * minor fixes + +------------------------------------------------------------------- +Mon Jun 3 11:36:19 UTC 2019 - pgajdos@suse.com + +- run the testsuite, call spec-cleaner + +------------------------------------------------------------------- +Tue Dec 4 12:55:36 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Sun Jun 10 14:22:09 UTC 2018 - jengelh@inai.de + +- Use noun phrase in summary. + +------------------------------------------------------------------- +Sat Jun 9 12:16:49 UTC 2018 - toddrme2178@gmail.com + +- Include README.suse in package + +------------------------------------------------------------------- +Sat Jun 9 04:35:32 UTC 2018 - toddrme2178@gmail.com + +- Fix conflicts with wdiff. + The "unify" executable has been renamed to "unify_quotes" + +------------------------------------------------------------------- +Thu May 24 17:51:37 UTC 2018 - toddrme2178@gmail.com + +- Update 0.4 + * Add bytes support python3 + * add support for python >= 3.6 fstrings + * Return 1 upon missing file +- spec file cleanups + +------------------------------------------------------------------- +Tue Nov 7 18:41:09 UTC 2017 - toddrme2178@gmail.com + +- initial version diff --git a/python-unify.spec b/python-unify.spec new file mode 100644 index 0000000..beac610 --- /dev/null +++ b/python-unify.spec @@ -0,0 +1,85 @@ +# +# spec file for package python-unify +# +# Copyright (c) 2024 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/ +# + + +Name: python-unify +Version: 0.5 +Release: 0 +Summary: Tool to modify strings to use the same quotes +License: MIT +URL: https://github.com/myint/unify +Source: https://github.com/myint/unify/archive/v%{version}.tar.gz +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 wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-untokenize +Requires(post): update-alternatives +Requires(postun): update-alternatives +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module untokenize} +# /SECTION +%python_subpackages + +%description +Modifies strings to all use the same (single/double) quote where possible. + +Note that the "unify" executable has been renamed to "unify_quotes" to +avoid conflicts with the wdiff package. + +%prep +%autosetup -p1 -n unify-%{version} +sed -i -e '/^#!\//, 1d' unify.py +cp %{SOURCE9} . + +%build +%pyproject_wheel + +%check +# https://github.com/myint/unify/issues/22 +donttest="DUMMY" +python312_donttest="or (TestUnitsWithFstrings and test_format_code)" +python313_donttest=$python312_donttest +%pytest -k "not ($donttest ${$python_donttest})" + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +mv %{buildroot}%{_bindir}/unify %{buildroot}%{_bindir}/unify_quotes +%python_clone -a %{buildroot}%{_bindir}/unify_quotes + +%post +%python_install_alternative unify_quotes + +%postun +%python_uninstall_alternative unify_quotes + +%files %{python_files} +%license LICENSE +%doc README.rst README.suse +%python_alternative %{_bindir}/unify_quotes +%{python_sitelib}/unify.py +%pycache_only %{python_sitelib}/__pycache__/unify*pyc +%{python_sitelib}/unify-%{version}.dist-info + +%changelog diff --git a/v0.5.tar.gz b/v0.5.tar.gz new file mode 100644 index 0000000..26a6200 --- /dev/null +++ b/v0.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1794af47aed6ace9fbd31da7a371e67602bc03595732c2727fcf77e6dd04a91e +size 6196