From 14c194c8856dfe54bfb25a75bda3f155132b6efd3ce4d4708b53791116c33747 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Mon, 29 Nov 2021 16:33:18 +0000 Subject: [PATCH] - Remove shebangs from from python-base libraries in _libdir (bsc#1193179). - Readjust patches: - bpo-31046_ensurepip_honours_prefix.patch - decimal.patch - python-3.3.0b1-fix_date_time_compiler.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python39?expand=0&rev=91 --- bpo-31046_ensurepip_honours_prefix.patch | 12 ++++++------ decimal.patch | 2 +- python-3.3.0b1-fix_date_time_compiler.patch | 2 +- python39.changes | 8 ++++++-- python39.spec | 10 ++++++++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/bpo-31046_ensurepip_honours_prefix.patch b/bpo-31046_ensurepip_honours_prefix.patch index 72eef97..f270184 100644 --- a/bpo-31046_ensurepip_honours_prefix.patch +++ b/bpo-31046_ensurepip_honours_prefix.patch @@ -55,7 +55,7 @@ Co-Authored-By: Xavier de Gaye .. note:: --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py -@@ -56,27 +56,27 @@ def _disable_pip_configuration_settings( +@@ -52,27 +52,27 @@ def _disable_pip_configuration_settings( os.environ['PIP_CONFIG_FILE'] = os.devnull @@ -88,7 +88,7 @@ Co-Authored-By: Xavier de Gaye Note that calling this function will alter both sys.path and os.environ. """ -@@ -119,6 +119,8 @@ def _bootstrap(*, root=None, upgrade=Fal +@@ -115,6 +115,8 @@ def _bootstrap(*, root=None, upgrade=Fal args = ["install", "--no-cache-dir", "--no-index", "--find-links", tmpdir] if root: args += ["--root", root] @@ -97,7 +97,7 @@ Co-Authored-By: Xavier de Gaye if upgrade: args += ["--upgrade"] if user: -@@ -191,6 +193,11 @@ def _main(argv=None): +@@ -187,6 +189,11 @@ def _main(argv=None): help="Install everything relative to this alternate root directory.", ) parser.add_argument( @@ -109,7 +109,7 @@ Co-Authored-By: Xavier de Gaye "--altinstall", action="store_true", default=False, -@@ -209,6 +216,7 @@ def _main(argv=None): +@@ -205,6 +212,7 @@ def _main(argv=None): return _bootstrap( root=args.root, @@ -139,7 +139,7 @@ Co-Authored-By: Xavier de Gaye --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1263,7 +1263,7 @@ install: @FRAMEWORKINSTALLFIRST@ commoni +@@ -1262,7 +1262,7 @@ install: @FRAMEWORKINSTALLFIRST@ commoni install|*) ensurepip="" ;; \ esac; \ $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ @@ -148,7 +148,7 @@ Co-Authored-By: Xavier de Gaye fi altinstall: commoninstall -@@ -1273,7 +1273,7 @@ altinstall: commoninstall +@@ -1272,7 +1272,7 @@ altinstall: commoninstall install|*) ensurepip="--altinstall" ;; \ esac; \ $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ diff --git a/decimal.patch b/decimal.patch index 0bc3bfc..0a7f154 100644 --- a/decimal.patch +++ b/decimal.patch @@ -25,7 +25,7 @@ if (sep == NULL) { --- a/setup.py +++ b/setup.py -@@ -2201,7 +2201,7 @@ class PyBuildExt(build_ext): +@@ -2203,7 +2203,7 @@ class PyBuildExt(build_ext): undef_macros = [] if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"): include_dirs = [] diff --git a/python-3.3.0b1-fix_date_time_compiler.patch b/python-3.3.0b1-fix_date_time_compiler.patch index a88b0f1..29586aa 100644 --- a/python-3.3.0b1-fix_date_time_compiler.patch +++ b/python-3.3.0b1-fix_date_time_compiler.patch @@ -4,7 +4,7 @@ --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -782,11 +782,18 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ +@@ -781,11 +781,18 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ $(DTRACE_OBJS) \ $(srcdir)/Modules/getbuildinfo.c $(CC) -c $(PY_CORE_CFLAGS) \ diff --git a/python39.changes b/python39.changes index 78df483..e2b8a57 100644 --- a/python39.changes +++ b/python39.changes @@ -1,8 +1,12 @@ ------------------------------------------------------------------- Mon Nov 29 00:17:07 UTC 2021 - Matej Cepl -- Don't collect automatic Requires from python-base libraries in - %_libdir (bsc#1192249). +- Remove shebangs from from python-base libraries in _libdir + (bsc#1193179). +- Readjust patches: + - bpo-31046_ensurepip_honours_prefix.patch + - decimal.patch + - python-3.3.0b1-fix_date_time_compiler.patch ------------------------------------------------------------------- Wed Nov 17 09:49:22 UTC 2021 - Steve Kowalik diff --git a/python39.spec b/python39.spec index 64b9f87..533b853 100644 --- a/python39.spec +++ b/python39.spec @@ -315,8 +315,6 @@ Provides: python3-typing = %{version} Obsoletes: python3-typing < %{version} Provides: python3-xml = %{version} Obsoletes: python3-xml < %{version} -%else -%define __requires_exclude_from ^%{_libdir}/python%{python_version}/.*$ %endif %description -n %{python_pkg_name}-base @@ -416,6 +414,7 @@ other applications. # drop Autoconf version requirement sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac +%if %{primary_interpreter} # fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3 for dir in Lib Tools; do # find *.py, filter to files that contain bad shebangs @@ -424,6 +423,13 @@ for dir in Lib Tools; do | xargs -0 grep -lE '^#! *(/''usr/.*bin/(env +)?)?python' \ | xargs sed -r -i -e '1s@^#![[:space:]]*(/''usr/(local/)?bin/(env +)?)?python([0-9]+(\.[0-9]+)?)?@#!%{_bindir}/python3@' done +%else +# For non-primary Python, just don't bother (bsc#1193179) and remove all +# those shebangs +for dir in Lib Tools; do + find $dir -name '*.py' -type f -exec sed -i '1{/^#!.*python/ d}' '{}' \; +done +%endif # drop in-tree libffi and expat rm -r Modules/_ctypes/libffi* Modules/_ctypes/darwin