14
0
forked from pool/python-unify

- 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
This commit is contained in:
2024-12-12 05:46:20 +00:00
committed by Git OBS Bridge
commit 3ae6d4d425
7 changed files with 192 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

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

2
README.suse Normal file
View File

@@ -0,0 +1,2 @@
Note that the "unify" executable has been renamed to "unify_quotes" to
avoid conflicts with the wdiff package.

15
no-more-lib2to3.patch Normal file
View 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:

63
python-unify.changes Normal file
View File

@@ -0,0 +1,63 @@
-------------------------------------------------------------------
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>
- Skip failing tests on Python 3.12
-------------------------------------------------------------------
Mon May 18 09:10:41 UTC 2020 - Petr Gajdos <pgajdos@suse.com>
- %python3_only -> %python_alternative
-------------------------------------------------------------------
Tue Sep 10 09:32:34 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- 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 <mcepl@suse.com>
- 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

85
python-unify.spec Normal file
View File

@@ -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

3
v0.5.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1794af47aed6ace9fbd31da7a371e67602bc03595732c2727fcf77e6dd04a91e
size 6196