[jhbuild/sysdeps-python2] sysdeps: correctly detect python2 sysdeps when running under Python 3
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/sysdeps-python2] sysdeps: correctly detect python2 sysdeps when running under Python 3
- Date: Tue, 24 Sep 2019 17:35:17 +0000 (UTC)
commit 216ee03ecedb4dba7ffc3daa8bd55795f9900b8b
Author: Christoph Reiter <reiter christoph gmail com>
Date: Tue Sep 24 19:27:54 2019 +0200
sysdeps: correctly detect python2 sysdeps when running under Python 3
We can't just check modules in the same process anymore with Python 3.
Use a separate interpereter process like we did with python 2 sysdeps before.
Fixes #36
jhbuild/utils/systeminstall.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/jhbuild/utils/systeminstall.py b/jhbuild/utils/systeminstall.py
index 3af2ce63..24ace1be 100644
--- a/jhbuild/utils/systeminstall.py
+++ b/jhbuild/utils/systeminstall.py
@@ -24,7 +24,6 @@ import sys
import logging
import shlex
import subprocess
-import imp
import textwrap
import time
import re
@@ -180,14 +179,9 @@ def systemdependencies_met(module_name, sysdeps, config):
if not found:
dep_met = False
- elif dep_type == 'python2':
- try:
- imp.find_module(value)
- except Exception:
- dep_met = False
-
- elif dep_type == 'python3':
- python3_script = textwrap.dedent('''
+ elif dep_type in ('python2', 'python3'):
+ command = dep_type
+ python_script = textwrap.dedent('''
import imp
import sys
try:
@@ -196,7 +190,7 @@ def systemdependencies_met(module_name, sysdeps, config):
exit(1)
''').strip('\n')
try:
- subprocess.check_call(['python3', '-c', python3_script, value])
+ subprocess.check_call([command, '-c', python_script, value])
except (subprocess.CalledProcessError, OSError):
dep_met = False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]