3
0

Accepting request 1046000 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1046000
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-packaging?expand=0&rev=26
This commit is contained in:
Dominique Leuenberger 2023-01-03 14:04:13 +00:00 committed by Git OBS Bridge
commit cc5cbc0726
5 changed files with 116 additions and 95 deletions

View File

@ -1,57 +0,0 @@
From efb42e3a40c4e1ea043902b0ac989af9af5dedbb Mon Sep 17 00:00:00 2001
From: Tzu-ping Chung <uranusjr@gmail.com>
Date: Wed, 20 Apr 2022 10:00:07 +0800
Subject: [PATCH] Correctly parse ELF for musllinux on Big Endian
Always use LSB to parse binary in tests
---
packaging/_musllinux.py | 8 +++++---
tests/test_musllinux.py | 9 +++++----
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/packaging/_musllinux.py b/packaging/_musllinux.py
index 8ac3059..d5d3e04 100644
--- a/packaging/_musllinux.py
+++ b/packaging/_musllinux.py
@@ -39,9 +39,11 @@ def _parse_ld_musl_from_elf(f: IO[bytes]) -> Optional[str]:
# p_fmt: Format for section header.
# p_idx: Indexes to find p_type, p_offset, and p_filesz.
e_fmt, p_fmt, p_idx = {
- 1: ("IIIIHHH", "IIIIIIII", (0, 1, 4)), # 32-bit.
- 2: ("QQQIHHH", "IIQQQQQQ", (0, 2, 5)), # 64-bit.
- }[ident[4]]
+ (1, 1): ("<IIIIHHH", "<IIIIIIII", (0, 1, 4)), # 32-bit LSB.
+ (1, 2): (">IIIIHHH", ">IIIIIIII", (0, 1, 4)), # 32-bit MSB.
+ (2, 1): ("<QQQIHHH", "<IIQQQQQQ", (0, 2, 5)), # 64-bit LSB.
+ (2, 2): (">QQQIHHH", ">IIQQQQQQ", (0, 2, 5)), # 64-bit MSB.
+ }[(ident[4], ident[5])]
except KeyError:
return None
else:
diff --git a/tests/test_musllinux.py b/tests/test_musllinux.py
index d2c87ca..2623bdb 100644
--- a/tests/test_musllinux.py
+++ b/tests/test_musllinux.py
@@ -101,14 +101,15 @@ def test_parse_ld_musl_from_elf_no_interpreter_section():
with BIN_MUSL_X86_64.open("rb") as f:
data = f.read()
- # Change all sections to *not* PT_INTERP.
- unpacked = struct.unpack("16BHHIQQQIHHH", data[:58])
+ # Change all sections to *not* PT_INTERP. We are explicitly using LSB rules
+ # because the binaries are in LSB.
+ unpacked = struct.unpack("<16BHHIQQQIHHH", data[:58])
*_, e_phoff, _, _, _, e_phentsize, e_phnum = unpacked
for i in range(e_phnum + 1):
sb = e_phoff + e_phentsize * i
se = sb + 56
- section = struct.unpack("IIQQQQQQ", data[sb:se])
- data = data[:sb] + struct.pack("IIQQQQQQ", 0, *section[1:]) + data[se:]
+ section = struct.unpack("<IIQQQQQQ", data[sb:se])
+ data = data[:sb] + struct.pack("<IIQQQQQQ", 0, *section[1:]) + data[se:]
assert _parse_ld_musl_from_elf(io.BytesIO(data)) is None
--
2.36.1

View File

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

3
packaging-22.0.tar.gz Normal file
View File

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

View File

