diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0d34bf..c00912d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,20 +2,17 @@ name: CI on: push jobs: testing: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - - python: '3.6' - - python: '3.7' - - python: '3.8' - - python: '3.9' - python: '3.10' - python: '3.11' - #- python: '3.12' # broken - no distutils - test again with SpacePy >= 0.5.0 + - python: '3.12' + - python: '3.13' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} @@ -30,8 +27,9 @@ jobs: ( cd qdipole && ./configure && make build && sudo make install && make test ) pip3 install --upgrade pip pip3 install wheel + pip3 install numpy pip3 install scipy - pip3 install spacepy --no-build-isolation + pip3 install spacepy pip3 install ./eoxmagmod/ - name: Scripts run: | @@ -40,16 +38,20 @@ jobs: pip3 show -f eoxmagmod python3 -c 'import eoxmagmod' && python3 -m unittest discover -p '[a-z]*.py' -v eoxmagmod notification: - runs-on: ubuntu-20.04 - if: ${{ always() }} + runs-on: ubuntu-latest + permissions: {} needs: testing steps: - # send Slack notifications to the eox organization + # send Slack notifications - name: action-slack - uses: 8398a7/action-slack@v3 + uses: slackapi/slack-github-action@v2.1.1 with: - status: ${{ needs.testing.result }} - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: always() + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: incoming-webhook + payload: | + text: "Workflow ${{ github.workflow }} completed with status: ${{ needs.testing.result }}" + blocks: + - type: "section" + text: + type: "mrkdwn" + text: "*Repo:* ${{ github.repository }}\n*Commit:* ${{ github.sha }}\n*Author:* ${{ github.actor }}\n*Ref:* ${{ github.ref }}\n*Status:* ${{ needs.testing.result }}" diff --git a/eoxmagmod/MANIFEST.in b/eoxmagmod/MANIFEST.in index bfe6e11..5c32f89 100644 --- a/eoxmagmod/MANIFEST.in +++ b/eoxmagmod/MANIFEST.in @@ -1,4 +1,5 @@ include MANIFEST.in +prune */__pycache__ recursive-exclude eoxmagmod *.pyc *.o recursive-include eoxmagmod *.c *.h recursive-include eoxmagmod/data *.txt *.shc *.cof *.COF diff --git a/eoxmagmod/eoxmagmod/__init__.py b/eoxmagmod/eoxmagmod/__init__.py index 89fe1a3..64f9293 100644 --- a/eoxmagmod/eoxmagmod/__init__.py +++ b/eoxmagmod/eoxmagmod/__init__.py @@ -142,7 +142,7 @@ except ImportError: pass -__version__ = '0.14.0' +__version__ = '0.15.0' __author__ = 'Martin Paces (martin.paces@eox.at)' -__copyright__ = 'Copyright (C) 2014-2024 EOX IT Services GmbH' +__copyright__ = 'Copyright (C) 2014-2026 EOX IT Services GmbH' __licence__ = 'EOX licence (MIT style)' diff --git a/eoxmagmod/eoxmagmod/pymm_cconv.h b/eoxmagmod/eoxmagmod/pymm_cconv.h index f8ab316..f9a467f 100644 --- a/eoxmagmod/eoxmagmod/pymm_cconv.h +++ b/eoxmagmod/eoxmagmod/pymm_cconv.h @@ -162,8 +162,8 @@ static PyObject* convert(PyObject *self, PyObject *args, PyObject *kwdict) goto exit; // check the type of the coordinate transformation - if (CT_INVALID == _check_coord_type(ct_in, keywords[0])) goto exit; - if (CT_INVALID == _check_coord_type(ct_out, keywords[1])) goto exit; + if (CT_INVALID == _check_coord_type(ct_in, keywords[1])) goto exit; + if (CT_INVALID == _check_coord_type(ct_out, keywords[2])) goto exit; // cast the input object to an array if (NULL == (arr_in=_get_as_double_array(obj_in, 1, 0, NPY_ARRAY_ALIGNED, keywords[0]))) diff --git a/eoxmagmod/eoxmagmod/pymm_loncossin.h b/eoxmagmod/eoxmagmod/pymm_loncossin.h index 88a9dff..7268dda 100644 --- a/eoxmagmod/eoxmagmod/pymm_loncossin.h +++ b/eoxmagmod/eoxmagmod/pymm_loncossin.h @@ -75,7 +75,6 @@ static PyObject* loncossin(PyObject *self, PyObject *args, PyObject *kwdict) goto exit; } - // cast the input object to an array if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) goto exit; diff --git a/eoxmagmod/eoxmagmod/pymm_sheval.h b/eoxmagmod/eoxmagmod/pymm_sheval.h index 61c0aa4..545a245 100644 --- a/eoxmagmod/eoxmagmod/pymm_sheval.h +++ b/eoxmagmod/eoxmagmod/pymm_sheval.h @@ -178,21 +178,21 @@ static PyObject* sheval(PyObject *self, PyObject *args, PyObject *kwdict) is_internal = (obj_is_internal == NULL) || PyObject_IsTrue(obj_is_internal); // check the type of the coordinate transformation - if (CT_INVALID == _check_coord_type(ct_in, keywords[4])) + if (CT_INVALID == _check_coord_type(ct_in, keywords[2])) goto exit; - if (CT_INVALID == _check_coord_type(ct_out, keywords[5])) + if (CT_INVALID == _check_coord_type(ct_out, keywords[3])) goto exit; // check the operation mode - if (SM_INVALID == _check_sheval_mode(mode, keywords[6])) + if (SM_INVALID == _check_sheval_mode(mode, keywords[4])) goto exit; // cast the objects to arrays if (NULL == (arr_x = _get_as_double_array(obj_x, 1, 0, NPY_ARRAY_ALIGNED, keywords[0]))) goto exit; - if (NULL == (arr_coef = _get_as_double_array(obj_coef, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_IN_ARRAY, keywords[2]))) + if (NULL == (arr_coef = _get_as_double_array(obj_coef, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_IN_ARRAY, keywords[1]))) goto exit; // extract degree from the array dimensions @@ -205,14 +205,14 @@ static PyObject* sheval(PyObject *self, PyObject *args, PyObject *kwdict) npy_intp max_degree; int arg_idx; - _get_max_degree(&arg_idx, &max_degree, degrees, ndegrees); + _get_max_degree(&arg_idx, &max_degree, degrees, ndegrees); if (max_degree < 0) { PyErr_Format( PyExc_ValueError, "Negative degree due to empty %s array!", - keywords[arg_idx+1] + keywords[1] ); goto exit; } @@ -504,7 +504,7 @@ static void _model_eval( const double (*coeff)[2], MODEL *model, const int mode ) { - double glat, glon, ghgt; + double glat = NAN, glon, ghgt; double clat, clon, crad; double flat, flon, frad; double tmp; diff --git a/eoxmagmod/eoxmagmod/pymm_sheval2dfs.h b/eoxmagmod/eoxmagmod/pymm_sheval2dfs.h index 54715fb..fb330da 100644 --- a/eoxmagmod/eoxmagmod/pymm_sheval2dfs.h +++ b/eoxmagmod/eoxmagmod/pymm_sheval2dfs.h @@ -240,10 +240,9 @@ static PyObject* sheval2dfs(PyObject *self, PyObject *args, PyObject *kwdict) } // check the last dimension of the position array - if (_check_array_dim_eq(arr_x, -1, 3, keywords[0])) + if (_check_array_dim_eq(arr_x, -1, 3, keywords[2])) goto exit; - // parse coefficient set _f2d_coefset_parse(&coefset, keywords[3], obj_coef_set); diff --git a/eoxmagmod/eoxmagmod/pymm_shevaltemp.h b/eoxmagmod/eoxmagmod/pymm_shevaltemp.h index b0f6233..3c16fdd 100644 --- a/eoxmagmod/eoxmagmod/pymm_shevaltemp.h +++ b/eoxmagmod/eoxmagmod/pymm_shevaltemp.h @@ -237,7 +237,7 @@ static PyObject* shevaltemp(PyObject *self, PyObject *args, PyObject *kwdict) for (i = 0; i < n; ++i) { - if(parse_coefset(&coefsets[i], keywords[3], i, PyList_GetItem(obj_coef_list, i))) + if(parse_coefset(&coefsets[i], keywords[2], i, PyList_GetItem(obj_coef_list, i))) goto exit; ncoefset += 1; diff --git a/eoxmagmod/eoxmagmod/pymm_sphargrd.h b/eoxmagmod/eoxmagmod/pymm_sphargrd.h index cae4c0a..7cdba3d 100644 --- a/eoxmagmod/eoxmagmod/pymm_sphargrd.h +++ b/eoxmagmod/eoxmagmod/pymm_sphargrd.h @@ -109,16 +109,16 @@ static PyObject* sphargrd(PyObject *self, PyObject *args, PyObject *kwdict) if (NULL == (arr_coef = _get_as_double_array(obj_coef, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[1]))) goto exit; - if (NULL == (arr_lp = _get_as_double_array(obj_lp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[3]))) + if (NULL == (arr_lp = _get_as_double_array(obj_lp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[2]))) goto exit; - if (NULL == (arr_ldp = _get_as_double_array(obj_ldp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[4]))) + if (NULL == (arr_ldp = _get_as_double_array(obj_ldp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[3]))) goto exit; - if (NULL == (arr_rrp = _get_as_double_array(obj_rrp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[5]))) + if (NULL == (arr_rrp = _get_as_double_array(obj_rrp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[4]))) goto exit; - if (NULL == (arr_lcs = _get_as_double_array(obj_lcs, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[6]))) + if (NULL == (arr_lcs = _get_as_double_array(obj_lcs, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[5]))) goto exit; // extract degree from the array dimensions diff --git a/eoxmagmod/eoxmagmod/pymm_vrot_cart2sph.h b/eoxmagmod/eoxmagmod/pymm_vrot_cart2sph.h index 1b1bbf4..7e4c55d 100644 --- a/eoxmagmod/eoxmagmod/pymm_vrot_cart2sph.h +++ b/eoxmagmod/eoxmagmod/pymm_vrot_cart2sph.h @@ -92,6 +92,7 @@ static void _vrot_cart2sph(ARRAY_DATA ad_i, ARRAY_DATA ad_lat, static PyObject* vrot_cart2sph(PyObject *self, PyObject *args, PyObject *kwdict) { static char *keywords[] = {"arr_in", "arr_lat", "arr_lon", NULL}; + PyObject *obj_in = NULL; // input object PyObject *obj_lat = NULL; // input object PyObject *obj_lon = NULL; // input object diff --git a/eoxmagmod/eoxmagmod/pymm_vrot_sph2cart.h b/eoxmagmod/eoxmagmod/pymm_vrot_sph2cart.h index 4e8a9b8..fbb496e 100644 --- a/eoxmagmod/eoxmagmod/pymm_vrot_sph2cart.h +++ b/eoxmagmod/eoxmagmod/pymm_vrot_sph2cart.h @@ -92,6 +92,7 @@ static void _vrot_sph2cart(ARRAY_DATA ad_i, ARRAY_DATA ad_lat, static PyObject* vrot_sph2cart(PyObject *self, PyObject *args, PyObject *kwdict) { static char *keywords[] = {"arr_in", "arr_lat", "arr_lon", NULL}; + PyObject *obj_in = NULL; // input object PyObject *obj_lat = NULL; // input object PyObject *obj_lon = NULL; // input object diff --git a/eoxmagmod/eoxmagmod/pymm_vrot_sph2geod.h b/eoxmagmod/eoxmagmod/pymm_vrot_sph2geod.h index 99c204d..932509c 100644 --- a/eoxmagmod/eoxmagmod/pymm_vrot_sph2geod.h +++ b/eoxmagmod/eoxmagmod/pymm_vrot_sph2geod.h @@ -88,6 +88,7 @@ static void _vrot_sph2geod(ARRAY_DATA ad_i, ARRAY_DATA ad_dlat, static PyObject* vrot_sph2geod(PyObject *self, PyObject *args, PyObject *kwdict) { static char *keywords[] = {"arr_in", "arr_dlat", NULL}; + PyObject *obj_in = NULL; // input object PyObject *obj_dlat = NULL; // input object PyArrayObject *arr_in = NULL; // input array diff --git a/eoxmagmod/eoxmagmod/pyqd_eval_mlt.h b/eoxmagmod/eoxmagmod/pyqd_eval_mlt.h index 6483fbd..268f453 100644 --- a/eoxmagmod/eoxmagmod/pyqd_eval_mlt.h +++ b/eoxmagmod/eoxmagmod/pyqd_eval_mlt.h @@ -66,17 +66,17 @@ static PyObject* eval_mlt(PyObject *self, PyObject *args, PyObject *kwdict) #define NPY_REQ (NPY_ARRAY_ALIGNED|NPY_ARRAY_C_CONTIGUOUS) // cast the objects to arrays - if (NULL == (arr_qdlon = _get_as_double_array(obj_qdlon, 0, 1, NPY_REQ, keywords[1]))) + if (NULL == (arr_qdlon = _get_as_double_array(obj_qdlon, 0, 1, NPY_REQ, keywords[0]))) goto exit; - if (NULL == (arr_time = _get_as_double_array(obj_time, 0, 1, NPY_REQ, keywords[3]))) + if (NULL == (arr_time = _get_as_double_array(obj_time, 0, 1, NPY_REQ, keywords[1]))) goto exit; // check the dimensions npy_intp ndim = PyArray_NDIM(arr_qdlon); npy_intp *dims = PyArray_DIMS(arr_qdlon); - if(_check_arr_dims_all_eq(arr_time, ndim, dims, keywords[3])) + if(_check_arr_dims_all_eq(arr_time, ndim, dims, keywords[1])) goto exit; // create the output arrays diff --git a/eoxmagmod/eoxmagmod/pyqd_eval_qdlatlon.h b/eoxmagmod/eoxmagmod/pyqd_eval_qdlatlon.h index 8e7f8e7..d7470a3 100644 --- a/eoxmagmod/eoxmagmod/pyqd_eval_qdlatlon.h +++ b/eoxmagmod/eoxmagmod/pyqd_eval_qdlatlon.h @@ -241,4 +241,3 @@ static PyObject* eval_qdlatlon(PyObject *self, PyObject *args, PyObject *kwdict) } #endif /* PYQD_EVAL_QDLATLON_H */ - diff --git a/eoxmagmod/eoxmagmod/pyqd_eval_subsol.h b/eoxmagmod/eoxmagmod/pyqd_eval_subsol.h index a65a110..ff9a56d 100644 --- a/eoxmagmod/eoxmagmod/pyqd_eval_subsol.h +++ b/eoxmagmod/eoxmagmod/pyqd_eval_subsol.h @@ -111,5 +111,3 @@ static PyObject* eval_subsol(PyObject *self, PyObject *args, PyObject *kwdict) } #endif /* PYQD_EVAL_SUBSOL_H */ - - diff --git a/eoxmagmod/eoxmagmod/pysunpos.h b/eoxmagmod/eoxmagmod/pysunpos.h index ef80ed9..5fce7d8 100644 --- a/eoxmagmod/eoxmagmod/pysunpos.h +++ b/eoxmagmod/eoxmagmod/pysunpos.h @@ -124,6 +124,7 @@ static void _sunpos( static PyObject* pysunpos_sunpos(PyObject *self, PyObject *args, PyObject *kwdict) { static char *keywords[] = {"time_mjd2k", "lat", "lon", "rad", "dtt", NULL}; + PyObject *obj_mjd = NULL; PyObject *obj_lat = NULL; PyObject *obj_lon = NULL; @@ -150,16 +151,16 @@ static PyObject* pysunpos_sunpos(PyObject *self, PyObject *args, PyObject *kwdic if (NULL == (arr_mjd = _get_as_double_array(obj_mjd, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) goto exit; - if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[1]))) goto exit; - if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[2]))) goto exit; - if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[3]))) goto exit; - if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[4]))) goto exit; // check the array dimensions and allocate the output array diff --git a/eoxmagmod/eoxmagmod/pysunpos_original.h b/eoxmagmod/eoxmagmod/pysunpos_original.h index 0435cff..bd7e6f8 100644 --- a/eoxmagmod/eoxmagmod/pysunpos_original.h +++ b/eoxmagmod/eoxmagmod/pysunpos_original.h @@ -169,22 +169,22 @@ static PyObject* pysunpos_sunpos_original(PyObject *self, PyObject *args, PyObje if (NULL == (arr_mjd = _get_as_double_array(obj_mjd, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) goto exit; - if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[1]))) goto exit; - if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[2]))) goto exit; - if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[3]))) goto exit; - if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[4]))) goto exit; - if (NULL == (arr_pres = _get_as_double_array(obj_pres, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_pres = _get_as_double_array(obj_pres, 0, 0, NPY_ARRAY_ALIGNED, keywords[5]))) goto exit; - if (NULL == (arr_temp = _get_as_double_array(obj_temp, 0, 0, NPY_ARRAY_ALIGNED, keywords[0]))) + if (NULL == (arr_temp = _get_as_double_array(obj_temp, 0, 0, NPY_ARRAY_ALIGNED, keywords[6]))) goto exit; // check the array dimensions and allocate the output array diff --git a/eoxmagmod/eoxmagmod/version.h b/eoxmagmod/eoxmagmod/version.h index 5964a6b..f633b6b 100644 --- a/eoxmagmod/eoxmagmod/version.h +++ b/eoxmagmod/eoxmagmod/version.h @@ -28,5 +28,5 @@ */ #ifndef VERSION -#define VERSION "0.14.0" +#define VERSION "0.15.0" #endif diff --git a/eoxmagmod/pyproject.toml b/eoxmagmod/pyproject.toml new file mode 100644 index 0000000..0d70152 --- /dev/null +++ b/eoxmagmod/pyproject.toml @@ -0,0 +1,54 @@ +[build-system] + requires = ["setuptools>=61.0.0", "numpy>=1.13.0", "wheel"] + build-backend = "setuptools.build_meta" + +[project] + name = "eoxmagmod" + dynamic = ["version"] + description="Geomagnetic model evaluation and Earth magnetic field utilities." + authors = [ + {name = "Martin Paces", email = "martin.paces@eox.at"}, + ] + license = "MIT" + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Operating System :: POSIX", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Utilities", + ] + requires-python = ">=3.10" + dependencies = [ + "numpy>=1.13.0", + "spacepy", + ] + +[tool.setuptools] + include-package-data = false + packages=[ + "eoxmagmod", + "eoxmagmod.data", + "eoxmagmod.tests", + "eoxmagmod.tests.data", + "eoxmagmod.magnetic_model", + "eoxmagmod.magnetic_model.tests", + "eoxmagmod.magnetic_model.tests.data", + ] + +[tool.setuptools.package-data] + eoxmagmod = [ + "data/*", + "tests/data/*.tsv", + "magnetic_model/tests/data/*.txt", + "magnetic_model/tests/data/*.cdf", + ] + +[tool.setuptools.dynamic] + version = {attr = "eoxmagmod.__version__"} diff --git a/eoxmagmod/setup.cfg b/eoxmagmod/setup.cfg deleted file mode 100644 index 4ab6f8a..0000000 --- a/eoxmagmod/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[bdist_rpm] -requires=python spacepy numpy qdipole >= 0.2.0 -provides=EOxMagMod eoxmagmod python-eoxmagmod -release=1 diff --git a/eoxmagmod/setup.py b/eoxmagmod/setup.py index d783a3d..cf7a2e8 100644 --- a/eoxmagmod/setup.py +++ b/eoxmagmod/setup.py @@ -30,67 +30,27 @@ import sys from os.path import join -from distutils.core import setup -from distutils.extension import Extension -import eoxmagmod +from setuptools import setup, Extension +import numpy +# NOTE: currently, there seems to be no way how to dynamically +# generate include paths with setuptools and pyproject.toml + COMMON_INCLUDE_DIRS = [ './eoxmagmod', './eoxmagmod/include', join(sys.prefix, 'include'), ] -try: - import numpy - COMMON_INCLUDE_DIRS.append(numpy.get_include()) -except ImportError: - pass +COMMON_LIBRARY_DIRS = [ + join(sys.prefix, 'lib'), +] + +COMMON_INCLUDE_DIRS.append(numpy.get_include()) + setup( - name="eoxmagmod", - description="Earth magnetic field utilities.", - author="Martin Paces", - author_email="martin.paces@eox.at", - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', - 'Operating System :: POSIX', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: Implementation :: CPython', - 'Topic :: Scientific/Engineering :: Physics', - 'Topic :: Utilities', - ], - install_requires=[ - 'numpy>=1.13.0', - 'spacepy', - ], - packages=[ - 'eoxmagmod', - 'eoxmagmod.data', - 'eoxmagmod.tests', - 'eoxmagmod.tests.data', - 'eoxmagmod.magnetic_model', - 'eoxmagmod.magnetic_model.tests', - 'eoxmagmod.magnetic_model.tests.data', - ], - license='EOX licence (MIT style)', - version=eoxmagmod.__version__, - package_data={ - 'eoxmagmod': [ - 'data/*', - 'tests/data/*.tsv', - 'magnetic_model/tests/data/*.txt', - 'magnetic_model/tests/data/*.cdf', - ], - }, ext_modules=[ Extension( 'eoxmagmod._pymm', @@ -107,7 +67,7 @@ 'eoxmagmod/pyqd.c', ], libraries=['qdipole'], - library_dirs=[], + library_dirs=COMMON_LIBRARY_DIRS, include_dirs=COMMON_INCLUDE_DIRS, ), Extension(