reconnect moved files to git repo
This commit is contained in:
@ -0,0 +1,46 @@
|
||||
""" Module to give helpful messages to the user that did not
|
||||
compile the pmdarima lib properly.
|
||||
"""
|
||||
import os
|
||||
|
||||
INPLACE_MSG = """
|
||||
It appears that you are importing a local pmdarima 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 == "pmdarima/__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 pmdarima has not been built correctly.
|
||||
If you have installed pmdarima from source, please do not forget
|
||||
to build the package before using it: run `python setup.py install` or
|
||||
`make` from the top-level directory.
|
||||
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
|
||||
|
||||
|
||||
try:
|
||||
from ._check_build import check_build
|
||||
except ImportError as ie:
|
||||
raise_build_error(ie)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,20 @@
|
||||
# Author: Virgile Fritsch <virgile.fritsch@inria.fr> (originally written
|
||||
# for sklearn, adapted for pmdarima)
|
||||
# License: BSD 3 clause
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def configuration(parent_package='', top_path=None):
|
||||
from numpy.distutils.misc_util import Configuration
|
||||
config = Configuration('__check_build', parent_package, top_path)
|
||||
config.add_extension('_check_build',
|
||||
sources=['_check_build.pyx'],
|
||||
include_dirs=[np.get_include()])
|
||||
|
||||
return config
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from numpy.distutils.core import setup
|
||||
setup(**configuration(top_path='').todict())
|
||||
@ -0,0 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pmdarima.__check_build import raise_build_error
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_raise_build_error():
|
||||
try:
|
||||
# Raise a value error to pass into the raise_build_error
|
||||
# to assert it turns it into an ImportError
|
||||
raise ValueError("this is a dummy err msg")
|
||||
except ValueError as v:
|
||||
with pytest.raises(ImportError):
|
||||
raise_build_error(v)
|
||||
Reference in New Issue
Block a user