From fc57e794915d6f0bd1c1e8440e6c04e6f5a9f061 Mon Sep 17 00:00:00 2001 From: pradal Date: Mon, 13 May 2024 11:32:23 +0200 Subject: [PATCH 1/3] Update scons command with new run rather tha deprecated call subprocess. --- src/openalea/deploy/command.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/openalea/deploy/command.py b/src/openalea/deploy/command.py index b5aa9d2..d44af0b 100644 --- a/src/openalea/deploy/command.py +++ b/src/openalea/deploy/command.py @@ -32,6 +32,8 @@ from distutils.errors import * import stat import glob +import shlex + from os.path import join as pj from setuptools import Command from setuptools.dist import assert_string_list, assert_bool @@ -412,11 +414,9 @@ def run(self): return # try to import subprocess package - try: - import subprocess - subprocess_enabled = True - except ImportError: - subprocess_enabled = False + import subprocess + subprocess_enabled = True + # run each scons script from setup.py for s in self.scons_scripts: @@ -453,10 +453,11 @@ def run(self): print(commandstr) # Run SCons - if (subprocess_enabled): - retval = subprocess.call(commandstr, shell=True) - else: - retval = os.system(commandstr) + # Fix issue 57 : Martin and Christophe + + command_line = shlex.split(commandstr) + result = subprocess.run(command_line, shell=True, timeout=None) + retval = result.returncode # Test if command success with return value if (retval != 0): From b4e4a66db2481572012ba1613744f693abd30f84 Mon Sep 17 00:00:00 2001 From: pradal Date: Mon, 13 May 2024 11:39:57 +0200 Subject: [PATCH 2/3] Update version to 3.1.2 --- src/openalea/deploy/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openalea/deploy/version.py b/src/openalea/deploy/version.py index f1aff43..5d40bd3 100644 --- a/src/openalea/deploy/version.py +++ b/src/openalea/deploy/version.py @@ -7,7 +7,7 @@ minor = 1 """(int) Version minor component.""" -post = 1 +post = 2 """(int) Version post or bugfix component.""" __version__ = ".".join([str(s) for s in (major, minor, post)]) From daeb3a08da67fe2bd680b62294ae20f789c6c7f5 Mon Sep 17 00:00:00 2001 From: pradal Date: Mon, 13 May 2024 11:46:09 +0200 Subject: [PATCH 3/3] Update also cmake command --- src/openalea/deploy/command.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/openalea/deploy/command.py b/src/openalea/deploy/command.py index d44af0b..ea5be23 100644 --- a/src/openalea/deploy/command.py +++ b/src/openalea/deploy/command.py @@ -413,11 +413,6 @@ def run(self): if (not self.scons_scripts): return - # try to import subprocess package - import subprocess - subprocess_enabled = True - - # run each scons script from setup.py for s in self.scons_scripts: try: @@ -512,13 +507,6 @@ def run(self): if (not self.cmake_scripts): return - # try to import subprocess package - try: - import subprocess - subprocess_enabled = True - except ImportError: - subprocess_enabled = False - # run each CMake script from setup.py for s in self.cmake_scripts: try: @@ -536,13 +524,10 @@ def run(self): if not os.path.isdir('build-cmake'): os.mkdir('build-cmake') - os.chdir('build-cmake') - # Run CMake - if (subprocess_enabled): - retval = subprocess.call(commandstr, shell=True) - else: - retval = os.system(commandstr) + command_line = shlex.split(commandstr) + result = subprocess.run(command_line, cwd='build-cmake', shell=True, timeout=None) + retval = result.returncode # Test if command success with return value if (retval != 0):