mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-12 12:50:49 +08:00
MAINT: Refactored imports
This commit is contained in:
+4
-5
@@ -60,6 +60,7 @@ import os.path as osp
|
|||||||
import imp
|
import imp
|
||||||
import functools
|
import functools
|
||||||
import warnings
|
import warnings
|
||||||
|
import sys
|
||||||
|
|
||||||
pkg_dir = osp.abspath(osp.dirname(__file__))
|
pkg_dir = osp.abspath(osp.dirname(__file__))
|
||||||
data_dir = osp.join(pkg_dir, 'data')
|
data_dir = osp.join(pkg_dir, 'data')
|
||||||
@@ -123,9 +124,8 @@ Python version, your operating system and your platform."""
|
|||||||
|
|
||||||
|
|
||||||
def _raise_build_error(e):
|
def _raise_build_error(e):
|
||||||
import os
|
|
||||||
# Raise a comprehensible error
|
# Raise a comprehensible error
|
||||||
local_dir = os.path.split(__file__)[0]
|
local_dir = osp.split(__file__)[0]
|
||||||
msg = _STANDARD_MSG
|
msg = _STANDARD_MSG
|
||||||
if local_dir == "skimage":
|
if local_dir == "skimage":
|
||||||
# Picking up the local install: this will work only if the
|
# Picking up the local install: this will work only if the
|
||||||
@@ -139,8 +139,6 @@ to build the package before using it: run `python setup.py install` or
|
|||||||
`make` in the source directory.
|
`make` in the source directory.
|
||||||
%s""" % (e, msg))
|
%s""" % (e, msg))
|
||||||
|
|
||||||
del warnings, functools, osp, imp
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# This variable is injected in the __builtins__ by the build
|
# This variable is injected in the __builtins__ by the build
|
||||||
# process. It used to enable importing subpackages of skimage when
|
# process. It used to enable importing subpackages of skimage when
|
||||||
@@ -150,7 +148,6 @@ except NameError:
|
|||||||
__SKIMAGE_SETUP__ = False
|
__SKIMAGE_SETUP__ = False
|
||||||
|
|
||||||
if __SKIMAGE_SETUP__:
|
if __SKIMAGE_SETUP__:
|
||||||
import sys
|
|
||||||
sys.stderr.write('Partial import of skimage during the build process.\n')
|
sys.stderr.write('Partial import of skimage during the build process.\n')
|
||||||
# We are not importing the rest of the scikit during the build
|
# We are not importing the rest of the scikit during the build
|
||||||
# process, as it may not be compiled yet
|
# process, as it may not be compiled yet
|
||||||
@@ -161,3 +158,5 @@ else:
|
|||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
_raise_build_error(e)
|
_raise_build_error(e)
|
||||||
from .util.dtype import *
|
from .util.dtype import *
|
||||||
|
|
||||||
|
del warnings, functools, osp, imp, sys
|
||||||
|
|||||||
Reference in New Issue
Block a user