ufw: Fix interpreter for installed ufw and test ufw

Revert patch to setup-only-make-one-reference-to-env.patch and make
patch for python3 interpreter fix apply to runs of setup.py during
self test as well as installs.

Reported-by: Kenta Nakamura <Nakamura.Kenta@bp.MitsubishiElectric.co.jp>
Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
This commit is contained in:
Jate Sujjavanich 2021-08-13 16:20:47 +00:00 committed by Armin Kuster
parent b472160c77
commit a64eec1771
2 changed files with 6 additions and 16 deletions

View File

@ -1,7 +1,7 @@
Add code to detect openembedded python interpreter
OE does not use /usr/bin/env as part of the interpreter, so it does not
update ufw with the interpreter name.
OE does not use /usr/bin/env as part of the interpreter, Instead, it's a
full path in sys.executable.
Upstream-Status: Inappropriate (Embedded)
Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
@ -17,9 +17,9 @@ index 75c1105..3f9a5e0 100644
"-i.jjm",
"1s%^#.*python.*%#! " + sys.executable + "%g",
'staging/ufw'])
+ elif '-native/python' in sys.executable and \
+ elif '/python' in sys.executable and \
+ os.path.basename(sys.executable) in ['python', 'python3']:
+ print("Detected oe native python " + os.path.basename(sys.executable))
+ print("Detected full path " + sys.executable + ". substituting " + os.path.basename(sys.executable))
+ subprocess.call(["sed",
+ "-i.jjm",
+ "1s%python$%"

View File

@ -14,10 +14,6 @@ detected or specified on the build line.
Upstream-Status: Inappropriate [ embedded specific ]
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Added conditional to handle sys.executable without env on python3
Signed-off-by Jate Sujjavanich <jatedev@gmail.com>
---
setup.py | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
@ -47,7 +43,7 @@ index b13d11c..73acdef 100644
# Now byte-compile everything
super(Install, self).run()
@@ -107,12 +112,29 @@ class Install(_install, object):
@@ -107,12 +112,23 @@ class Install(_install, object):
for f in [ script, manpage, manpage_f ]:
self.mkpath(os.path.dirname(f))
@ -66,13 +62,7 @@ index b13d11c..73acdef 100644
- 'staging/ufw'])
+ print("Updating staging/ufw to use (%s)" % (sys.executable))
+
+ if not re.search("(/usr/bin/env)", sys.executable):
+ print("Did not find 'env' in sys.executable (%s)" % (sys.executable))
+ subprocess.call(["sed",
+ "-i",
+ "1s%^#.*python.*%#! /usr/bin/env " + sys.executable + "%g",
+ 'staging/ufw'])
+ elif re.search("(/usr/bin/env)", sys.executable):
+ if re.search("(/usr/bin/env)", sys.executable):
+ print("found 'env' in sys.executable (%s)" % (sys.executable))
+ subprocess.call(["sed",
+ "-i.jjm",