Skip to content

Commit

Permalink
Merge pull request #58 from pradal/issue57
Browse files Browse the repository at this point in the history
Update scons command with new run rather tha deprecated call subprocess.
  • Loading branch information
pradal authored May 13, 2024
2 parents 245f850 + daeb3a0 commit 21f47e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
34 changes: 10 additions & 24 deletions src/openalea/deploy/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -411,13 +413,6 @@ def run(self):
if (not self.scons_scripts):
return

# try to import subprocess package
try:
import subprocess
subprocess_enabled = True
except ImportError:
subprocess_enabled = False

# run each scons script from setup.py
for s in self.scons_scripts:
try:
Expand Down Expand Up @@ -453,10 +448,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):
Expand Down Expand Up @@ -511,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:
Expand All @@ -535,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):
Expand Down
2 changes: 1 addition & 1 deletion src/openalea/deploy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
Expand Down

0 comments on commit 21f47e5

Please sign in to comment.