Skip to content

Commit

Permalink
Trying to get METANETX RTD issue under control
Browse files Browse the repository at this point in the history
  • Loading branch information
phantomas1234 committed Jan 12, 2015
1 parent 33480ae commit 05b6792
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions cameo/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@
# logger.info('Initializing cameo advanced programming interface. Be patient this might take a while ...')

import os
import gzip
import cPickle as pickle
import cameo

# with gzip.open(os.path.join(cameo._cameo_data_path, 'metanetx.pgz')) as f:
# _METANETX = pickle.load(f)
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

with open(os.path.join(cameo._cameo_data_path, 'metanetx.pickle')) as f:
_METANETX = pickle.load(f)
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd:
with open(os.path.join(cameo._cameo_data_path, 'metanetx.pickle')) as f:
_METANETX = pickle.load(f)
else:
# Mock this for RTD
_METANETX = dict([(key, None) for key in ['chem_prop', 'universal_model', 'bigg2mnx', 'mnx2bigg']])

from cameo.api.hosts import hosts
from cameo.api.designer import design
from cameo.api.products import products

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __getattr__(cls, name):

MOCK_MODULES = ['numpy', 'numpy.random', 'matplotlib', 'pandas', 'scipy', 'scipy.sparse',
'scipy.io', 'scipy.stats', 'scipy.version', 'bokeh', 'bokeh.plotting', 'swiglpk',
'glpk', 'gurobipy', 'gurobipy.GRB', 'cplex', 'mlabwrap', 'pp', 'libsbml']
'glpk', 'gurobipy', 'gurobipy.GRB', 'cplex', 'mlabwrap', 'pp', 'libsbml', 'METANETX', '_METANETX']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

# If extensions (or modules to document with autodoc) are in another directory,
Expand Down

0 comments on commit 05b6792

Please sign in to comment.