Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scons command with new run rather tha deprecated call subprocess. #58

Merged
merged 3 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading