Merged
同步master分支,修复合并冲突 #60
wangkui35Add on Nov 4, 2025
同步master分支,修复合并冲突 #60
Merged
wangkui35Add on Nov 4, 2025
Merged fromrefs/pull/60/headintoopenEuler-24.03-LTS-SP3
Total: 6 files changed+69-352
@@ -0,0 +1,45 @@
1+From 06a246f1fbd79d70951488d65d5fe6bfa4afd4ef Mon Sep 17 00:00:00 2001
2+From: Lumir Balhar <lbalhar@redhat.com>
3+Date: Thu, 13 Mar 2025 11:52:42 +0100
4+Subject: [PATCH] Revert "Always rewrite a Python shebang to #!python."
5+ 
6+This reverts commit c71266345c64fd662b5f95bbbc6e4536172f496d.
7+---
8+ setuptools/_distutils/command/build_scripts.py | 13 ++++++++++++-
9+ 1 file changed, 12 insertions(+), 1 deletion(-)
10+ 
11+diff --git a/setuptools/_distutils/command/build_scripts.py b/setuptools/_distutils/command/build_scripts.py
12+index 127c51d8d..05ba2c93c 100644
13+--- a/setuptools/_distutils/command/build_scripts.py
14++++ b/setuptools/_distutils/command/build_scripts.py
15+@@ -5,6 +5,7 @@ Implements the Distutils 'build_scripts' command."""
16+ import os
17+ import re
18+ import tokenize
19++from distutils import sysconfig
20+ from distutils._log import log
21+ from stat import ST_MODE
22+ from typing import ClassVar
23+@@ -105,8 +106,18 @@ class build_scripts(Command):
24+ if shebang_match:
25+ log.info("copying and adjusting %s -> %s", script, self.build_dir)
26+ if not self.dry_run:
27++ if not sysconfig.python_build:
28++ executable = self.executable
29++ else:
30++ executable = os.path.join(
31++ sysconfig.get_config_var("BINDIR"),
32++ "python{}{}".format(
33++ sysconfig.get_config_var("VERSION"),
34++ sysconfig.get_config_var("EXE"),
35++ ),
36++ )
37+ post_interp = shebang_match.group(1) or ''
38+- shebang = f"#!python{post_interp}\n"
39++ shebang = "#!" + executable + post_interp + "\n"
40+ self._validate_shebang(shebang, f.encoding)
41+ with open(outfile, "w", encoding=f.encoding) as outf:
42+ outf.write(shebang)
43+--
44+2.48.1
45+ 
@@ -1,317 +0,0 @@
1-From 88807c7062788254f654ea8c03427adc859321f0 Mon Sep 17 00:00:00 2001
2-From: jaraco <jaraco@fosstodon.org>
3-Date: Tue, 30 Apr 2024 15:02:00 +0800
4-Subject: [PATCH] Modernize package_index VCS handling
5-https://github.com/pypa/setuptools/commit/88807c7062788254f654ea8c03427adc859321f0
6-https://github.com/pypa/setuptools/pull/4332
7- 
8----
9- changelog.d/4332.feature.rst | 1 +
10- setup.cfg | 1 +
11- setuptools/package_index.py | 146 ++++++++++++++------------
12- setuptools/tests/test_packageindex.py | 56 +++++-----
13- 4 files changed, 108 insertions(+), 96 deletions(-)
14- create mode 100644 changelog.d/4332.feature.rst
15- 
16-diff --git a/changelog.d/4332.feature.rst b/changelog.d/4332.feature.rst
17-new file mode 100644
18-index 0000000..1e612ec
19---- /dev/null
20-+++ b/changelog.d/4332.feature.rst
21-@@ -0,0 +1 @@
22-+Modernized and refactored VCS handling in package_index.
23-diff --git a/setup.cfg b/setup.cfg
24-index c1d8a69..6787594 100644
25---- a/setup.cfg
26-+++ b/setup.cfg
27-@@ -63,6 +63,7 @@ testing =
28- tomli-w>=1.0.0
29- pytest-timeout
30- pytest-perf
31-+ pytest-subprocess
32- testing-integration =
33- pytest
34- pytest-xdist
35-diff --git a/setuptools/package_index.py b/setuptools/package_index.py
36-index 3130ace..ae50db5 100644
37---- a/setuptools/package_index.py
38-+++ b/setuptools/package_index.py
39-@@ -1,6 +1,7 @@
40- """PyPI and direct package downloading."""
41-
42- import sys
43-+import subprocess
44- import os
45- import re
46- import io
47-@@ -586,7 +587,7 @@ class PackageIndex(Environment):
48- scheme = URL_SCHEME(spec)
49- if scheme:
50- # It's a url, download it to tmpdir
51-- found = self._download_url(scheme.group(1), spec, tmpdir)
52-+ found = self._download_url(spec, tmpdir)
53- base, fragment = egg_info_for_url(spec)
54- if base.endswith('.py'):
55- found = self.gen_setup(found, fragment, tmpdir)
56-@@ -813,7 +814,7 @@ class PackageIndex(Environment):
57- else:
58- raise DistutilsError("Download error for %s: %s" % (url, v)) from v
59-
60-- def _download_url(self, scheme, url, tmpdir):
61-+ def _download_url(self, url, tmpdir):
62- # Determine download filename
63- #
64- name, fragment = egg_info_for_url(url)
65-@@ -828,19 +829,60 @@ class PackageIndex(Environment):
66-
67- filename = os.path.join(tmpdir, name)
68-
69-- # Download the file
70-- #
71-- if scheme == 'svn' or scheme.startswith('svn+'):
72-- return self._download_svn(url, filename)
73-- elif scheme == 'git' or scheme.startswith('git+'):
74-- return self._download_git(url, filename)
75-- elif scheme.startswith('hg+'):
76-- return self._download_hg(url, filename)
77-- elif scheme == 'file':
78-- return urllib.request.url2pathname(urllib.parse.urlparse(url)[2])
79-- else:
80-- self.url_ok(url, True) # raises error if not allowed
81-- return self._attempt_download(url, filename)
82-+ return self._download_vcs(url, filename) or self._download_other(url, filename)
83-+
84-+
85-+ @staticmethod
86-+ def _resolve_vcs(url):
87-+ """
88-+ >>> rvcs = PackageIndex._resolve_vcs
89-+ >>> rvcs('git+http://foo/bar')
90-+ 'git'
91-+ >>> rvcs('hg+https://foo/bar')
92-+ 'hg'
93-+ >>> rvcs('git:myhost')
94-+ 'git'
95-+ >>> rvcs('hg:myhost')
96-+ >>> rvcs('http://foo/bar')
97-+ """
98-+ scheme = urllib.parse.urlsplit(url).scheme
99-+ pre, sep, post = scheme.partition('+')
100-+ # svn and git have their own protocol; hg does not
101-+ allowed = set(['svn', 'git'] + ['hg'] * bool(sep))
102-+ return next(iter({pre} & allowed), None)
103-+
104-+ def _download_vcs(self, url, spec_filename):
105-+ vcs = self._resolve_vcs(url)
106-+ if not vcs:
107-+ return
108-+ if vcs == 'svn':
109-+ raise DistutilsError(
110-+ f"Invalid config, SVN download is not supported: {url}"
111-+ )
112-+
113-+ filename, _, _ = spec_filename.partition('#')
114-+ url, rev = self._vcs_split_rev_from_url(url)
115-+
116-+ self.info(f"Doing {vcs} clone from {url} to {filename}")
117-+ subprocess.check_call([vcs, 'clone', '--quiet', url, filename])
118-+
119-+ co_commands = dict(
120-+ git=[vcs, '-C', filename, 'checkout', '--quiet', rev],
121-+ hg=[vcs, '--cwd', filename, 'up', '-C', '-r', rev, '-q'],
122-+ )
123-+ if rev is not None:
124-+ self.info(f"Checking out {rev}")
125-+ subprocess.check_call(co_commands[vcs])
126-+
127-+ return filename
128-+
129-+ def _download_other(self, url, filename):
130-+ scheme = urllib.parse.urlsplit(url).scheme
131-+ if scheme == 'file': # pragma: no cover
132-+ return urllib.request.url2pathname(urllib.parse.urlparse(url).path)
133-+ # raise error if not allowed
134-+ self.url_ok(url, True)
135-+ return self._attempt_download(url, filename)
136-
137- def scan_url(self, url):
138- self.process_url(url, True)
139-@@ -856,64 +898,36 @@ class PackageIndex(Environment):
140- os.unlink(filename)
141- raise DistutilsError(f"Unexpected HTML page found at {url}")
142-
143-- def _download_svn(self, url, _filename):
144-- raise DistutilsError(f"Invalid config, SVN download is not supported: {url}")
145--
146- @staticmethod
147-- def _vcs_split_rev_from_url(url, pop_prefix=False):
148-- scheme, netloc, path, query, frag = urllib.parse.urlsplit(url)
149-+ def _vcs_split_rev_from_url(url):
150-+ """
151-+ Given a possible VCS URL, return a clean URL and resolved revision if any.
152-+ >>> vsrfu = PackageIndex._vcs_split_rev_from_url
153-+ >>> vsrfu('git+https://github.com/pypa/setuptools@v69.0.0#egg-info=setuptools')
154-+ ('https://github.com/pypa/setuptools', 'v69.0.0')
155-+ >>> vsrfu('git+https://github.com/pypa/setuptools#egg-info=setuptools')
156-+ ('https://github.com/pypa/setuptools', None)
157-+ >>> vsrfu('http://foo/bar')
158-+ ('http://foo/bar', None)
159-+ """
160-+ parts = urllib.parse.urlsplit(url)
161-
162-- scheme = scheme.split('+', 1)[-1]
163-+ clean_scheme = parts.scheme.split('+', 1)[-1]
164-
165- # Some fragment identification fails
166-- path = path.split('#', 1)[0]
167--
168-- rev = None
169-- if '@' in path:
170-- path, rev = path.rsplit('@', 1)
171--
172-- # Also, discard fragment
173-- url = urllib.parse.urlunsplit((scheme, netloc, path, query, ''))
174-+ no_fragment_path, _, _ = parts.path.partition('#')
175-
176-- return url, rev
177-+ pre, sep, post = no_fragment_path.rpartition('@')
178-+ clean_path, rev = (pre, post) if sep else (post, None)
179-
180-- def _download_git(self, url, filename):
181-- filename = filename.split('#', 1)[0]
182-- url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True)
183--
184-- self.info("Doing git clone from %s to %s", url, filename)
185-- os.system("git clone --quiet %s %s" % (url, filename))
186--
187-- if rev is not None:
188-- self.info("Checking out %s", rev)
189-- os.system(
190-- "git -C %s checkout --quiet %s"
191-- % (
192-- filename,
193-- rev,
194-- )
195-- )
196-+ resolved = parts._replace(
197-+ scheme=clean_scheme,
198-+ path=clean_path,
199-+ # discard the fragment
200-+ fragment='',
201-+ ).geturl()
202-
203-- return filename
204--
205-- def _download_hg(self, url, filename):
206-- filename = filename.split('#', 1)[0]
207-- url, rev = self._vcs_split_rev_from_url(url, pop_prefix=True)
208--
209-- self.info("Doing hg clone from %s to %s", url, filename)
210-- os.system("hg clone --quiet %s %s" % (url, filename))
211--
212-- if rev is not None:
213-- self.info("Updating to %s", rev)
214-- os.system(
215-- "hg --cwd %s up -C -r %s -q"
216-- % (
217-- filename,
218-- rev,
219-- )
220-- )
221--
222-- return filename
223-+ return resolved, rev
224-
225- def debug(self, msg, *args):
226- log.debug(msg, *args)
227-diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
228-index f1fa745..a7d2b5d 100644
229---- a/setuptools/tests/test_packageindex.py
230-+++ b/setuptools/tests/test_packageindex.py
231-@@ -5,7 +5,6 @@ import platform
232- import urllib.request
233- import urllib.error
234- import http.client
235--from unittest import mock
236-
237- import pytest
238-
239-@@ -186,49 +185,46 @@ class TestPackageIndex:
240- assert dists[0].version == ''
241- assert dists[1].version == vc
242-
243-- def test_download_git_with_rev(self, tmpdir):
244-+ def test_download_git_with_rev(self, tmp_path, fp):
245- url = 'git+https://github.example/group/project@master#egg=foo'
246- index = setuptools.package_index.PackageIndex()
247-
248-- with mock.patch("os.system") as os_system_mock:
249-- result = index.download(url, str(tmpdir))
250-+ expected_dir = tmp_path / 'project@master'
251-+ fp.register([
252-+ 'git',
253-+ 'clone',
254-+ '--quiet',
255-+ 'https://github.example/group/project',
256-+ expected_dir,
257-+ ])
258-+ fp.register(['git', '-C', expected_dir, 'checkout', '--quiet', 'master'])
259-
260-- os_system_mock.assert_called()
261-+ result = index.download(url, tmp_path)
262-
263-- expected_dir = str(tmpdir / 'project@master')
264-- expected = (
265-- 'git clone --quiet ' 'https://github.example/group/project {expected_dir}'
266-- ).format(**locals())
267-- first_call_args = os_system_mock.call_args_list[0][0]
268-- assert first_call_args == (expected,)
269-+ assert result == str(expected_dir)
270-+ assert len(fp.calls) == 2
271-
272-- tmpl = 'git -C {expected_dir} checkout --quiet master'
273-- expected = tmpl.format(**locals())
274-- assert os_system_mock.call_args_list[1][0] == (expected,)
275-- assert result == expected_dir
276--
277-- def test_download_git_no_rev(self, tmpdir):
278-+ def test_download_git_no_rev(self, tmp_path, fp):
279- url = 'git+https://github.example/group/project#egg=foo'
280- index = setuptools.package_index.PackageIndex()
281-
282-- with mock.patch("os.system") as os_system_mock:
283-- result = index.download(url, str(tmpdir))
284--
285-- os_system_mock.assert_called()
286--
287-- expected_dir = str(tmpdir / 'project')
288-- expected = (
289-- 'git clone --quiet ' 'https://github.example/group/project {expected_dir}'
290-- ).format(**locals())
291-- os_system_mock.assert_called_once_with(expected)
292--
293-- def test_download_svn(self, tmpdir):
294-+ expected_dir = tmp_path / 'project'
295-+ fp.register([
296-+ 'git',
297-+ 'clone',
298-+ '--quiet',
299-+ 'https://github.example/group/project',
300-+ expected_dir,
301-+ ])
302-+ index.download(url, tmp_path)
303-+
304-+ def test_download_svn(self, tmp_path):
305- url = 'svn+https://svn.example/project#egg=foo'
306- index = setuptools.package_index.PackageIndex()
307-
308- msg = r".*SVN download is not supported.*"
309- with pytest.raises(distutils.errors.DistutilsError, match=msg):
310-- index.download(url, str(tmpdir))
311-+ index.download(url, tmp_path)
312-
313-
314- class TestContentCheckers:
315---
316-2.33.0
317- 
@@ -1,25 +0,0 @@
1-From 99ba862948c27f8851ae2131ff36daee0195ae4a Mon Sep 17 00:00:00 2001
2-From: chengzihan2 <chengzihan1111@163.com>
3-Date: Thu, 4 Jun 2020 17:29:07 +0800
4-Subject: [PATCH] bugfix eliminate random order in metadata
5- 
6----
7- setuptools/dist.py | 2 +-
8- 1 file changed, 1 insertion(+), 1 deletion(-)
9- 
10-diff --git a/setuptools/dist.py b/setuptools/dist.py
11-index fb16886..86a5402 100644
12---- a/setuptools/dist.py
13-+++ b/setuptools/dist.py
14-@@ -208,7 +208,7 @@ def write_pkg_file(self, file): # noqa: C901 # is too complex (14) # FIXME
15- if self.long_description_content_type:
16- write_field('Description-Content-Type', self.long_description_content_type)
17- if self.provides_extras:
18-- for extra in self.provides_extras:
19-+ for extra in sorted(self.provides_extras):
20- write_field('Provides-Extra', extra)
21-
22- self._write_list(file, 'License-File', self.license_files or [])
23---
24-1.8.3.1
25- 
@@ -7,16 +7,14 @@
7%global python_whlname setuptools-%{version}-py3-none-any.whl7%global python_whlname setuptools-%{version}-py3-none-any.whl
8 8 
9Name: python-setuptools9Name: python-setuptools
10-Version: 68.0.010+Version: 78.1.1
11-Release: 211+Release: 4
12Summary: Easily build and distribute Python packages12Summary: Easily build and distribute Python packages
13 13 
14-License: MIT and (BSD or ASL 2.0)14+License: MIT AND Apache-2.0 AND (BSD-2-Clause OR Apache-2.0) AND Python-2.0 AND LGPL-3.0-only
15URL: https://pypi.python.org/pypi/setuptools15URL: https://pypi.python.org/pypi/setuptools
16Source0: %{pypi_source setuptools %{version}}16Source0: %{pypi_source setuptools %{version}}
17- 17+Patch1: Revert-Always-rewrite-a-Python-shebang-to-python.patch
18-Patch9000: bugfix-eliminate-random-order-in-metadata.patch
19-Patch9001: backport-CVE-2024-6345.patch
20 18 
21BuildArch: noarch19BuildArch: noarch
22 20 
@@ -31,7 +29,6 @@ BuildRequires: python3-pip, python3-wheel
31%endif29%endif
32 30 
33Provides: python-distribute = %{version}-%{release}, %{name}-wheel31Provides: python-distribute = %{version}-%{release}, %{name}-wheel
34-Obsoletes: python-distribute < 0.6.36-2, %{name}-wheel
35 32 
36%description33%description
37Setuptools is a collection of enhancements to the Python distutils that allow34Setuptools is a collection of enhancements to the Python distutils that allow
@@ -45,6 +42,7 @@ Summary: Easily build and distribute Python 3 packages
45Conflicts: python-setuptools < %{version}-%{release}42Conflicts: python-setuptools < %{version}-%{release}
46Provides: python%{python3_pkgversion}dist(setuptools) = %{version}43Provides: python%{python3_pkgversion}dist(setuptools) = %{version}
47Provides: python%{python3_version}dist(setuptools) = %{version}44Provides: python%{python3_version}dist(setuptools) = %{version}
45+Requires: (gobject-introspection-devel >= 1.81.2 if gobject-introspection-devel)
48 46 
49%description -n python3-setuptools47%description -n python3-setuptools
50Setuptools is a collection of enhancements to the Python 3 distutils that allow48Setuptools is a collection of enhancements to the Python 3 distutils that allow
@@ -61,8 +59,6 @@ execute the software that requires pkg_resources.py.
61 59 
62find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}'60find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}'
63rm -f setuptools/*.exe61rm -f setuptools/*.exe
64-rm setuptools/tests/test_integration.py
65-chmod -x README.rst
66 62 
67%build63%build
68%if %{without bootstrap}64%if %{without bootstrap}
@@ -108,10 +104,28 @@ PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore=
108 104 
109%files help105%files help
110%defattr(-,root,root)106%defattr(-,root,root)
111-%doc docs/* CHANGES.rst README.rst107+%doc docs/* README.rst
112 108 
113 109 
114%changelog110%changelog
111+* Thu Aug 28 2025 fuanan <fuanan3@h-partners.com> - 78.1.1-4
112+- update License
113+ 
114+* Thu Jul 03 2025 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 78.1.1-3
115+- Revert Always rewrite a Python shebang to python
116+ 
117+* Tue Jun 10 2025 Funda Wang <fundawang@yeah.net> - 78.1.1-2
118+- force gobject-introspection version for upgrade
119+ 
120+* Thu May 29 2025 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 78.1.1-1
121+- Update package to version 78.1.1
122+ 
123+* Wed May 28 2025 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 69.5.0-1
124+- Update package to version 69.5.0
125+ 
126+* Mon Aug 26 2024 dillon chen <dillon.chen@gmail.com> - 69.2.0-1
127+- back package to version 69.2.0
128+ 
115* Mon Jul 15 2024 zhangxianting <zhangxianting@uniontech> - 68.0.0-2129* Mon Jul 15 2024 zhangxianting <zhangxianting@uniontech> - 68.0.0-2
116- Fix CVE-2024-6345130- Fix CVE-2024-6345
117 131 
Binary files do not support preview
Binary files do not support preview