Skip to content

Commit

Permalink
removed camel case in name, so use "import spiceypy"
Browse files Browse the repository at this point in the history
bumped version up to 0.6.1 due to name change of import
  • Loading branch information
AndrewAnnex committed Aug 14, 2015
1 parent 7e4c888 commit 35cbd27
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -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
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -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"

Expand Down
12 changes: 6 additions & 6 deletions 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:
4 changes: 2 additions & 2 deletions docs/conf.py
Expand Up @@ -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.
Expand Down
71 changes: 37 additions & 34 deletions setup.py
Expand Up @@ -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():
Expand All @@ -123,36 +148,14 @@ 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")):
print("Found premade cspice.dll, not building")
return
else:
# Build the DLL
build_for_windows()
build_library()
# Move to correct location (root of the distribution)
move_to_root_directory()

Expand All @@ -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=[
Expand Down
2 changes: 1 addition & 1 deletion SpiceyPy/__init__.py → spiceypy/__init__.py
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion SpiceyPy/libspice.py → spiceypy/libspice.py
Expand Up @@ -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
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions SpiceyPy/wrapper.py → spiceypy/wrapper.py
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion 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__))

Expand Down
4 changes: 2 additions & 2 deletions 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 *
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 35cbd27

Please sign in to comment.