Skip to content

Commit 8c65fbf

Browse files
committed
[MAINT] Reduce minimal code redundancy in filemanip.get_dependencies
1 parent 8918703 commit 8c65fbf

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

nipype/utils/filemanip.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -880,22 +880,20 @@ def get_dependencies(name, environ):
880880
Uses otool on darwin, ldd on linux. Currently doesn't support windows.
881881
882882
"""
883+
command = None
883884
if sys.platform == 'darwin':
884-
proc = sp.Popen(
885-
'otool -L `which %s`' % name,
886-
stdout=sp.PIPE,
887-
stderr=sp.PIPE,
888-
shell=True,
889-
env=environ)
885+
command = 'otool -L `which %s`' % name
890886
elif 'linux' in sys.platform:
891-
proc = sp.Popen(
892-
'ldd `which %s`' % name,
893-
stdout=sp.PIPE,
894-
stderr=sp.PIPE,
895-
shell=True,
896-
env=environ)
887+
command = 'ldd `which %s`' % name
897888
else:
898889
return 'Platform %s not supported' % sys.platform
890+
891+
proc = sp.Popen(
892+
command,
893+
stdout=sp.PIPE,
894+
stderr=sp.PIPE,
895+
shell=True,
896+
env=environ)
899897
o, e = proc.communicate()
900898
return o.rstrip()
901899

0 commit comments

Comments
 (0)