Skip to content

Commit 90ad893

Browse files
committed
fixed outdated code based on xvfbwrapper
1 parent 774906a commit 90ad893

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ before_install:
1818
- if $INSTALL_DEB_DEPENDECIES; then sudo ln -s /run/shm /dev/shm; fi
1919
- bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
2020
- sudo apt-get update
21+
- sudo apt-get install xvfb
2122
- if $INSTALL_DEB_DEPENDECIES; then travis_retry sudo apt-get install -qq --no-install-recommends
2223
fsl afni elastix; fi
2324
- if $INSTALL_DEB_DEPENDECIES; then travis_retry sudo apt-get install -qq fsl-atlases;

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- sudo apt-get update
1515
override:
1616
# Install apt packages
17-
- sudo apt-get install -y fsl-core fsl-atlases fsl-mni152-templates fsl-feeds afni swig python-vtk
17+
- sudo apt-get install -y fsl-core fsl-atlases fsl-mni152-templates fsl-feeds afni swig python-vtk xvfb
1818
- echo 'source /etc/fsl/fsl.sh' >> $HOME/.profile
1919
- echo 'source /etc/afni/afni.sh' >> $HOME/.profile
2020
- mkdir -p ~/examples/ && ln -sf /usr/share/fsl-feeds/ ~/examples/feeds

nipype/interfaces/base.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ def __init__(self, value):
6464
def __str__(self):
6565
return repr(self.value)
6666

67-
68-
def _unlock_display(ndisplay):
69-
lockf = os.path.join('/tmp', '.X%d-lock' % ndisplay)
70-
try:
71-
os.remove(lockf)
72-
except:
73-
return False
74-
75-
return True
76-
77-
7867
def _exists_in_path(cmd, environ):
7968
'''
8069
Based on a code snippet from
@@ -987,22 +976,18 @@ def _run_wrapper(self, runtime):
987976

988977
vdisp = Xvfb(nolisten='tcp')
989978
vdisp.start()
990-
vdisp_num = vdisp.vdisplay_num
979+
try:
980+
vdisp_num = vdisp.new_display
981+
except AttributeError: # outdated version of xvfbwrapper
982+
vdisp_num = vdisp.vdisplay_num
991983

992984
iflogger.info('Redirecting X to :%d' % vdisp_num)
993985
runtime.environ['DISPLAY'] = ':%d' % vdisp_num
994986

995987
runtime = self._run_interface(runtime)
996988

997989
if self._redirect_x:
998-
if sysdisplay is None:
999-
os.unsetenv('DISPLAY')
1000-
else:
1001-
os.environ['DISPLAY'] = sysdisplay
1002-
1003-
iflogger.info('Freeing X :%d' % vdisp_num)
1004990
vdisp.stop()
1005-
_unlock_display(vdisp_num)
1006991

1007992
return runtime
1008993

0 commit comments

Comments
 (0)