@ -1,3 +1,89 @@
-------------------------------------------------------------------
Fri Dec 30 10:16:41 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to v22.0
* Fix compatible version specifier incorrectly strip trailing '0'
by @kasium in #493
* Remove support for Python 3.6 by @abravalheri in #500
* Use concurrency limit in ci by @blink1073 in #510
* Fix issue link in changelog. by @bdice in #509
* chore: test with PyPy 3.8 & 3.9 by @mayeut in #512
* Accept locally installed prereleases by @q0w in #515
* Always run GHA workflows when they change by @mayeut in #516
* Add __hash__/__eq__ to requirements by @abravalheri in #499
* Upgrade to setup-python v3 and use caching for GHA by
@brettcannon in #521
* allow pre-release versions in marker evaluation by @graingert
in #523
* Error out from workflow on missing interpreter by @mayeut in
#525
* chore: update pre-commit config to the latest repos' versions
by @mayeut in #534
* chore: remove Windows PyPy 3.9 workaround on GHA by @mayeut in
#533
* Use pipx to run nox / build in GHA workflows by @mayeut in #517
* Run tests with all PyPy versions locally by @mayeut in #535
* Adhere to PEP 685 when evaluating markers with extras by
@hroncok in #545
* chore: update mypy and move to toml by @henryiii in #547
* Normalize extra comparison in markers for output by
@brettcannon in #549
* Evaluate markers under environment with empty "extra" by
@MrMino in #550
* Do not set extra in default_environment() by @sbidoul in #554
* Update extlinks strings to use a format string by @mayeut in
#555
* Update CI test workflow to use setup-python@v4 by @mayeut in
#556
* CI: Update actions/* to their latest major versions by @mayeut
in #557
* Fix a spelling mistake by @venthur in #558
* fix: macOS platform tags with old macOS SDK by @mayeut in #513
* Correctly parse ELF for musllinux on Big Endian by @uranusjr in
#538
* A metadata module with a data class for core metadata by
@brettcannon in #518
* Document utils.NormalizedName by @brettcannon in #565
* Drop LegacySpecifier and LegacyVersion by @pradyunsg in #407
* Move metadata, versions and specifiers API documentation to
sphinx.ext.autodoc by @pradyunsg in #572
* Demonstrate behaviour of SpecifierSet.__iter__ by @hauntsaninja
in #575
* Handwritten parser for parsing requirements by @hrnciar in #484
* Add changelog entry for removal of pyparsing dependency by
@hroncok in #581
* Use Iterator instead of Iterable for specifier filter methods
by @ichard26 in #584
* Better output on linter failure by @henryiii in #478
* Add a "cpNNN-none-any" tag by @joonis in #541
* Document exceptions raised by functions in utils by @MrMino in
#544
* Refactor ELF parsing logic to standlone class by @uranusjr in
#553
* Forbid prefix version matching on pre-release/post-release
segments by @mayeut in #563
* Update coverage to >=5.0.0 by @mayeut in #586
* Normalize specifier version for prefix matching by @mayeut in
#561
* Add python 3.11 by @mayeut in #587
* Fix prefix version matching by @mayeut in #564
* Remove duplicate namedtuple by @layday in #589
* Update changelog by @pradyunsg in #595
* Change email-related fields in Metadata to str by @brettcannon
in #596
* Add versionchanged for 21.3 by @brettcannon in #599
* refactor: use flit as a backend by @henryiii in #546
* Remove packaging.metadata by @pradyunsg in #603
* Refactor nox requirements to use requirements files (#601) by
@strokirk in #609
* Improve Requirement/Marker parser with context-sensitive
tokenisation by @pradyunsg in #624
- The new usage of the flit-core backend simplifies the bootstrap
- Remove old-distro shims: This one requires Python 3.7+, thus
all non-Tumbleweed backports or future distros must provide the
primary_python macro and similar themselves.
- Drop fix-big-endian-build.patch upstreamed gh#pypa/packaging#538
-------------------------------------------------------------------
Mon Aug 1 07:44:59 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@ -17,13 +17,11 @@
%define modname packaging
# fallback if primary_python is not available from the project configuration
%{?!primary_python:%define primary_python python3%{?!sle_version:10}}
# in order to avoid rewriting for subpackage generator
%define mypython python
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "primary"
# this one is goes into Ring0
# this one is goes into Ring0: Bootstrap for primary python stack
%define pprefix %{primary_python}
%define pythons %{primary_python}
# Avoid cycle with python-rpm-packaging requiring python3-packaging
@ -32,14 +30,8 @@
%if "%{flavor}" == ""
# The rest is in Ring1
%define pprefix python
%if 0%{suse_version} >= 1550 || 0%{?sle_version} == 150500
%{expand:%%define skip_%{primary_python} 1}
BuildRequires: python3-packaging
%else
# no non-primary python in <=15.4
ExclusiveArch: do-not-build
%define python_module() no-build-without-multibuild-flavor
%endif
%endif
%if "%{flavor}" == "test"
%define pprefix python
@ -48,29 +40,26 @@ ExclusiveArch: do-not-build
%else
%bcond_with test
%endif
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: %{pprefix}-packaging%{?psuffix}
Version: 21.3
Version: 22.0
Release: 0
Summary: Core utilities for Python packages
License: Apache-2.0 AND BSD-2-Clause
URL: https://github.com/pypa/packaging
URL: https://packaging.pypa.io/
#SourceRepository: https://github.com/pypa/packaging
Source: https://files.pythonhosted.org/packages/source/p/packaging/packaging-%{version}.tar.gz
# Fix testsuite on big-endian systems
# see: https://github.com/pypa/packaging/pull/538
Patch2: fix-big-endian-build.patch
BuildRequires: %{python_module base >= 3.6}
BuildRequires: %{python_module base >= 3.7}
# python-flit-core is bootstrapped in Ring0 as well
BuildRequires: %{python_module flit-core >= 3.3}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
#!BuildIgnore: post-build-checks-malwarescan
# ! Do not add setuptools build dependency here, so that the primary package can be in Ring0 !
# ! Also make sure all runtime dependencies don't require setuptools. !
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module packaging = %{version}}
BuildRequires: %{python_module pretend}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pytest >= 6.2}
%endif
%if "%{flavor}" == "primary"
# See boo#1186870, we can't provide ourselves to pythondistdeps.py
@ -78,35 +67,38 @@ Provides: %{mypython}%{python_version}dist(%{modname}) = %{version}-%{rele
Provides: %{mypython}3-%{modname} = %{version}-%{release}
Provides: %{mypython}3dist(%{modname}) = %{version}-%{release}
Obsoletes: %{mypython}3-%{modname} < %{version}-%{release}
Requires: %{primary_python}-pyparsing >= 2.0.2
Requires: %{mypython}(abi) = %{python_version}
%else
Requires: python-pyparsing >= 2.0.2
%endif
%python_subpackages
%description
Core utilities for Python packages
Reusable core utilities for various Python Packaging interoperability specifications.
This library provides utilities that implement the interoperability specifications
which have clearly one correct behaviour (eg: PEP 440) or benefit greatly from having
a single shared implementation (eg: PEP 425).
%prep
%autosetup -p1 -n packaging-%{version}
%if !%{with test}
%build
%{python_expand # build using pythonXX-base bundled setuptools
$python -m venv venv-%{$python_bin_suffix}
venv-%{$python_bin_suffix}/bin/python setup.py build
%{python_expand # build using pythonXX-base bundled pip with the installed flit-core backend
$python -m venv venv-%{$python_bin_suffix} --system-site-packages
venv-%{$python_bin_suffix}/bin/pip wheel %{pyproject_wheel_args} .
}
%endif
%if !%{with test}
%install
%{python_expand # install using pythonXX-base bundled setuptools.
# This will work until deprecated support of setup.py install is removed from the bundled setuptools.
# Hopefully upstream packaging comes up with a better bootstrapping process by then.
# (https://github.com/pypa/packaging/pull/536, https://github.com/pypa/packaging/pull/546)
venv-%{$python_bin_suffix}/bin/python setup.py install \
-O1 --skip-build --force --root %{buildroot} --prefix %{_prefix}
%{python_expand # install wheel (into venv sitelib) and move to buildroot system sitelib
venv-%{$python_bin_suffix}/bin/pip install %{pyproject_install_args} packaging==%{version}
venvsite=%{buildroot}${PWD}/venv-%{$python_bin_suffix}/lib/python%{$python_bin_suffix}/site-packages
mkdir -p %{buildroot}%{$python_sitelib}
mv ${venvsite}/packaging* %{buildroot}%{$python_sitelib}/
pushd %{buildroot}
rmdir -p $(realpath --relative-to ${PWD} ${venvsite})
popd
%fdupes %{buildroot}%{$python_sitelib}
}
%endif
@ -119,9 +111,9 @@ venv-%{$python_bin_suffix}/bin/python setup.py install \
%if !%{with test}
%files %{python_files}
%license LICENSE LICENSE.APACHE LICENSE.BSD
%doc CHANGELOG.rst README.rst
%doc README.rst
%{python_sitelib}/packaging
%{python_sitelib}/packaging-%{version}*-info
%{python_sitelib}/packaging-%{version}.dist-info
%endif
%changelog