summaryrefslogtreecommitdiff
diff options
authorShiva Iyer <[email protected]>2019-06-15 10:21:52 -0500
committerShiva Iyer <[email protected]>2019-06-15 10:21:52 -0500
commit5038042a4d3a7979f49ff79f6c54594bc85cfe9f (patch)
treea429b4983fd603c508b04bed1cd6eea8fc41afc9
parent488467e4d6eee772d6e708562547232eb2cf4681 (diff)
downloadkepler-master.tar.gz
Made Python wrapper pip installable.HEADmaster
-rw-r--r--.gitignore14
-rw-r--r--MANIFEST.in1
-rw-r--r--README123
-rw-r--r--README.md97
-rw-r--r--examples/.gitignore8
-rw-r--r--pykepler/.gitignore2
-rw-r--r--pykepler/__init__.py8
-rw-r--r--setup.py46
-rw-r--r--src/.gitignore2
9 files changed, 160 insertions, 141 deletions
diff --git a/.gitignore b/.gitignore
index adb95e6..08fd77c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,14 @@
+**/*.o
+**/*.so*
+**/*.pyc
+**/__pycache__
+**/*.exe
+**/*.DAT
+**/*.dat
+**/kepler_test
+**/rise_set
data/
reference/
-
-
+build/
+dist/
+pykepler.egg-info/ \ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..b9c0fda
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include pykepler/libkepler.so
diff --git a/README b/README
deleted file mode 100644
index 113566c..0000000
--- a/README
+++ /dev/null
@@ -1,123 +0,0 @@
-*************************************************************************
-* README file for the kepler library *
-* Copyright (C) 2016 Shiva Iyer <shiva.iyer AT g m a i l DOT c o m> *
-* *
-* This program is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU General Public License as published by *
-* the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU General Public License for more details. *
-* *
-* You should have received a copy of the GNU General Public License *
-* along with this program. If not, see <http://www.gnu.org/licenses/>. *
-*************************************************************************
-
-Introduction
-------------
-
-This is the kepler library, version 1.0.0. kepler provides a set of routines for
-performing astronomical calculations. The library is implemented in ANSI C and
-the optional pykepler package provides support for programs written in Python.
-
-The intent is to provide the basic building blocks necessary for more advanced
-applications. Consequently, no attempt has been made to provide an user interface
-or to write programs that meet various needs (observation, historical research
-etc.).
-
-The kepler library is free software, distributed under the terms of the GNU
-General Public License <http://www.gnu.org/licenses/gpl.html>.
-
-Prerequisites
--------------
-
-Make sure your Unix installation has the GNU C compiler and build tools
-installed. The following are the minimum version requirements.
-
- * GNU gcc 4.4.1
- * GNU Make 3.81
- * Python 2.6.5 (needed only if you use the Python interface)
-
-kepler can also be used with Microsoft Windows provided you have MinGW and
-MSYS installed. These tools may be downloaded from <http://www.mingw.org/>.
-
-Installation
-------------
-
-Instructions for downloading the source archives and accessing the development
-repository may be found at <http://savannah.nongnu.org/projects/kepler>.
-
-Run 'make target={posix|windows}' in the kepler installation directory to compile
-all the library files and example programs. In order to call kepler's functions
-from your own applications, you will need to create your own makefile along the
-lines of the one in the 'examples' subdirectory.
-
-Run 'make target={posix|windows} install' to deploy the shared library that is
-created in the previous step. On most systems, you will need to run this as root.
-You will need to do this before you run the example programs or use the pykepler
-Python package. On Windows, please copy src/libkepler.dll manually to your
-application or Windows system directory.
-
-Run 'make target={posix|windows} clean' to remove all the files created by
-running 'make'. This will not remove the shared libraries or symbolic links
-in /usr/lib.
-
-The 'pykepler' subdirectory contains the sources for the pykepler Python package.
-This package allows you to call kepler routines from Python.
-
-Documentation
--------------
-
-The C library is documented in the file kepler.html under the 'doc' subdirectory.
-
-The 'pydoc' utility or the help() function in the interactive Python interpreter
-may be used to view the documentation for the Python interface.
-
-Examples
---------
-
-The following sample programs may be found in the 'examples'
-subdirectory:
-
-kepler_test.c calls most of the functions in kepler and displays the
-results in a terminal window. To test the routines in mpc_file.c, you
-must download the MPC Orbit Database files from
-<http://www.cfa.harvard.edu/iau/MPCORB.html>.
-
-rise_set.c is a program that accepts command-line arguments and displays
-the rise, transit and setting times for the Sun, Moon, planets and Pluto.
-
-planpos.py demonstrates the Python wrapper by calling routines in the
-VSOP, ELP and Pluto modules to display the positions of the Sun, Moon,
-planets and Pluto at the time specified on the command-line.
-
-flightseg.py displays the great circle distance and bearing angles for
-flight segments between the airports specified on the command line.
-The airport database from <http://openflights.org/data.html> must be
-downloaded into the examples folder.
-
-References
-----------
-
-kepler is targeted towards users with a sound grasp of positional astronomy.
-However, it has been thought fit to include references to the relevant
-astronomical literature in the source code.
-
-No work of this nature would be possible without the following standard works on
-astronomical algorithms:
-
- * "Explanatory supplement to the Astronomical Almanac" by P. Kenneth Seidelmann
- * "Celestial Mechanics" by Forest Ray Moulton
- * "Astronomical Algorithms" by Jean Meeus
-
-Bugs
-----
-
-Comments, criticisms and bug reports are very welcome and may be sent to the
-kepler maintainer by email or the project's website.
-
-Shiva Iyer
-shiva.iyer AT g m a i l DOT c o m
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2213ec6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,97 @@
+Introduction
+------------
+
+kepler contains a set of routines for performing astronomical
+calculations. The library is implemented in ANSI C and the optional
+pykepler package provides support for Python.
+
+The intent is to supply the basic building blocks necessary for more
+advanced applications. Consequently, no attempt has been made to
+develop an user interface or to write programs for various use cases.
+
+Prerequisites
+-------------
+
+Make sure your Unix installation has the GNU C compiler and build
+tools installed. The following are the minimum version requirements.
+
+1. GNU gcc 4.4.1
+2. GNU Make 3.81
+3. Python 2.6.5 (needed only if you use the Python interface)
+
+kepler can also be used with Microsoft Windows provided you have MinGW
+and MSYS installed. These tools may be downloaded from <http://www.mingw.org/>.
+
+Installation
+------------
+
+Instructions for downloading the source archives and accessing the
+development repository may be found at <https://github.com/Shiva-Iyer/kepler>.
+
+Run 'make target={posix|windows}' in the kepler installation directory
+to compile all the library files and example programs. In order to
+call kepler's functions from your own applications, you will need to
+create your own makefile along the lines of the one in the 'examples'
+subdirectory.
+
+Run 'make target={posix|windows} install' to deploy the shared library
+that is created in the previous step. On most systems, you will need
+to run this as root. You will need to do this before you run the
+example programs or use the pykepler Python package. On Windows,
+please copy src/libkepler.dll manually to your application or Windows
+system directory.
+
+Run 'make target={posix|windows} clean' to remove all the files
+created by running 'make'. This will not remove the shared libraries
+or symbolic links in /usr/lib.
+
+The 'pykepler' subdirectory contains the sources for the pykepler
+Python package. This package allows you to call kepler routines from
+Python.
+
+Documentation
+-------------
+
+The C library is documented in the file kepler.html under the 'doc'
+subdirectory.
+
+The 'pydoc' utility or the help() function in the interactive Python
+interpreter may be used to view the documentation for the Python
+interface.
+
+Examples
+--------
+
+The following sample programs may be found in the 'examples'
+subdirectory:
+
+1. kepler_test.c calls most of the functions in kepler and displays
+the results in a terminal window. To test the routines in mpc_file.c,
+you must download the MPC Orbit Database files from <http://www.cfa.harvard.edu/iau/MPCORB.html>.
+
+2. rise_set.c is a program that accepts command-line arguments and
+displays the rise, transit and setting times for the Sun, Moon,
+planets and Pluto.
+
+3. planpos. py demonstrates the Python wrapper by calling routines in
+the VSOP, ELP and Pluto modules to display the positions of the Sun,
+Moon, planets and Pluto at the time specified on the command-line.
+
+4. flightseg. py displays the great circle distance and bearing angles
+for flight segments between the airports specified on the command
+line. The airport database from <http://openflights.org/data.html>
+must be downloaded into the examples folder.
+
+References
+----------
+
+kepler is targeted towards users with a sound grasp of positional
+astronomy. However, it has been thought fit to include references to
+the relevant astronomical literature in the source code.
+
+No work of this nature would be possible without the following
+standard works on astronomical algorithms:
+
+1. Celestial Mechanics - Forest Ray Moulton
+2. Astronomical Algorithms - Jean Meeus
+3. Explanatory supplement to the Astronomical Almanac - P. K. Seidelmann
diff --git a/examples/.gitignore b/examples/.gitignore
deleted file mode 100644
index 2cc1934..0000000
--- a/examples/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.o
-kepler_test
-kepler_test.exe
-rise_set
-rise_set.exe
-*.DAT
-*.dat
-
diff --git a/pykepler/.gitignore b/pykepler/.gitignore
deleted file mode 100644
index 2f78cf5..0000000
--- a/pykepler/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.pyc
-
diff --git a/pykepler/__init__.py b/pykepler/__init__.py
index 49b775d..606ac50 100644
--- a/pykepler/__init__.py
+++ b/pykepler/__init__.py
@@ -1,5 +1,5 @@
# __init__.py - Package definition file for pykepler
-# Copyright (C) 2016 Shiva Iyer <shiva.iyer AT g m a i l DOT c o m>
+# Copyright (C) 2016-2019 Shiva Iyer <shiva.iyer AT g m a i l DOT c o m>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -52,10 +52,11 @@ from ctypes import *
# Load the kepler shared library and save for use in the pykepler
# modules. The library is operating system dependent.
+basedir = os.path.dirname(os.path.abspath(__file__))
if os.name == "posix":
- _libkepler = CDLL("libkepler.so.1")
+ _libkepler = CDLL(os.path.join(basedir, "libkepler.so"))
elif os.name == "nt":
- _libkepler = CDLL("libkepler.dll")
+ _libkepler = CDLL(os.path.join(basedir, "libkepler.dll"))
from .aberration import *
from .constants import *
@@ -92,4 +93,3 @@ for m in _modules:
__all__ += mod.__all__
except Exception:
pass
-
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..03970be
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,46 @@
+# setup.py - PyPI package creation.
+# Copyright (C) 2019 Shiva Iyer <shiva.iyer AT g m a i l DOT c o m>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import setuptools
+
+with open("README.md", "r") as fh:
+ readme = fh.read()
+
+setuptools.setup(
+ name = "pykepler",
+ version = "1.0.1",
+ author = "Shiva Iyer",
+ author_email = "[email protected]",
+ description = "Algorithms for positional astronomy",
+ long_description = readme,
+ long_description_content_type = "text/markdown",
+ url = "https://github.com/Shiva-Iyer/kepler",
+ packages = ["pykepler"],
+ include_package_data = True,
+ classifiers = [
+ "Intended Audience :: Developers",
+ "Intended Audience :: Education",
+ "Intended Audience :: Science/Research",
+ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
+ "Operating System :: POSIX",
+ "Operating System :: POSIX :: Linux",
+ "Programming Language :: C",
+ "Programming Language :: Python :: 3",
+ "Topic :: Scientific/Engineering :: Astronomy",
+ "Topic :: Scientific/Engineering :: Mathematics",
+ "Topic :: Scientific/Engineering :: Physics"
+ ],
+)
diff --git a/src/.gitignore b/src/.gitignore
deleted file mode 100644
index 3d19e45..0000000
--- a/src/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.o
-libkepler*