diff --git a/control/tests/discrete_test.py b/control/tests/discrete_test.py index bc45056a5..7b180d3a7 100644 --- a/control/tests/discrete_test.py +++ b/control/tests/discrete_test.py @@ -5,7 +5,15 @@ import unittest import numpy as np -from control import * +from control.statesp import StateSpace +from control import matlab +from control.xferfcn import TransferFunction +from control.lti import isdtime, timebase, isctime, timebaseEqual +from control.dtime import sample_system +from control.bdalg import feedback +from control.timeresp import step_response, impulse_response, forced_response +from control.freqplot import bode + class TestDiscrete(unittest.TestCase): """Tests for the DiscreteStateSpace class.""" diff --git a/setup.py b/setup.py index 4e792dd70..05c20bb39 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ MAJOR = 0 MINOR = 6 -MICRO = 5 +MICRO = 6 ISRELEASED = True DISTNAME = 'control' DESCRIPTION = 'Python control systems library' @@ -36,15 +36,6 @@ tests_require=['scipy', 'matplotlib', 'nose'] ) -VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) - -import os -import sys -import subprocess - - -from setuptools import setup, find_packages - CLASSIFIERS = """\ Development Status :: 3 - Alpha Intended Audience :: Science/Research @@ -60,6 +51,23 @@ Operating System :: MacOS """ +VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) + +import os +import sys +import subprocess +from setuptools import setup, find_packages + +# check for python version +if sys.version_info[:2] < (2, 6) or (3, 0) <= sys.version_info[0:2] < (3, 2): + raise RuntimeError("Python version 2.6, 2.7 or >= 3.2 required.") + +# use builtins to store if we are running setup +if sys.version_info[0] >= 3: + import builtins +else: + import __builtin__ as builtins + # Return the git revision as a string def git_version(): @@ -88,6 +96,12 @@ def _minimal_ext_cmd(cmd): return GIT_REVISION +# This is a bit hackish: we are setting a global variable so that the main +# numpy __init__ can detect if it is being loaded by the setup routine, to +# avoid attempting to load components that aren't built yet. While ugly, it's +# a lot more robust than what was previously being used. +builtins.__CONTROL_SETUP__ = True + def get_version_info(): # Adding the git rev number needs to be done inside write_version_py(), @@ -100,10 +114,12 @@ def get_version_info(): # must be a source distribution, use existing version file try: from control.version import git_revision as GIT_REVISION - except ImportError: - raise ImportError("Unable to import git_revision. Try removing " - "control/version.py and the build directory " - "before building.") + except ImportError as e: + raise ImportError( + str(e) + + ", Unable to import git_revision. Try removing " + "control/version.py and the build directory " + "before building.") else: GIT_REVISION = "Unknown"