summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch
blob: d2246327f210b2c5c787eb23af9ae07599a62e5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 6b111a328c1c57b1580d63894b2b5d337316f6d4 Mon Sep 17 00:00:00 2001
From: Paulo Neves <ptsneves@gmail.com>
Date: Tue, 7 Jun 2022 16:16:41 +0200
Subject: [PATCH] Avoid shebang overflow on python-config.py

The whole native path may be too big, leading to shebang
overflow. Let's just use the env shebang.

Denial reason: [1]

Upstream-Status: Denied [distribution]

[1] https://github.com/python/cpython/pull/93760#pullrequestreview-1005365737
---
 Makefile.pre.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile.pre.in b/Makefile.pre.in
index 9ec3a71..f7d5382 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2606,6 +2606,8 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
 	@ # Substitution happens here, as the completely-expanded BINDIR
 	@ # is not available in configure
 	sed -e "s,@EXENAME@,$(EXENAME)," < $(srcdir)/Misc/python-config.in >python-config.py
+	@ # Otherwise we might get huge shebangs with native paths
+	sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' python-config.py
 	@ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
 	LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config
 	@ # On Darwin, always use the python version of the script, the shell