From 8a6c596ccd9fe19abaf4f29d18cc7da2d7a01327844753f4ca249a9512addfab Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 29 Sep 2025 16:13:33 +0000 Subject: [PATCH] - update to 2.6.14: * Add support for meson.options * fix: add robot filetype OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-identify?expand=0&rev=48 --- .gitattributes | 23 +++ .gitignore | 1 + 0001-use-editdistance-not-ukkonen.patch | 61 +++++++ identify-2.6.13.tar.gz | 3 + identify-2.6.14.tar.gz | 3 + python-identify.changes | 206 ++++++++++++++++++++++++ python-identify.spec | 88 ++++++++++ 7 files changed, 385 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-use-editdistance-not-ukkonen.patch create mode 100644 identify-2.6.13.tar.gz create mode 100644 identify-2.6.14.tar.gz create mode 100644 python-identify.changes create mode 100644 python-identify.spec 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/0001-use-editdistance-not-ukkonen.patch b/0001-use-editdistance-not-ukkonen.patch new file mode 100644 index 0000000..65c0624 --- /dev/null +++ b/0001-use-editdistance-not-ukkonen.patch @@ -0,0 +1,61 @@ +From: Matthias Fehring +Date: 2023-11-01 09:44:00 +0100 +Subject: Use editdistance instead of ukkonen +Upstream: never + +Upstream switched from editdistance_s to ukkonen that is currently +not packaged for openSUSE. + +--- + identify/identify.py | 10 ++++------ + setup.cfg | 2 +- + 2 files changed, 5 insertions(+), 7 deletions(-) + +--- a/identify/identify.py 2023-10-28 19:19:41.000000000 +0200 ++++ b/identify/identify.py 2023-11-01 09:39:16.942021416 +0100 +@@ -243,7 +243,7 @@ + 3. check exact text match with existing licenses + 4. failing that use edit distance + """ +- import ukkonen # `pip install identify[license]` ++ import editdistance # `pip install identify[license]` + + with open(filename, encoding='UTF-8') as f: + contents = f.read() +@@ -253,8 +253,6 @@ + min_edit_dist = sys.maxsize + min_edit_dist_spdx = '' + +- cutoff = math.ceil(.05 * len(norm)) +- + # try exact matches + for spdx, text in licenses.LICENSES: + norm_license = _norm_license(text) +@@ -265,13 +263,13 @@ + if norm and abs(len(norm) - len(norm_license)) / len(norm) > .05: + continue + +- edit_dist = ukkonen.distance(norm, norm_license, cutoff) +- if edit_dist < cutoff and edit_dist < min_edit_dist: ++ edit_dist = editdistance.distance(norm, norm_license) ++ if edit_dist < min_edit_dist: + min_edit_dist = edit_dist + min_edit_dist_spdx = spdx + + # if there's less than 5% edited from the license, we found our match +- if norm and min_edit_dist < cutoff: ++ if norm and min_edit_dist / len(norm) < .05: + return min_edit_dist_spdx + else: + # no matches :'( +--- a/setup.cfg 2023-10-28 19:19:41.000000000 +0200 ++++ b/setup.cfg 2023-11-01 10:13:07.904157653 +0100 +@@ -31,7 +31,7 @@ + + [options.extras_require] + license = +- ukkonen ++ editdistance + + [options.package_data] + identify = diff --git a/identify-2.6.13.tar.gz b/identify-2.6.13.tar.gz new file mode 100644 index 0000000..af4d7f1 --- /dev/null +++ b/identify-2.6.13.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93a51afb4721ebbcc46045af64e26b063fd691cfb966b26c21999e028eeeb12e +size 101964 diff --git a/identify-2.6.14.tar.gz b/identify-2.6.14.tar.gz new file mode 100644 index 0000000..06657a0 --- /dev/null +++ b/identify-2.6.14.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14bbd7da84110b4bbeab623b32ed61848c4e1d75dc74a95d933832e7ce5a1453 +size 102021 diff --git a/python-identify.changes b/python-identify.changes new file mode 100644 index 0000000..4d3847f --- /dev/null +++ b/python-identify.changes @@ -0,0 +1,206 @@ +------------------------------------------------------------------- +Mon Sep 29 16:13:10 UTC 2025 - Dirk Müller + +- update to 2.6.14: + * Add support for meson.options + * fix: add robot filetype + +------------------------------------------------------------------- +Tue Aug 12 13:48:11 UTC 2025 - Nico Krapp + +- migrate to libalternatives + +------------------------------------------------------------------- +Tue Aug 12 12:39:47 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 2.6.13 + * Added C++ 'ipp' and 'tpp' file extensions + +------------------------------------------------------------------- +Tue Jun 3 07:34:40 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 2.6.12 + * Identify common MSBuild files + * Drop ambiguous .proj extension +- from version 2.6.11 + * Add support for `.sqlfluff` + * Identify XSLT files + +------------------------------------------------------------------- +Mon Apr 28 15:06:47 UTC 2025 - Markéta Machová + +- Update to 2.6.10 + * Add support for Magik +- Convert to pyproject macros + +------------------------------------------------------------------- +Tue Apr 1 12:18:10 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 2.6.9 + * Revert "add uv to interpreters list" + +------------------------------------------------------------------- +Mon Feb 24 13:34:03 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 2.6.8 + * [pre-commit.ci] pre-commit autoupdate + * feat: Register sas as an extension + * extensions: Introduce wsdl + +------------------------------------------------------------------- +Tue Feb 11 09:43:51 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 2.6.7 + * [pre-commit.ci] pre-commit autoupdate + * Upgrade asottile/workflows + * Add `.templ` extension + * Add uv to interpreters list + +------------------------------------------------------------------- +Tue Feb 4 12:20:34 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 2.6.6 + * [pre-commit.ci] pre-commit autoupdate + * Add '.asm' file extension as 'asm' filetype +- from version 2.6.5 + * feat: identify .psm1 and .psd1 files as powershell +- from version 2.6.4 + * feat: identify gleam files + * feat: identify bz3 files as bzip3 archives + * [pre-commit.ci] pre-commit autoupdate + * Add Tiltfile support + +------------------------------------------------------------------- +Mon Dec 9 08:24:58 UTC 2024 - John Paul Adrian Glaubitz + +- Update to 2.6.3 + * Add C# Script and F# Source and Script filetypes + * Add bitbake extensions and files + * feat: identify direnv files as Bash + +------------------------------------------------------------------- +Wed Nov 13 15:08:24 UTC 2024 - Dirk Müller + +- update to 2.6.2: + * Fix IndexError when shebang is just '#!/usr/bin/env' + * Add ejson extension + +------------------------------------------------------------------- +Tue May 7 20:20:50 UTC 2024 - Dirk Müller + +- update to 2.5.36: + * handle Cargo.toml + +------------------------------------------------------------------- +Sat Mar 16 08:55:39 UTC 2024 - Dirk Müller + +- update to 2.5.35: + * add .metal detection + +------------------------------------------------------------------- +Thu Dec 7 22:52:23 UTC 2023 - Dirk Müller + +- update to 2.5.33: + * add .avsc detection + * Identify Vagrantfile as Ruby + * Identify .salt-lint as YAML + +------------------------------------------------------------------- +Fri Nov 24 21:27:25 UTC 2023 - Matthias Bach + +- For Leap, build this on modern Python as 3.6 is no longer + supported. + +------------------------------------------------------------------- +Wed Nov 1 09:17:44 UTC 2023 - Matthias Fehring + +- update to version 2.5.31 + * no changelog available, alternatively have a look at + https://github.com/pre-commit/identify/compare/v2.2.13...v2.5.31 +- use editdistance instead of ukkonen + * Upstream changed from editdistance_s to ukkonen for performance + reasons. Ukkonen is not now available for openSUSE. So switch + back to editdistance for now. + * Add 0001-use-editdistance-not-ukkonen.patch +- spec file changes + * remove not required python-setuptools from Requires + * upstream URL has changed to https://github.com/pre-commit/identify + * change requirement for python-editdistance from Suggests to + Recommends + +------------------------------------------------------------------- +Wed Aug 18 12:47:19 UTC 2021 - John Paul Adrian Glaubitz + +- Update to 2.2.13 + * Add the '.kts' extension for kotlin +- from version 2.2.12 + * add adobe illustrator's .ai extension +- from version 2.2.11 + * Detect waf wscript files as Python + * stricter mypy settings + +------------------------------------------------------------------- +Thu Jun 24 12:31:47 UTC 2021 - Markéta Machová + +- update to 2.2.10 + * add few file formats + * detect WORKSPACE files as bazel +- stick with older editdistance as it has more functionality + +------------------------------------------------------------------- +Wed May 26 10:19:37 UTC 2021 - pgajdos@suse.com + +- version update to 2.2.6 + * lot of changes, no upstream changelog found + https://github.com/pre-commit/identify/compare/v1.4.14...v2.2.6 + +------------------------------------------------------------------- +Wed May 26 06:36:52 UTC 2021 - pgajdos@suse.com + +- %check: use %pytest macro + +------------------------------------------------------------------- +Mon May 25 10:59:23 UTC 2020 - Petr Gajdos + +- %python3_only -> %python_alternative + +------------------------------------------------------------------- +Thu Apr 9 13:05:29 UTC 2020 - Marketa Calabkova + +- Update to 1.4.14 + * Handle malformed shebangs + * Add Bazel, Scheme and Idris filetypes + * Plantuml; .puml suffix + * Recognize .pm as perl + * Add some common rcfiles to the list + * fix: add 'image' tag for SVG files + * feat: add adoc/asciidoc file extension + +------------------------------------------------------------------- +Wed Sep 11 15:00:28 UTC 2019 - Tomáš Chvátal + +- Update to 1.4.7: + * no upstream changelog + +------------------------------------------------------------------- +Tue Jul 30 08:42:06 UTC 2019 - pgajdos@suse.com + +- version update to 1.4.5 + * no upstream changelog + +------------------------------------------------------------------- +Tue May 21 12:44:45 UTC 2019 - pgajdos@suse.com + +- version update to 1.4.3 + * no upstream changelog + +------------------------------------------------------------------- +Tue May 7 11:40:06 UTC 2019 - pgajdos@suse.com + +- version update to 1.4.2 + * no upstream changelog + +------------------------------------------------------------------- +Thu Apr 4 01:14:57 PM UTC 2019 - John Vandenberg + +- Initial spec for v1.4.1 diff --git a/python-identify.spec b/python-identify.spec new file mode 100644 index 0000000..d71dbde --- /dev/null +++ b/python-identify.spec @@ -0,0 +1,88 @@ +# +# spec file for package python-identify +# +# Copyright (c) 2025 SUSE LLC and contributors +# +# 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/ +# + + +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + +%{?sle15_python_module_pythons} +Name: python-identify +Version: 2.6.14 +Release: 0 +Summary: File identification library for Python +License: MIT +Group: Development/Languages/Python +URL: https://github.com/pre-commit/identify +Source: https://github.com/pre-commit/identify/archive/v%{version}.tar.gz#/identify-%{version}.tar.gz +# PATCH-FIX-OPENSUSE 0001-use-editdistance-not-ukkonen.patch -- ukkonen not packaged for opensuse now +Patch1: 0001-use-editdistance-not-ukkonen.patch +BuildRequires: %{python_module editdistance} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +%if %{with libalternatives} +Requires: alts +BuildRequires: alts +%else +Requires(post): update-alternatives +Requires(postun): update-alternatives +%endif +Recommends: python-editdistance +BuildArch: noarch +%python_subpackages + +%description +File identification library for Python, including license file SPDX identifier. + +%prep +%setup -q -n identify-%{version} +%autopatch -p1 + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_clone -a %{buildroot}%{_bindir}/identify-cli +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%pre +# removing old update-alternatives entries +%python_libalternatives_reset_alternative identify-cli + +%post +%python_install_alternative identify-cli + +%postun +%python_uninstall_alternative identify-cli + +%files %{python_files} +%doc README.md +%license LICENSE +%python_alternative %{_bindir}/identify-cli +%{python_sitelib}/identify +%{python_sitelib}/identify-%{version}*info + +%changelog