From 3c870b0630037866377334386ec7675007e99af6 Mon Sep 17 00:00:00 2001 From: "emthompson@usgs.gov" Date: Thu, 17 Dec 2020 21:00:26 -0700 Subject: [PATCH 1/3] Apply winpi.patch --- gmprocess/metrics/cfuncs.c | 1 + setup.py | 10 +++-- setup.py.orig | 89 ++++++++++++++++++++++++++++++++++++++ uN | 51 ++++++++++++++++++++++ 4 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 setup.py.orig create mode 100644 uN diff --git a/gmprocess/metrics/cfuncs.c b/gmprocess/metrics/cfuncs.c index c768eb5a7..35685c204 100644 --- a/gmprocess/metrics/cfuncs.c +++ b/gmprocess/metrics/cfuncs.c @@ -1,3 +1,4 @@ +#define _USE_MATH_DEFINES #include #include "cfuncs.h" diff --git a/setup.py b/setup.py index 05617c05d..5919b6fce 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ -# from distutils.core import setup +import os from distutils.extension import Extension from Cython.Distutils import build_ext from Cython.Build import cythonize @@ -12,16 +12,20 @@ ko_sourcefiles = ["gmprocess/waveform_processing/smoothing/konno_ohmachi.pyx", "gmprocess/waveform_processing/smoothing/smoothing.c"] +libraries = [] +if os.name == 'posix': + libraries.append('m') + ext_modules = [ Extension( "gmprocess.metrics.oscillators", sourcefiles, - libraries=["m"], + libraries=libraries, include_dirs=[numpy.get_include()]), Extension( "gmprocess.waveform_processing.smoothing.konno_ohmachi", ko_sourcefiles, - libraries=["m"], + libraries=libraries, include_dirs=[numpy.get_include()]) ] diff --git a/setup.py.orig b/setup.py.orig new file mode 100644 index 000000000..05617c05d --- /dev/null +++ b/setup.py.orig @@ -0,0 +1,89 @@ + +# from distutils.core import setup +from distutils.extension import Extension +from Cython.Distutils import build_ext +from Cython.Build import cythonize +from setuptools import setup +import glob +import numpy + +sourcefiles = ["gmprocess/metrics/oscillators.pyx", + "gmprocess/metrics/cfuncs.c"] +ko_sourcefiles = ["gmprocess/waveform_processing/smoothing/konno_ohmachi.pyx", + "gmprocess/waveform_processing/smoothing/smoothing.c"] + +ext_modules = [ + Extension( + "gmprocess.metrics.oscillators", + sourcefiles, + libraries=["m"], + include_dirs=[numpy.get_include()]), + Extension( + "gmprocess.waveform_processing.smoothing.konno_ohmachi", + ko_sourcefiles, + libraries=["m"], + include_dirs=[numpy.get_include()]) +] + +setup( + name='gmprocess', + description='USGS Automated Ground Motion Processing Software', + include_package_data=True, + author=('Mike Hearne, Eric Thompson, ' + 'Heather Schovanec, John Rekoske, ' + 'Brad Aagaard, Bruce Worden'), + author_email=('mhearne@usgs.gov, emthompson@usgs.gov, ' + 'hschovanec@usgs.gov, jrekoske@usgs.gov, ' + 'baagaard@usgs.gov, cbworden@contractor.usgs.gov'), + url='https://github.com/usgs/groundmotion-processing', + use_scm_version={ + "write_to": "gmprocess/_version.py", + "write_to_template": '__version__ = "{version}"', + "tag_regex": r"^(?Pv)?(?P[^\+]+)(?P.*)?$", + }, + packages=[ + 'gmprocess', + 'gmprocess.bin', + 'gmprocess.core', + 'gmprocess.io', + 'gmprocess.io.asdf', + 'gmprocess.io.bhrc', + 'gmprocess.io.esm', + 'gmprocess.io.obspy', + 'gmprocess.io.nsmn', + 'gmprocess.io.cwb', + 'gmprocess.io.dmg', + 'gmprocess.io.geonet', + 'gmprocess.io.knet', + 'gmprocess.io.cosmos', + 'gmprocess.io.renadic', + 'gmprocess.io.smc', + 'gmprocess.io.unam', + 'gmprocess.io.usc', + 'gmprocess.metrics', + 'gmprocess.metrics.imt', + 'gmprocess.metrics.imc', + 'gmprocess.metrics.rotation', + 'gmprocess.metrics.combination', + 'gmprocess.metrics.transform', + 'gmprocess.metrics.reduction', + 'gmprocess.utils', + 'gmprocess.waveform_processing', + 'gmprocess.waveform_processing.smoothing' + ], + package_data={ + 'gmprocess': + glob.glob('gmprocess/data/**', recursive=True) + }, + entry_points={ + 'console_scripts': [ + 'gmconvert = gmprocess.bin.gmconvert:main', + 'gminfo = gmprocess.bin.gminfo:main', + 'gmprocess = gmprocess.bin.gmprocess:main', + 'gmsetup = gmprocess.bin.gmsetup:main', + 'gmworkspace = gmprocess.bin.gmworkspace:main', + 'list_metrics = gmprocess.bin.list_metrics:main' + ] + }, + ext_modules=cythonize(ext_modules) +) diff --git a/uN b/uN new file mode 100644 index 000000000..a249bf78a --- /dev/null +++ b/uN @@ -0,0 +1,51 @@ +*************** +*** 1,3 **** + import versioneer + from distutils.core import setup + from distutils.extension import Extension +--- 1,4 ---- ++ import os + import versioneer + from distutils.core import setup + from distutils.extension import Extension +*************** +*** 11,26 **** + ko_sourcefiles = ["gmprocess/smoothing/konno_ohmachi.pyx", + "gmprocess/smoothing/smoothing.c"] + + ext_modules = [ + Extension( + "gmprocess.metrics.oscillators", + sourcefiles, +- libraries=["m"], + include_dirs=[numpy.get_include()]), + Extension( + "gmprocess.smoothing.konno_ohmachi", + ko_sourcefiles, +- libraries=["m"], + include_dirs=[numpy.get_include()]) + ] + +--- 12,33 ---- + ko_sourcefiles = ["gmprocess/smoothing/konno_ohmachi.pyx", + "gmprocess/smoothing/smoothing.c"] + ++ ++ libraries = [] ++ if os.name == 'posix': ++ libraries.append('m') ++ ++ + ext_modules = [ + Extension( + "gmprocess.metrics.oscillators", + sourcefiles, ++ libraries=libraries, + include_dirs=[numpy.get_include()]), + Extension( + "gmprocess.smoothing.konno_ohmachi", + ko_sourcefiles, ++ libraries=libraries, + include_dirs=[numpy.get_include()]) + ] + From ce9882a0cbce6182ca662c389d2f630122e3e18d Mon Sep 17 00:00:00 2001 From: Eric Thompson Date: Thu, 17 Dec 2020 21:03:40 -0700 Subject: [PATCH 2/3] Delete uN --- uN | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 uN diff --git a/uN b/uN deleted file mode 100644 index a249bf78a..000000000 --- a/uN +++ /dev/null @@ -1,51 +0,0 @@ -*************** -*** 1,3 **** - import versioneer - from distutils.core import setup - from distutils.extension import Extension ---- 1,4 ---- -+ import os - import versioneer - from distutils.core import setup - from distutils.extension import Extension -*************** -*** 11,26 **** - ko_sourcefiles = ["gmprocess/smoothing/konno_ohmachi.pyx", - "gmprocess/smoothing/smoothing.c"] - - ext_modules = [ - Extension( - "gmprocess.metrics.oscillators", - sourcefiles, -- libraries=["m"], - include_dirs=[numpy.get_include()]), - Extension( - "gmprocess.smoothing.konno_ohmachi", - ko_sourcefiles, -- libraries=["m"], - include_dirs=[numpy.get_include()]) - ] - ---- 12,33 ---- - ko_sourcefiles = ["gmprocess/smoothing/konno_ohmachi.pyx", - "gmprocess/smoothing/smoothing.c"] - -+ -+ libraries = [] -+ if os.name == 'posix': -+ libraries.append('m') -+ -+ - ext_modules = [ - Extension( - "gmprocess.metrics.oscillators", - sourcefiles, -+ libraries=libraries, - include_dirs=[numpy.get_include()]), - Extension( - "gmprocess.smoothing.konno_ohmachi", - ko_sourcefiles, -+ libraries=libraries, - include_dirs=[numpy.get_include()]) - ] - From 881bea53b4d4e2687119d3618638b5612aa5dd2f Mon Sep 17 00:00:00 2001 From: Eric Thompson Date: Thu, 17 Dec 2020 21:04:04 -0700 Subject: [PATCH 3/3] Delete setup.py.orig --- setup.py.orig | 89 --------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 setup.py.orig diff --git a/setup.py.orig b/setup.py.orig deleted file mode 100644 index 05617c05d..000000000 --- a/setup.py.orig +++ /dev/null @@ -1,89 +0,0 @@ - -# from distutils.core import setup -from distutils.extension import Extension -from Cython.Distutils import build_ext -from Cython.Build import cythonize -from setuptools import setup -import glob -import numpy - -sourcefiles = ["gmprocess/metrics/oscillators.pyx", - "gmprocess/metrics/cfuncs.c"] -ko_sourcefiles = ["gmprocess/waveform_processing/smoothing/konno_ohmachi.pyx", - "gmprocess/waveform_processing/smoothing/smoothing.c"] - -ext_modules = [ - Extension( - "gmprocess.metrics.oscillators", - sourcefiles, - libraries=["m"], - include_dirs=[numpy.get_include()]), - Extension( - "gmprocess.waveform_processing.smoothing.konno_ohmachi", - ko_sourcefiles, - libraries=["m"], - include_dirs=[numpy.get_include()]) -] - -setup( - name='gmprocess', - description='USGS Automated Ground Motion Processing Software', - include_package_data=True, - author=('Mike Hearne, Eric Thompson, ' - 'Heather Schovanec, John Rekoske, ' - 'Brad Aagaard, Bruce Worden'), - author_email=('mhearne@usgs.gov, emthompson@usgs.gov, ' - 'hschovanec@usgs.gov, jrekoske@usgs.gov, ' - 'baagaard@usgs.gov, cbworden@contractor.usgs.gov'), - url='https://github.com/usgs/groundmotion-processing', - use_scm_version={ - "write_to": "gmprocess/_version.py", - "write_to_template": '__version__ = "{version}"', - "tag_regex": r"^(?Pv)?(?P[^\+]+)(?P.*)?$", - }, - packages=[ - 'gmprocess', - 'gmprocess.bin', - 'gmprocess.core', - 'gmprocess.io', - 'gmprocess.io.asdf', - 'gmprocess.io.bhrc', - 'gmprocess.io.esm', - 'gmprocess.io.obspy', - 'gmprocess.io.nsmn', - 'gmprocess.io.cwb', - 'gmprocess.io.dmg', - 'gmprocess.io.geonet', - 'gmprocess.io.knet', - 'gmprocess.io.cosmos', - 'gmprocess.io.renadic', - 'gmprocess.io.smc', - 'gmprocess.io.unam', - 'gmprocess.io.usc', - 'gmprocess.metrics', - 'gmprocess.metrics.imt', - 'gmprocess.metrics.imc', - 'gmprocess.metrics.rotation', - 'gmprocess.metrics.combination', - 'gmprocess.metrics.transform', - 'gmprocess.metrics.reduction', - 'gmprocess.utils', - 'gmprocess.waveform_processing', - 'gmprocess.waveform_processing.smoothing' - ], - package_data={ - 'gmprocess': - glob.glob('gmprocess/data/**', recursive=True) - }, - entry_points={ - 'console_scripts': [ - 'gmconvert = gmprocess.bin.gmconvert:main', - 'gminfo = gmprocess.bin.gminfo:main', - 'gmprocess = gmprocess.bin.gmprocess:main', - 'gmsetup = gmprocess.bin.gmsetup:main', - 'gmworkspace = gmprocess.bin.gmworkspace:main', - 'list_metrics = gmprocess.bin.list_metrics:main' - ] - }, - ext_modules=cythonize(ext_modules) -)