Skip to content

Commit e62a840

Browse files
Christian Rothmr-c
authored andcommitted
use subprocess from stdlib on python>=3.5 (#1001)
* apply changes to requirements.txt as well
1 parent 65aedc5 commit e62a840

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

cwltool/singularity.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@
2323
from .pathmapper import ensure_writable, ensure_non_writable
2424
from .process import UnsupportedRequirement
2525
from .utils import docker_windows_path_adjust
26+
2627
if os.name == 'posix':
27-
from subprocess32 import ( # pylint: disable=import-error,no-name-in-module
28-
check_call, check_output, CalledProcessError, DEVNULL, PIPE, Popen,
29-
TimeoutExpired)
28+
if sys.version_info < (3, 5):
29+
from subprocess32 import ( # pylint: disable=import-error,no-name-in-module
30+
check_call, check_output, CalledProcessError, DEVNULL, PIPE, Popen,
31+
TimeoutExpired)
32+
else:
33+
from subprocess import ( # pylint: disable=import-error,no-name-in-module
34+
check_call, check_output, CalledProcessError, DEVNULL, PIPE, Popen,
35+
TimeoutExpired)
36+
3037
else: # we're not on Unix, so none of this matters
3138
pass
3239

cwltool/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222

2323
# no imports from cwltool allowed
2424
if os.name == 'posix':
25-
import subprocess32 as subprocess # pylint: disable=unused-import
25+
if sys.version_info < (3, 5):
26+
import subprocess32 as subprocess # pylint: disable=unused-import
27+
else:
28+
import subprocess # pylint: disable=unused-import
2629
else:
2730
import subprocess # type: ignore
2831

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ bagit==1.6.4
1010
mypy-extensions
1111
psutil
1212
scandir
13-
subprocess32 >= 3.5.0; os.name=="posix"
13+
subprocess32 >= 3.5.0; os.name=="posix" and python_version<"3.5"
1414
typing-extensions

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
'typing-extensions',
6464
],
6565
extras_require={
66-
':os.name=="posix"': ['subprocess32 >= 3.5.0'],
66+
':os.name=="posix" and python_version<"3.5"': ['subprocess32 >= 3.5.0'],
6767
':python_version<"3"': ['pathlib2 == 2.3.2'],
6868
':python_version<"3.6"': ['typing >= 3.5.3'],
6969
'deps': ["galaxy-lib >= 17.09.9"]

0 commit comments

Comments
 (0)