mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-21 12:50:27 +08:00
Added build location checker, does not fully work yet. Complicated error.
This commit is contained in:
committed by
Jonathan Helmus
parent
3042242c8d
commit
edc16c6b75
@@ -0,0 +1,34 @@
|
||||
Files in this directory are derived from the scikit-learn project with the
|
||||
following license:
|
||||
|
||||
New BSD License
|
||||
|
||||
Copyright (c) 2007–2014 The scikit-learn developers.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
a. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
b. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
c. Neither the name of the Scikit-learn Developers nor the names of
|
||||
its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
@@ -0,0 +1,47 @@
|
||||
""" Module to give helpful messages to the user that did not
|
||||
compile scikit-image properly.
|
||||
This checking code was stolen from scikit-learn & pyart.
|
||||
"""
|
||||
import os
|
||||
|
||||
INPLACE_MSG = """
|
||||
It appears that you are importing a local scikit-image source tree. For
|
||||
this, you need to have an inplace install. Maybe you are in the source
|
||||
directory and you need to try from another location."""
|
||||
|
||||
STANDARD_MSG = """
|
||||
If you have used an installer, please check that it is suited for your
|
||||
Python version, your operating system and your platform."""
|
||||
|
||||
|
||||
def raise_build_error(e):
|
||||
# Raise a comprehensible error and list the contents of the
|
||||
# directory to help debugging on the mailing list.
|
||||
local_dir = os.path.split(__file__)[0]
|
||||
msg = STANDARD_MSG
|
||||
if local_dir == "skimage/__check_build":
|
||||
# Picking up the local install: this will work only if the
|
||||
# install is an 'inplace build'
|
||||
msg = INPLACE_MSG
|
||||
dir_content = list()
|
||||
for i, filename in enumerate(os.listdir(local_dir)):
|
||||
if ((i + 1) % 3):
|
||||
dir_content.append(filename.ljust(26))
|
||||
else:
|
||||
dir_content.append(filename + '\n')
|
||||
raise ImportError("""%s
|
||||
___________________________________________________________________________
|
||||
Contents of %s:
|
||||
%s
|
||||
___________________________________________________________________________
|
||||
It seems that scikit-image has not been built correctly.
|
||||
|
||||
If you have installed scikit-image from source, please do not forget
|
||||
to build the package before using it: run `python setup.py install` or
|
||||
`make` in the source directory.
|
||||
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
|
||||
|
||||
try:
|
||||
from ._check_build import check_build
|
||||
except ImportError as e:
|
||||
raise_build_error(e)
|
||||
@@ -0,0 +1,2 @@
|
||||
def check_build():
|
||||
return
|
||||
@@ -0,0 +1,19 @@
|
||||
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
|
||||
# License: BSD 3 clause
|
||||
|
||||
import numpy
|
||||
from skimage._build import cython
|
||||
|
||||
def configuration(parent_package='', top_path=None):
|
||||
from numpy.distutils.misc_util import Configuration
|
||||
|
||||
config = Configuration('__check_build', parent_package, top_path)
|
||||
|
||||
cython(['_check_build.pyx'], working_path=base_path)
|
||||
config.add_extension('_check_build',
|
||||
sources=['_check_build.c'])
|
||||
return config
|
||||
|
||||
if __name__ == '__main__':
|
||||
from numpy.distutils.core import setup
|
||||
setup(**configuration(top_path='').todict())
|
||||
@@ -110,3 +110,5 @@ doctest_verbose = functools.partial(test, doctest=True, verbose=True)
|
||||
doctest_verbose.__doc__ = doctest.__doc__
|
||||
|
||||
del warnings, functools, osp, imp
|
||||
|
||||
from . import __check_build
|
||||
|
||||
@@ -6,6 +6,7 @@ def configuration(parent_package='', top_path=None):
|
||||
|
||||
config = Configuration('skimage', parent_package, top_path)
|
||||
|
||||
config.add_subpackage('__check_build')
|
||||
config.add_subpackage('_shared')
|
||||
config.add_subpackage('color')
|
||||
config.add_subpackage('data')
|
||||
|
||||
Reference in New Issue
Block a user