Use subprocess.call instead of subprocess.run on older versions of python

This commit is contained in:
kpetersn
2020-06-15 16:54:09 -05:00
parent efa32a948f
commit 7080091177
+9 -2
View File
@@ -1,10 +1,14 @@
#!/usr/bin/env python
import os
import sys
import subprocess
# Comment out SUPPORT from motor's RELEASE file
status = subprocess.run(['sed', '-i', '-e', "s|^\(SUPPORT=.*\)$|#\1|g", './configure/RELEASE'])
if sys.version_info >= (3, 5):
status = subprocess.run(['sed', '-i', '-e', "s|^\(SUPPORT=.*\)$|#\1|g", './configure/RELEASE'])
else:
status = subprocess.call(['sed', '-i', '-e', "s|^\(SUPPORT=.*\)$|#\1|g", './configure/RELEASE'])
#
print("{}Updated motor/configure/RELEASE{}".format(ANSI_BLUE, ANSI_RESET))
#!grep SUPPORT ./configure/RELEASE || :
@@ -12,7 +16,10 @@ os.system('cat ./configure/RELEASE')
print("{}End of updated motor/configure/RELEASE{}".format(ANSI_BLUE, ANSI_RESET))
# Comment out SUPPORT from motorOms's RELEASE file
status = subprocess.run(['sed', '-i', '-e', "s|^\(SUPPORT=.*\)$|#\1|g", './modules/motorOms/configure/RELEASE'])
if sys.version_info >= (3, 5):
status = subprocess.run(['sed', '-i', '-e', "s|^\(SUPPORT=.*\)$|#\1|g", './modules/motorOms/configure/RELEASE'])
else:
status = subprocess.call(['sed', '-i', '-e', "s|^\(SUPPORT=.*\)$|#\1|g", './modules/motorOms/configure/RELEASE'])
#
print("{}Updated motor/modules/motorOms/configure/RELEASE{}".format(ANSI_BLUE, ANSI_RESET))
#!grep SUPPORT ./modules/motorOms/configure/RELEASE || :