diff --git a/.travis.yml b/.travis.yml index d8305d90..1c665557 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,6 @@ install: - python setup.py install # run tests script: - - coverage run --source=SpiceyPy setup.py test + - coverage run --source=spiceypy setup.py test after_success: - coveralls \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 347703db..cc2a4d68 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,7 +46,7 @@ install: # Now install numpy from pre-built wheel. This may be fragile. - "%WITH_COMPILER% pip install --use-wheel --no-index --find-links=c:\\Users\\appveyor\\Downloads numpy" - # Now install SpiceyPy + # Now install spiceypy - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - "%PYTHON%/python setup.py install" diff --git a/docs/SpiceyPy.rst b/docs/SpiceyPy.rst index 3663d0c2..d9a6ee6f 100644 --- a/docs/SpiceyPy.rst +++ b/docs/SpiceyPy.rst @@ -1,26 +1,26 @@ SpiceyPy package ================ -SpiceyPy.wrapper module +spiceypy.wrapper module ----------------------- -.. automodule:: SpiceyPy.wrapper +.. automodule:: spiceypy.wrapper :members: :undoc-members: :show-inheritance: -SpiceyPy.libspice module +spiceypy.libspice module ------------------------ -.. automodule:: SpiceyPy.libspice +.. automodule:: spiceypy.libspice :members: :undoc-members: :show-inheritance: -SpiceyPy.support_types module +spiceypy.support_types module ----------------------------- -.. automodule:: SpiceyPy.support_types +.. automodule:: spiceypy.support_types :members: :undoc-members: :show-inheritance: diff --git a/docs/conf.py b/docs/conf.py index 289f0441..898cd91e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -69,9 +69,9 @@ def __getattr__(cls, name): # built documents. # # The short X.Y version. -version = '0.6.0' +version = '0.6.1' # The full version, including alpha/beta/rc tags. -release = '0.6.0 Beta' +release = '0.6.1 Beta' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 02ea3f83..7a67a669 100644 --- a/setup.py +++ b/setup.py @@ -86,21 +86,46 @@ def build_library(): status = os.waitpid(build_lib.pid, 0)[1] if status != 0: raise BaseException('%d' % status) + success = os.path.exists(os.path.join(os.getcwd(), 'spice.so')) + if not success: + raise BaseException("Did not find spice.so, build went badly.") except BaseException as errorInst: status = errorInst.args sys.exit('Error: compilation of shared spice.so build exit status: %d' % status) finally: os.chdir(currentDir) + elif host_OS == "Windows": + currentDir = os.getcwd() + try: + destination = os.path.join(cspice_dir, "src", "cspice") + defFile = os.path.join(root_dir, "appveyor", "cspice.def") + makeBat = os.path.join(root_dir, "appveyor", "makeDynamicSpice.bat") + shutil.copy(defFile, destination) + shutil.copy(makeBat, destination) + # run the script + os.chdir(destination) + windows_build = subprocess.Popen("makeDynamicSpice.bat", shell=True) + status = windows_build.wait() + if status != 0: + raise BaseException('%d' % status) + except BaseException as error: + sys.exit("Build failed with: %d" % error.args) + pass + finally: + os.chdir(currentDir) def move_to_root_directory(): - try: - if host_OS == "Linux" or host_OS == "Darwin": - os.rename(os.path.join(cspice_dir, 'lib', 'spice.so'), os.path.join(root_dir, 'SpiceyPy', 'spice.so')) - elif host_OS == "Windows": - os.rename(os.path.join(cspice_dir, 'src', 'cspice', 'cspice.dll'), os.path.join(root_dir, 'SpiceyPy', 'cspice.dll')) - except BaseException: - sys.exit('spice.so or cspice.dll file not found, what happend?') + if host_OS == "Linux" or host_OS == "Darwin": + try: + os.rename(os.path.join(cspice_dir, 'lib', 'spice.so'), os.path.join(root_dir, 'spiceypy', 'spice.so')) + except BaseException as e: + sys.exit('spice.so file not found, what happend?: {}'.format(e)) + elif host_OS == "Windows": + try: + os.rename(os.path.join(cspice_dir, 'src', 'cspice', 'cspice.dll'), os.path.join(root_dir, 'spiceypy', 'cspice.dll')) + except BaseException as e: + sys.exit('cspice.dll file not found, what happend?: {}'.format(e)) def cleanup(): @@ -123,28 +148,6 @@ def mac_linux_method(): move_to_root_directory() -def build_for_windows(): - if host_OS == "Windows": - currentDir = os.getcwd() - try: - destination = os.path.join(cspice_dir, "src", "cspice") - defFile = os.path.join(root_dir, "appveyor", "cspice.def") - makeBat = os.path.join(root_dir, "appveyor", "makeDynamicSpice.bat") - shutil.copy(defFile, destination) - shutil.copy(makeBat, destination) - # run the script - os.chdir(destination) - windows_build = subprocess.Popen("makeDynamicSpice.bat", shell=True) - status = windows_build.wait() - if status != 0: - raise BaseException('%d' % status) - except BaseException as error: - sys.exit("Build failed with: %d" % error.args) - pass - finally: - os.chdir(currentDir) - - def windows_method(): if host_OS == "Windows": if os.path.exists(os.path.join(cspice_dir, "lib", "cspice.dll")): @@ -152,7 +155,7 @@ def windows_method(): return else: # Build the DLL - build_for_windows() + build_library() # Move to correct location (root of the distribution) move_to_root_directory() @@ -170,17 +173,17 @@ def windows_method(): sys.exit("Unsupported OS: %s" % host_OS) setup( - name='SpiceyPy', - version='0.6.0', + name='spiceypy', + version='0.6.1', description='A Python Wrapper for the NAIF CSPICE Toolkit made using ctypes', url='https://github.com/AndrewAnnex/SpiceyPy', author='Andrew Annex', - packages=['SpiceyPy'], + packages=['spiceypy'], tests_require=['pytest', 'numpy', 'six'], cmdclass={'test': PyTest}, test_suite='test.test_wrapper.py', requires=['numpy', 'pytest', 'six'], - package_data={'SpiceyPy': ['*.so', "*.dll"]}, + package_data={'spiceypy': ['*.so', "*.dll"]}, include_package_data=True, zip_safe=False, classifiers=[ diff --git a/SpiceyPy/__init__.py b/spiceypy/__init__.py similarity index 73% rename from SpiceyPy/__init__.py rename to spiceypy/__init__.py index 971c6a16..375a27dc 100644 --- a/SpiceyPy/__init__.py +++ b/spiceypy/__init__.py @@ -2,7 +2,7 @@ __all__ = ['wrapper'] -from SpiceyPy.wrapper import * +from spiceypy.wrapper import * #Default setting for error reporting so that programs don't just exit out! erract("set", 10, "return") diff --git a/SpiceyPy/libspice.py b/spiceypy/libspice.py similarity index 99% rename from SpiceyPy/libspice.py rename to spiceypy/libspice.py index 6d4d8c90..be6dbdc2 100644 --- a/SpiceyPy/libspice.py +++ b/spiceypy/libspice.py @@ -8,7 +8,7 @@ sitePath = os.path.join(os.path.dirname(__file__), sharedLib) libspice = CDLL(sitePath) -import SpiceyPy.support_types as stypes +import spiceypy.support_types as stypes # ###################################################################################################################### # A diff --git a/SpiceyPy/support_types.py b/spiceypy/support_types.py similarity index 100% rename from SpiceyPy/support_types.py rename to spiceypy/support_types.py diff --git a/SpiceyPy/wrapper.py b/spiceypy/wrapper.py similarity index 99% rename from SpiceyPy/wrapper.py rename to spiceypy/wrapper.py index a2c768f2..712a235f 100644 --- a/SpiceyPy/wrapper.py +++ b/spiceypy/wrapper.py @@ -4,8 +4,8 @@ # here is where all the wrapper functions are located. import ctypes -import SpiceyPy.support_types as stypes -from SpiceyPy.libspice import libspice +import spiceypy.support_types as stypes +from spiceypy.libspice import libspice import functools import numpy @@ -32,7 +32,7 @@ def checkForSpiceError(f): def spiceErrorCheck(f): """ - Decorator for SpiceyPy hooking into spice error system. + Decorator for spiceypy hooking into spice error system. If an error is detected, an output simillar to outmsg_ :type f: builtins.function @@ -914,7 +914,7 @@ def ckobj(ck, ids=None): :param ck: Name of CK file. :type ck: str :param ids: Optional user provided spicecell. - :type ids: Optional SpiceyPy.support_types.SpiceCell + :type ids: Optional spiceypy.support_types.SpiceCell :return: Set of ID codes of objects in CK file. :rtype: SpiceyPy.support_types.SpiceCell """ @@ -3838,7 +3838,7 @@ def eqstr(a, b): def erract(op, lenout, action=None): """ Retrieve or set the default error action. - SpiceyPy sets the default error action to "report" on init. + spiceypy sets the default error action to "report" on init. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/erract_c.html @@ -5530,7 +5530,7 @@ def inedpl(a, b, c, plane): :return: Intersection ellipse, Found Flag. - :rtype: SpiceyPy.support_types.Ellipse, bool + :rtype: spiceypy.support_types.Ellipse, bool """ assert (isinstance(plane, stypes.Plane)) ellipse = stypes.Ellipse() @@ -5551,7 +5551,7 @@ def inelpl(ellips, plane): http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/inelpl_c.html :param ellips: A SPICE ellipse. - :type plane: SpiceyPy.support_types.Ellipse + :type plane: spiceypy.support_types.Ellipse :param plane: A SPICE plane. :type plane: SpiceyPy.support_types.Plane :return: diff --git a/test/test_spiceerrors.py b/test/test_spiceerrors.py index d57961ac..de600ee8 100644 --- a/test/test_spiceerrors.py +++ b/test/test_spiceerrors.py @@ -1,6 +1,6 @@ __author__ = 'AndrewAnnex' import pytest -import SpiceyPy as spice +import spiceypy as spice import os cwd = os.path.realpath(os.path.dirname(__file__)) diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 79e71eee..07ea986a 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -1,7 +1,7 @@ __author__ = 'AndrewAnnex' import pytest -import SpiceyPy as spice +import spiceypy as spice import numpy as np import numpy.testing as npt from test.gettestkernels import * @@ -94,7 +94,7 @@ def test_b1950(): def test_badkpv(): spice.kclear() spice.pdpool('DTEST_VAL', [3.1415, 186.0, 282.397]) - assert not spice.badkpv("SpiceyPy BADKPV test", "DTEST_VAL", "=", 3, 1, 'N') + assert not spice.badkpv("spiceypy BADKPV test", "DTEST_VAL", "=", 3, 1, 'N') spice.clpool() assert not spice.expool("DTEST_VAL") spice.kclear()