Skip to content

Commit

Permalink
mock is now a build dependency
Browse files Browse the repository at this point in the history
it is used to do the magic taup models builds
  • Loading branch information
mbyt committed Feb 11, 2015
1 parent 0a4568e commit 19e182a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions setup.py
Expand Up @@ -43,13 +43,23 @@
"before installing ObsPy.")
raise ImportError(msg)

import sys
if sys.version_info[0] == 2:
try:
from mock import patch # PY2
except:
msg = ("No module named mock. Please install mock first, it is needed "
"before installing ObsPy.")
raise ImportError(msg)
else:
from unittest.mock import patch

import ctypes
import fnmatch
import glob
import inspect
import os
import platform
import sys
from distutils.dep_util import newer
from distutils.util import change_root

Expand Down Expand Up @@ -118,7 +128,7 @@
'neries': ['suds-jurko']}
# PY2
if sys.version_info[0] == 2:
EXTRAS_REQUIRE['tests'].append('mock')
INSTALL_REQUIRES.append('mock')
# Add argparse for Python 2.6. stdlib package for Python >= 2.7
if sys.version_info[:2] == (2, 6):
INSTALL_REQUIRES.append('argparse')
Expand Down Expand Up @@ -648,7 +658,6 @@ def build_taup_models(self):
'obspy', 'lib', libname)
taulib = ctypes.CDLL(libpath)

from mock import patch
sys.path.insert(0, obspy_taup_path)
with patch('obspy.core.util.libnames._load_CDLL', return_value=taulib):
from taup.taup_create import TauP_Create
Expand Down

2 comments on commit 19e182a

@QuLogic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only temporarily, if we can avoid it...

@megies
Copy link
Member

@megies megies commented on 19e182a Feb 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know how that evolves, as it should be added to debian/python_distutils/control in Build-Depends..

Please sign in to comment.