14
0

- Update to 0.36.0

* We have fixed a bug that caused specfile to traceback when
    section names with conditional macro expansions containing
    spaces were present in the spec file. (#476)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-specfile?expand=0&rev=70
This commit is contained in:
2025-06-03 13:15:04 +00:00
committed by Git OBS Bridge
commit 8f064c075e
17 changed files with 507 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

374
python-specfile.changes Normal file
View File

@@ -0,0 +1,374 @@
-------------------------------------------------------------------
Mon Jun 2 08:51:14 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 0.36.0
* We have fixed a bug that caused specfile to traceback when
section names with conditional macro expansions containing
spaces were present in the spec file. (#476)
-------------------------------------------------------------------
Fri May 30 08:43:58 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 0.35.1
* We have fixed a bug that caused changes to get lost when a
spec file passed as a path was replaced or deleted. (#470)
-------------------------------------------------------------------
Wed May 14 12:17:22 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
- Update to 0.35.0
* Added support for creating Specfile instances from file objects
and strings. (#458)
* The context_management type stubs now use ParamSpec from typing_extensions
to support Python < 3.10. (#466)
-------------------------------------------------------------------
Sat Mar 29 09:45:14 UTC 2025 - Dirk Müller <dmueller@suse.com>
- update to 0.34.2:
* context_management: add a type stub override to fix typing.
Type checkers like mypy and pyright can now correctly
determine the types for `.sources()`, `.sections()`, and the
other `Specfile` methods that return context managers.
-------------------------------------------------------------------
Fri Feb 14 08:52:59 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 0.34.1
* Removed the usage of a walrus operator for Python 3.6 compatibility.
- Use Python 3.11 on SLE-15 by default
-------------------------------------------------------------------
Sat Feb 1 22:17:17 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Update to 0.34.0:
- Added support for detached (open)SUSE style changelogs
- Update to 0.33.0:
- There is a new convenience method Sections.get_or_create()
that allows you to manipulate a section without checking
if it exists first. If a section doesn't exist, it will be
appended to the end. (#441) For example, this will work
properly even on spec files without %changelog:
with spec.sections() as sections:
changelog = sections.get_or_create("changelog")
changelog[:] = ["%autochangelog"]
-------------------------------------------------------------------
Thu Nov 14 05:42:51 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
- Update to 0.32.6:
* New minor release for testing in CBS Koji
* fix: assert existence of stderr
-------------------------------------------------------------------
Tue Oct 29 10:40:28 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 0.32.5
* We have fixed our parser to take in account
the deprecations introduced in Python 3.8
-------------------------------------------------------------------
Wed Oct 16 07:29:15 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
- Update to 0.32.4:
* NEVR and NEVRA classes are now hashable
-------------------------------------------------------------------
Mon Oct 7 20:38:33 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 0.32.3:
* specfile can now handle multi-line tag values (enclosed in a
macro body, e.g. `%shrink`).
-------------------------------------------------------------------
Fri Sep 20 22:05:27 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
- Update to 0.32.2:
* Explicitly invalidate the global parse hash when a SpecParser
instance is created to prevent this issue.
-------------------------------------------------------------------
Mon Jul 29 16:25:38 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
- Update to 0.32.1:
* Fixed two issues related to condition parsing.
-------------------------------------------------------------------
Mon Jul 22 07:48:10 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
- Add typing_extensions to Requires as well -- Fix rpmlint error
- Update to 0.32.0:
* It is now possible to bump a release in a manner similar to
rpmdev-bumpspec using Specfile.bump_release() method.
-------------------------------------------------------------------
Fri Jul 5 13:06:52 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
- Add typing_extensions to BuildRequires
- Remove typing_extensions from Requires -- gh#packit/specfile#179
- Update to 0.31.0:
* Value of a Tag no longer includes trailing whitespace (if any)
* specfile now tries to expand macros before processing
conditions to be able to resolve conditional expressions
defined by macros, for example OpenSUSE Tumbleweed defines
%ifpython3 macro as %if "%{python_flavor}" == "python3"
- Updates from 0.30.0:
* Fixed an exception that occured when accessing the
Specfile.has_autochangelog property while having unparseable
lines (e.g. lines ending with unescaped %) in %changelog
-------------------------------------------------------------------
Mon Jun 10 08:54:27 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 0.29.0:
* Improved compatibility with RPM 4.20 (alpha version is
currently in Fedora Rawhide).
* Fixed several minor issues such as processing seemingly
commented-out macro definitions (e.g. `#%global prerel rc1`)
and treating `SourceLicense` tag as a source.
* Made `EVR`, `NEVR` and `NEVRA` objects comparable.
* Handling of trailing newlines in the macro defintions has
been improved.
* We have fixed an issue in `%prep` section processing. For
instance, if the `%patches` macro appeared there, it would
have been converted to `%patch es`, causing failure when
executing `%prep` later.
* A trailing newline is no longer added to spec files without
one upon saving.
-------------------------------------------------------------------
Thu Jan 25 08:27:46 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 0.27.0:
* Improved handling of commented-out macro definitions and
fixed related logic in `Specfile.update_value()`.
-------------------------------------------------------------------
Fri Dec 29 10:17:19 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.26.0:
* When accessing tags or macro definitions by name, specfile
now takes validity into account when looking for the best
match. For example if there are two instances of `Version`
tag, one in the true and one in the false branch of a
condition, `Specfile.version` will always access the one that
is in the true branch. (#328)
* Third pre-release for testing Packit support.
-------------------------------------------------------------------
Thu Nov 23 07:47:50 UTC 2023 - David Anes <david.anes@suse.com>
- Update to 0.25.0:
- There is a new method, Specfile.update_version(), that allows
updating spec file version even if it is a pre-release. (#317)
-------------------------------------------------------------------
Wed Nov 8 10:08:44 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Update to 0.24.0:
- Improved type annotations for UserList subclasses. (#299)
- Macro definitions gained a new commented_out property
indicating that a macro definition is commented out. Another
new property, comment_out_style, determines if it is achieved
by using a %dnl (discard next line) directive (e.g. %dnl
%global prerelease beta2) or by replacing the starting % with
# (e.g. #global prerelease beta2). (#298)
- Fix a bad Requires: %{python_module typing_extensions}
-------------------------------------------------------------------
Mon Oct 30 10:14:03 UTC 2023 - David Anes <david.anes@suse.com>
- Update to 0.23.0:
- Sources now have a valid property that indicates whether a
source is valid in the current context, meaning it is not
present in a false branch of any condition.
-------------------------------------------------------------------
Tue Oct 17 07:30:54 UTC 2023 - David Anes <david.anes@suse.com>
- Update to 0.22.1:
- Removed dependency on setuptools-scm-git-archive
-------------------------------------------------------------------
Mon Sep 4 10:43:44 UTC 2023 - Dirk Müller <dmueller@suse.com>
- reduce buildrequires to git-core
-------------------------------------------------------------------
Sun Sep 3 17:13:37 UTC 2023 - Martin Schreiner <martin.schreiner@suse.com>
- Update to 0.22.0:
- Changes from 0.22.0:
* Macro definitions and tags gained a new valid attribute. A macro
definition/tag is considered valid if it doesn't appear in a
false branch of any condition appearing in the spec file.
- Changes from 0.21.0:
* specfile no longer tracebacks when some sources are missing and
can't be emulated. In such case the spec file is parsed without
them at the cost of %setup and %patch macros potentially
expanding differently than with the sources present.
* Specfile's license in RPM spec file is now confirmed to be SPDX
compatible.
- Blacklist a new broken test on spec file: test_parse_texlive_spec.
- Add a new Python module dependency: typing_extensions.
- Apply spec-cleaner.
-------------------------------------------------------------------
Wed Jul 19 04:53:41 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 0.20.0:
* Fixed infinite loop when removing macros with `%` in the name. (#244)
* Added a possibility to undefine system macros by setting a macro value
to `None` in the `macros` argument of the `Specfile` constructor. (#244)
* Fixed a bug in processing options of `%prep` macros. For instance, when
a quoted string appeared inside an expression expansion, it could lead
to improper parsing, rendering the spec file invalid after accessing
the options. (#253)
* Parsing has been optimized so that even spec files with hundreds of
thousands of lines can be processed in reasonable time. (#240)
- Drop setuptools_scm_git_archive BuildRequires.
- Don't need to skip Python 3.8.
-------------------------------------------------------------------
Mon May 29 09:50:26 UTC 2023 - David Anes <david.anes@suse.com>
- Update to version 0.18.0:
* Specfile library now handles multiple %changelog sections. (#230)
-------------------------------------------------------------------
Thu May 11 12:19:01 UTC 2023 - David Anes <david.anes@suse.com>
- Update to version 0.17.0:
* Added a new guess_packager() function that uses similar
heuristics as rpmdev-packager, meaning that the
Specfile.add_changelog_entry() method no longer requires
rpmdev-packager to guess the changelog entry author. (#220)
* The Specfile.add_changelog_entry() method now uses dates based
on UTC instead of the local timezone. (#223)
-------------------------------------------------------------------
Tue Apr 25 07:18:46 UTC 2023 - David Anes <david.anes@suse.com>
- Update to version 0.16.0:
* Added Specfile.has_autorelease property to detect if a spec
file uses the %autorelease macro. (#221)
-------------------------------------------------------------------
Mon Mar 13 12:34:39 UTC 2023 - David Anes <david.anes@suse.com>
- Update to version 0.15.0:
* Parsing the spec file by RPM is now performed only if really
necessary, greatly improving performance in certain scenarios.
(#212)
* Checked that license is a valid SPDX license.
-------------------------------------------------------------------
Sat Feb 25 12:10:44 UTC 2023 - David Anes <david.anes@suse.com>
- Update to version 0.14.0:
* Fixed a bug that broke parsing in case spec file contained
conditionalized macro definitions or similar constructs
* Specfile no longer depends on rpm-py-installer, it now depends
directly on rpm.
-------------------------------------------------------------------
Mon Feb 6 06:32:11 UTC 2023 - David Anes <david.anes@suse.com>
- Update to version 0.13.2:
* Fixed infinite loop that occured when section options were
followed by whitespace.
-------------------------------------------------------------------
Mon Jan 23 15:38:33 UTC 2023 - David Anes <david.anes@suse.com>
- Update to version 0.13.1:
* Fixed a bug in section parsing that caused sections to be
ignored when there were macro definitions spread across the spec
file and not cumulated at the top.
- Update to version 0.13.0:
* Added Section.options attribute for convenient manipulation of
section options.
* specfile now supports single-line sections where section content
is represented by a macro starting with a newline.
* Added evr argument to Specfile.add_changelog_entry(). This
allows adding a changelog entry with an EVR value that's
different from the current specfile's value. This makes it
easier to reconstruct a specfile's %changelog based on another
source using the higher level interface.
-------------------------------------------------------------------
Thu Jan 12 10:27:28 UTC 2023 - David Anes <david.anes@suse.com>
- Remove patch (already upstream):
* python-specfile-improve-setup-cfg.patch
- Update to version 0.12.0:
* All classes including `Specfile` itself can now be copied using
the standard `copy()` and `deepcopy()` functions from `copy`
module.
* `Section.name` attribute has been renamed to a more fitting
`Section.id`.
* `setup.cfg` now uses `license_files` instead of deprecated
`license_file`.
-------------------------------------------------------------------
Tue Dec 13 08:20:36 UTC 2022 - David Anes <david.anes@suse.com>
- Add config.cfg improvements to remove deprecation warnings
* python-specfile-improve-setup-cfg.patch
- Update to version 0.11.1
* Tags enclosed in conditional macro expansions are not ignored
anymore.
* Fixed context managers being shared between Specfile instances.
- Update to version 0.11.0
* Context managers (Specfile.sections(), Specfile.tags() etc.) can
now be nested and combined together (with one exception -
Specfile.macro_definitions()), and it is also possible to use
tag properties (e.g. Specfile.version, Specfile.license) inside
them. It is also possible to access the data directly, avoiding
the with statement, by using the content property
(e.g. Specfile.tags().content), but be aware that no
modifications done to such data will be preserved. You must use
with to make changes.
-------------------------------------------------------------------
Wed Nov 30 17:15:22 UTC 2022 - David Anes <david.anes@suse.com>
- Update to version 0.10.0
* Fixed an issue that caused empty lines originally inside
changelog entries to appear at the end. (#140)
* Renamed the ignore_missing_includes option to a more general
force_parse. If specified, it allows to attempt to parse the
spec file even if one or more sources required to be present at
parsing time are not available. Such sources include sources
referenced from shell expansions in tag values and sources
included using the %include directive. (#137)
-------------------------------------------------------------------
Wed Nov 9 19:02:12 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to version 0.9.0
* Added utility classes for working with (N)EVR. (#113)
* Fixed an issue with multiple instances of Specfile not expanding macros in the right context. (#117)
-------------------------------------------------------------------
Tue Oct 25 09:48:05 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Update to version v0.8.0
* Added Specfile.update_tag() method that allows updating tag values while
trying to preserve macro expansions. You can watch a demo on YouTube.
(#101)
- 0.7.0
* It is now possible to filter changelog entries by specifying lower bound
EVR, upper bound EVR or both. (#104)
* Added support for filenames specified in source URL fragments, for example:
https://example.com/foo/1.0/download.cgi#/%{name}-%{version}.tar.gz (#100)
-------------------------------------------------------------------
Sat Sep 17 04:08:46 UTC 2022 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v0.6.0

70
python-specfile.spec Normal file
View File

@@ -0,0 +1,70 @@
#
# spec file for package python-specfile
#
# Copyright (c) 2025 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-specfile
Version: 0.36.0
Release: 0
Summary: A library for parsing and manipulating RPM spec files
License: MIT
URL: https://github.com/packit/specfile
Source: https://files.pythonhosted.org/packages/source/s/specfile/specfile-%{version}.tar.gz
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-rpm
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module flexmock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module rpm}
BuildRequires: git-core
# /SECTION
%python_subpackages
%description
A library for parsing and manipulating RPM spec files.
%prep
%autosetup -p1 -n specfile-%{version}
# we use our own package for "rpm" module (see Requires)
sed -i '/rpm-py-installer/d' setup.cfg
%build
%pyproject_wheel
%check
# Following tests fail:
# * test_update_tag
# * test_macros_reinit
%pytest -k "not (test_update_tag or test_macros_reinit or test_parse_texlive_spec)"
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%files %{python_files}
%doc CHANGELOG.md README.md
%license LICENSE
%{python_sitelib}/specfile
%{python_sitelib}/specfile-%{version}*-info
%changelog

3
specfile-0.31.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:405cab9e9caafac4364f9a4c03b5beaf47b73edcd3749b66760d89eb03c2efc1
size 105187

3
specfile-0.32.1.tar.gz Normal file
View File

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

3
specfile-0.32.2.tar.gz Normal file
View File

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

3
specfile-0.32.3.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:47d8965c8dff97f243511f3a8c9729071b83c77339f44301de3479bdbdfd6f5f
size 107070

3
specfile-0.32.4.tar.gz Normal file
View File

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

3
specfile-0.32.5.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84d99782af4861ae83e0b5599b92a6f6a48958dafc64f5e5afeed994aa638493
size 107100

3
specfile-0.32.6.tar.gz Normal file
View File

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

3
specfile-0.34.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7950b42dbbb3c9d294e2aeaf9d4c8e853d66c7fad21ec92611c2126ba4dd6e62
size 109985

3
specfile-0.34.1.tar.gz Normal file
View File

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

3
specfile-0.34.2.tar.gz Normal file
View File

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

3
specfile-0.35.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:403f631d13228e36c7e95eac66fc4887ad738d2b47e46626d75ca3b87ab42bd8
size 112729

3
specfile-0.35.1.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:742e1d6900c14b30d9269e7fd5dae48ffb0b8d467a4a101744785651b352d401
size 113004

3
specfile-0.36.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:006b35d7a0fa1a57cccc221e1625ee31a8b64dbaad29a85e898820b9502d1238
size 113284