Skip to content

Commit

Permalink
Merge 6f54fc2 into 3fb33fa
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Nov 27, 2017
2 parents 3fb33fa + 6f54fc2 commit 1d0266e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 38 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
language: python
dist: trusty
sudo: false
cache:
apt: true
env:
global: _EXPYFUN_SILENT=true DISPLAY=:99.0

addons:
apt:
Expand Down Expand Up @@ -26,7 +32,7 @@ matrix:
- os: linux
env:
# The _EXPYFUN_SILENT is a workaround for a silly Py3/Travis bug
- PYTHON=3.5 DEPS=full TEST=standard CONDA_OS=Linux _EXPYFUN_SILENT=true
- PYTHON=3.6 DEPS=full TEST=standard CONDA_OS=Linux

before_install:
# Easy dependencies (pulseaudio, scipy, matplotlib, nose, coverage, coveralls, flake8)
Expand All @@ -46,7 +52,6 @@ before_install:
curl https://cloud.github.com/downloads/AVbin/AVbin/AVbin10.pkg -o AVbin10.pkg;
sudo installer -pkg AVbin10.pkg -target /;
else
export DISPLAY=:99.0;
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset;
dbus-launch pulseaudio --start;
fi;
Expand Down
33 changes: 11 additions & 22 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ machine:
environment:
# We need to set this variable to let Anaconda take precedence
PATH: "/home/ubuntu/miniconda/envs/circleenv/bin:/home/ubuntu/miniconda/bin:$PATH"
_EXPYFUN_SILENT: true
_EXPYFUN_SILENT: "true"
DISPLAY: ":99.0"

dependencies:
cache_directories:
- "/home/ubuntu/miniconda"
# Various dependencies
pre:
# Need AVBin for some demos
Expand All @@ -18,31 +17,21 @@ dependencies:
- rm -rf ~/.pyenv;
- rm -rf ~/virtualenvs;
# Get Anaconda and conda-based requirements
- >
if [ ! -d "/home/ubuntu/miniconda" ]; then
echo "Setting up conda";
wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O ~/miniconda.sh;
chmod +x ~/miniconda.sh;
~/miniconda.sh -b -p /home/ubuntu/miniconda;
conda update --yes --quiet conda;
conda create -n circleenv --yes pip python=2.7 pip;
sed -i "s/ENABLE_USER_SITE = .*/ENABLE_USER_SITE = False/g" /home/ubuntu/miniconda/envs/circleenv/lib/python2.7/site.py;
else
echo "Conda already set up.";
fi
- wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O ~/miniconda.sh;
- chmod +x ~/miniconda.sh;
- rm -rf /home/ubuntu/miniconda;
- ~/miniconda.sh -b -p /home/ubuntu/miniconda;
- conda update --yes --quiet conda;
- conda create -n circleenv --yes pip python=2.7 pip;
- sed -i "s/ENABLE_USER_SITE = .*/ENABLE_USER_SITE = False/g" /home/ubuntu/miniconda/envs/circleenv/lib/python2.7/site.py;
- conda install -n circleenv --yes numpy scipy matplotlib sphinx pillow six pandas traits h5py;
- python -c "import h5py"
- git clone https://github.com/sphinx-gallery/sphinx-gallery.git;
- cd sphinx-gallery && pip install -r requirements.txt && python setup.py develop;
- cd /home/ubuntu && git clone https://github.com/enthought/pyface.git && cd pyface && python setup.py develop;
- pip install git+https://github.com/sphinx-gallery/sphinx-gallery.git
- pip install sphinx_bootstrap_theme numpydoc mne pyglet;

override:
- cd /home/ubuntu/expyfun && python setup.py develop;
- >
if [ ! -d "/home/ubuntu/labsn.github.io" ]; then
cd .. && git clone https://github.com/LABSN/labsn.github.io.git && cd labsn.github.io;
fi;
- cd .. && git clone https://github.com/LABSN/labsn.github.io.git && cd labsn.github.io;
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset;

test:
Expand Down
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ html_stable:
@echo "Build finished. The HTML pages are in _build/html_stable."

html_dev:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -D abort_on_example_error=1 -b html $(ALLSPHINXOPTS) _build/html
BUILD_DEV_HTML=1 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html"

Expand Down
9 changes: 2 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,15 @@
'numpy': ('https://docs.scipy.org/doc/numpy-dev/', None),
'scipy': ('https://scipy.github.io/devdocs/', None),
'sklearn': ('http://scikit-learn.org/stable/', None),
'matplotlib': ('http://matplotlib.org/', None),
'matplotlib': ('https://matplotlib.org/', None),
}

examples_dirs = ['../examples']
gallery_dirs = ['auto_examples']

sphinx_gallery_conf = {
'doc_module': ('expyfun',),
'reference_url': {
'expyfun': None,
'matplotlib': 'http://matplotlib.org',
'numpy': 'http://docs.scipy.org/doc/numpy/reference',
'scipy': 'http://docs.scipy.org/doc/scipy/reference',
'mayavi': 'http://docs.enthought.com/mayavi/mayavi'},
'reference_url': {'expyfun': None},
'examples_dirs': examples_dirs,
'gallery_dirs': gallery_dirs,
'find_mayavi_figures': False,
Expand Down
13 changes: 9 additions & 4 deletions expyfun/_experiment_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1616,8 +1616,13 @@ def write_data_line(self, event_type, value=None, timestamp=None):
timestamp = self._master_clock()
ll = '\t'.join(_sanitize(x) for x in [timestamp, event_type,
value]) + '\n'
if self._data_file is not None and not self._data_file.closed:
self._data_file.write(ll)
if self._data_file is not None:
if self._data_file.closed:
logger.warn('Data line not written due to closed file %s:\n%s'
% (self.data_fname, ll[:-1]))
else:
self._data_file.write(ll)
self.flush()

def _get_time_correction(self, clock_type):
"""Clock correction (sec) for different devices (screen, bbox, etc.)
Expand Down Expand Up @@ -1832,14 +1837,14 @@ def __exit__(self, err_type, value, traceback):
-----
err_type, value and traceback will be None when called by self.close()
"""
logger.debug('Expyfun: Exiting cleanly')

logger.info('Expyfun: Exiting')
# do external cleanups
cleanup_actions = []
if hasattr(self, '_win'):
cleanup_actions.append(self._win.close)
cleanup_actions.extend([self.stop_noise, self.stop])
cleanup_actions.extend(self._extra_cleanup_fun)
cleanup_actions.append(self.flush) # probably shouldn't be necessary
for action in cleanup_actions:
try:
action()
Expand Down
2 changes: 1 addition & 1 deletion expyfun/_tdt_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def __init__(self, tdt_params):
time.sleep(0.25)
if not self.rpcox.LoadCOF(self.circuit):
raise RuntimeError('Second loading attempt failed')
except:
except Exception:
raise IOError('Expyfun: Problem loading circuit.')
logger.info('Expyfun: Circuit loaded to {1} via {2}:\n{0}'
''.format(self.circuit, self.model, self.interface))
Expand Down
2 changes: 1 addition & 1 deletion expyfun/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def verbose_dec(function, *args, **kwargs):
# set it back if we get an exception
try:
ret = function(*args, **kwargs)
except:
except Exception:
set_log_level(old_level)
raise
set_log_level(old_level)
Expand Down

0 comments on commit 1d0266e

Please sign in to comment.