forked from pyrocko/pyrocko
parent
befb5a64ec
commit
fa28a350e0
@ -1,5 +0,0 @@
|
||||
---
|
||||
linters:
|
||||
flake8:
|
||||
python: 3
|
||||
|
@ -1,93 +0,0 @@
|
||||
language: python
|
||||
|
||||
cache:
|
||||
pip: true
|
||||
directories:
|
||||
- $TRAVIS_BUILD_DIR/pyrocko/test/data
|
||||
|
||||
env:
|
||||
global:
|
||||
- OMP_NUM_THREADS=2
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
python: 2.7
|
||||
virtualenv:
|
||||
system_site_packages: true
|
||||
dist: precise
|
||||
# - os: osx
|
||||
# osx_image: xcode7.3
|
||||
# language: generic
|
||||
# allow_failures:
|
||||
# - os: osx
|
||||
#
|
||||
addons:
|
||||
apt:
|
||||
packages: [ python-qt4, python-qt4-gl, python-qt4-dev, python-dev,
|
||||
gfortran, libatlas-dev, libopenblas-dev,
|
||||
python-yaml, python-tk, libyaml-dev,
|
||||
poppler-utils, ghostscript, imagemagick, xvfb,
|
||||
libssl1.0.0 ]
|
||||
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew tap homebrew/science; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew tap homebrew/python; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink libyaml; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc libyaml; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install matplotlib; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then xcode-select --install || true ; fi
|
||||
- pip install --upgrade pip setuptools wheel
|
||||
- pip install --only-binary=numpy,scipy,matplotlib scipy numpy matplotlib
|
||||
- pip install progressbar setuptools flake8 pyyaml coveralls jinja2 future coverage nose
|
||||
|
||||
- git clone https://github.com/pyrocko/fomosto-qseis
|
||||
- cd fomosto-qseis; autoreconf -i; ./configure; make; export PATH=$PATH:`pwd`/src; cd ..
|
||||
|
||||
- git clone https://github.com/pyrocko/fomosto-qseis2d
|
||||
- cd fomosto-qseis2d; autoreconf -i; ./configure; make; export PATH=$PATH:`pwd`/src/r:`pwd`/src/s; cd ..
|
||||
|
||||
- git clone https://github.com/pyrocko/fomosto-psgrn-pscmp
|
||||
- cd fomosto-psgrn-pscmp; autoreconf -i; ./configure; make; export PATH=$PATH:`pwd`/src/psgrn:`pwd`/src/pscmp; cd ..
|
||||
|
||||
- git clone https://github.com/pyrocko/fomosto-qssp.git
|
||||
- cd fomosto-qssp; autoreconf -i; ./configure; make; export PATH=$PATH:`pwd`/src; cd ..
|
||||
|
||||
before_script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then flake8 src/ test/ ; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0 ; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh -e /etc/init.d/xvfb start ; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sleep 3 ; fi
|
||||
|
||||
install:
|
||||
- pip install .
|
||||
|
||||
script:
|
||||
- travis_wait nosetests run --with-coverage --cover-package=pyrocko test/
|
||||
|
||||
after_success:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then coveralls; fi
|
||||
|
||||
|
||||
deploy:
|
||||
- provider: pypi
|
||||
user: pyrocko
|
||||
password:
|
||||
secure: "crUt0q8F1oSgG5nzfpjd8bmBtHpVWXZE/qYVRlniux4X7tkO6GnW1rZpE2iBJxjEd3ADmgGZwFKj5215HHOZlcxFVQ/w8BnpI9WCkEaph0kA1I+aIrZg+fzpyEcskQ5Nzg1YQIcN/5wVEwmSZtK55gZyFccZMjqZQTkMJiJHZUGT1SyMYlFtoZ508lXtRxhC1EqhBSUa67KIaZoyA1BTgNEFzRNHCqquyb0dalbaiMfpl3UVxzPkik+L9yIUUc/xKC5NRWwAJY6xT7Qf+lvTC1MTSaNva0TG4PpZ5Zfr/N9HuJXXNTToRAd39tSSypt6TeIvOKA7caD6QNWzioQwA86mjskR1GgRTYo1yEAJApBbHtRWvZvp0noSTYcRtb4XDWc5J1L0vxRsvmPmrSUNLmYDrPz++G2HO+ZrJhjuCme8d6RRMpj5/k2TAnpx0PnjoLLnb9QLoe/U26CbmCQDTLSiXcC0g6jo3Wxyx37truWuG2M2Sh1vmV2qnJVi12FkOg6vJhtvIMvLU1M1kPCiAVcIGO9x4IU+tU/vV5LoNuuqEZT+fRJBtqbMH3LpRMRsMrB/ZRCJ2XnJIsRvkd6ibWYQkmk2L37R8OnNc7y7mI9N4iR158KPmcSL5Ft7LtV+J+42uAgWSolHlpvksBp3ZzIOMfofSRysr7vWmtqCK2U="
|
||||
on:
|
||||
all_branches: true
|
||||
# branch: master
|
||||
# tags: true
|
||||
distributions: "sdist bdist_wheel"
|
||||
server: https://test.pypi.org/legacy/
|
||||
|
||||
- provider: script
|
||||
script: maintenance/anaconda_deploy.sh
|
||||
on:
|
||||
all_branches: true
|
||||
# branch: master
|
||||
# tags: true
|
||||
|
||||
notifications:
|
||||
email: false
|
@ -1,5 +0,0 @@
|
||||
FROM debian:stable
|
||||
|
||||
RUN apt-get update -y
|
||||
RUN apt-get upgrade -y
|
||||
RUN apt-get install -y rsync git python3-pip xvfb libgles2-mesa libfontconfig1 libxrender1 libxkbcommon-x11-0 python3-requests
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
docker build nest -t pyrocko-nest
|
||||
docker build docs -t pyrocko-docs
|
||||
docker build aux -t pyrocko-aux
|
||||
docker build util -t pyrocko-util
|
||||
docker build pyrocko -t pyrocko
|
||||
|
@ -0,0 +1,182 @@
|
||||
diff -ruN libmseed/libmseed.h libmseed_mod/libmseed.h
|
||||
--- libmseed/libmseed.h 2019-06-19 10:59:29.000000000 +0200
|
||||
+++ libmseed_mod/libmseed.h 2021-04-09 09:44:41.881346528 +0200
|
||||
@@ -511,6 +511,7 @@
|
||||
double samprate; /* Nominal sample rate (Hz) */
|
||||
int64_t samplecnt; /* Number of samples in trace coverage */
|
||||
void *datasamples; /* Data samples, 'numsamples' of type 'sampletype' */
|
||||
+ size_t bufsize;
|
||||
int64_t numsamples; /* Number of data samples in datasamples */
|
||||
char sampletype; /* Sample type code: a, i, f, d */
|
||||
void *prvtptr; /* Private pointer for general use, unused by libmseed */
|
||||
diff -ruN libmseed/Makefile.win libmseed_mod/Makefile.win
|
||||
--- libmseed/Makefile.win 2019-06-19 10:59:29.000000000 +0200
|
||||
+++ libmseed_mod/Makefile.win 2021-04-09 09:44:41.881346528 +0200
|
||||
@@ -5,9 +5,10 @@
|
||||
NODEBUG=1
|
||||
|
||||
INCS = -I.
|
||||
-OPTS = -D_CRT_SECURE_NO_WARNINGS
|
||||
+OPTS = -D_CRT_SECURE_NO_WARNINGS -DWIN32
|
||||
LIB = libmseed.lib
|
||||
DLL = libmseed.dll
|
||||
+CFLAGS = /Ox
|
||||
|
||||
OBJS= fileutils.obj \
|
||||
genutils.obj \
|
||||
diff -ruN libmseed/traceutils.c libmseed_mod/traceutils.c
|
||||
--- libmseed/traceutils.c 2019-06-19 10:59:29.000000000 +0200
|
||||
+++ libmseed_mod/traceutils.c 2021-04-09 09:44:41.881346528 +0200
|
||||
@@ -437,6 +437,7 @@
|
||||
mst_addmsr (MSTrace *mst, MSRecord *msr, flag whence)
|
||||
{
|
||||
int samplesize = 0;
|
||||
+ size_t min_size;
|
||||
|
||||
if (!mst || !msr)
|
||||
return -1;
|
||||
@@ -465,13 +466,16 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
- mst->datasamples = realloc (mst->datasamples,
|
||||
- (size_t) (mst->numsamples * samplesize + msr->numsamples * samplesize));
|
||||
+ min_size = (size_t) (mst->numsamples * samplesize + msr->numsamples * samplesize);
|
||||
|
||||
- if (mst->datasamples == NULL)
|
||||
- {
|
||||
- ms_log (2, "mst_addmsr(): Cannot allocate memory\n");
|
||||
- return -1;
|
||||
+ if (min_size > mst->bufsize) {
|
||||
+ mst->datasamples = realloc (mst->datasamples, min_size*2);
|
||||
+ if (mst->datasamples == NULL)
|
||||
+ {
|
||||
+ ms_log (2, "mst_addmsr(): Cannot allocate memory\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ mst->bufsize = min_size*2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,6 +552,7 @@
|
||||
flag whence)
|
||||
{
|
||||
int samplesize = 0;
|
||||
+ size_t min_size;
|
||||
|
||||
if (!mst)
|
||||
return -1;
|
||||
@@ -568,13 +573,15 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
- mst->datasamples = realloc (mst->datasamples,
|
||||
- (size_t) (mst->numsamples * samplesize + numsamples * samplesize));
|
||||
-
|
||||
- if (mst->datasamples == NULL)
|
||||
- {
|
||||
- ms_log (2, "mst_addspan(): Cannot allocate memory\n");
|
||||
- return -1;
|
||||
+ min_size = (size_t) (mst->numsamples * samplesize + numsamples * samplesize);
|
||||
+ if (min_size > mst->bufsize) {
|
||||
+ mst->datasamples = realloc (mst->datasamples, min_size*2);
|
||||
+ if (mst->datasamples == NULL)
|
||||
+ {
|
||||
+ ms_log (2, "mst_addspan(): Cannot allocate memory\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ mst->bufsize = min_size*2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1108,6 +1115,7 @@
|
||||
float *fdata;
|
||||
double *ddata;
|
||||
int64_t idx;
|
||||
+ size_t bufsize;
|
||||
|
||||
if (!mst)
|
||||
return -1;
|
||||
@@ -1160,11 +1168,13 @@
|
||||
}
|
||||
|
||||
/* Reallocate buffer for reduced size needed */
|
||||
- if (!(mst->datasamples = realloc (mst->datasamples, (size_t) (mst->numsamples * sizeof (int32_t)))))
|
||||
+ bufsize = (size_t) (mst->numsamples * sizeof (int32_t));
|
||||
+ if (!(mst->datasamples = realloc (mst->datasamples, bufsize)))
|
||||
{
|
||||
ms_log (2, "mst_convertsamples: cannot re-allocate buffer for sample conversion\n");
|
||||
return -1;
|
||||
}
|
||||
+ mst->bufsize = bufsize;
|
||||
}
|
||||
|
||||
mst->sampletype = 'i';
|
||||
@@ -1184,11 +1194,13 @@
|
||||
fdata[idx] = (float)ddata[idx];
|
||||
|
||||
/* Reallocate buffer for reduced size needed */
|
||||
- if (!(mst->datasamples = realloc (mst->datasamples, (size_t) (mst->numsamples * sizeof (float)))))
|
||||
+ bufsize = (size_t) (mst->numsamples * sizeof (float));
|
||||
+ if (!(mst->datasamples = realloc (mst->datasamples, bufsize)))
|
||||
{
|
||||
ms_log (2, "mst_convertsamples: cannot re-allocate buffer after sample conversion\n");
|
||||
return -1;
|
||||
}
|
||||
+ mst->bufsize = bufsize;
|
||||
}
|
||||
|
||||
mst->sampletype = 'f';
|
||||
@@ -1197,7 +1209,8 @@
|
||||
/* Convert to 64-bit doubles */
|
||||
else if (type == 'd')
|
||||
{
|
||||
- if (!(ddata = (double *)malloc ((size_t) (mst->numsamples * sizeof (double)))))
|
||||
+ bufsize = (size_t) (mst->numsamples * sizeof (double));
|
||||
+ if (!(ddata = (double *)malloc (bufsize)))
|
||||
{
|
||||
ms_log (2, "mst_convertsamples: cannot allocate buffer for sample conversion to doubles\n");
|
||||
return -1;
|
||||
@@ -1219,6 +1232,7 @@
|
||||
}
|
||||
|
||||
mst->datasamples = ddata;
|
||||
+ mst->bufsize = bufsize;
|
||||
mst->sampletype = 'd';
|
||||
} /* Done converting to 64-bit doubles */
|
||||
|
||||
@@ -1659,7 +1673,7 @@
|
||||
int trpackedrecords = 0;
|
||||
int64_t trpackedsamples = 0;
|
||||
int samplesize;
|
||||
- int64_t bufsize;
|
||||
+ size_t bufsize;
|
||||
|
||||
hptime_t preservestarttime = 0;
|
||||
double preservesamprate = 0.0;
|
||||
@@ -1745,21 +1759,22 @@
|
||||
mst->starttime = msr->starttime;
|
||||
|
||||
samplesize = ms_samplesize (mst->sampletype);
|
||||
- bufsize = (mst->numsamples - trpackedsamples) * samplesize;
|
||||
+ bufsize = (size_t) (mst->numsamples - trpackedsamples) * samplesize;
|
||||
|
||||
if (bufsize)
|
||||
{
|
||||
memmove (mst->datasamples,
|
||||
(char *)mst->datasamples + (trpackedsamples * samplesize),
|
||||
- (size_t)bufsize);
|
||||
+ bufsize);
|
||||
|
||||
- mst->datasamples = realloc (mst->datasamples, (size_t)bufsize);
|
||||
+ mst->datasamples = realloc (mst->datasamples, bufsize);
|
||||
|
||||
if (mst->datasamples == NULL)
|
||||
{
|
||||
ms_log (2, "mst_pack(): Cannot (re)allocate datasamples buffer\n");
|
||||
return -1;
|
||||
}
|
||||
+ mst->bufsize = bufsize;
|
||||
}
|
||||
else
|
||||
{
|
@ -1,2 +0,0 @@
|
||||
# This file is to be called by the conda build process
|
||||
$PYTHON setup.py install
|
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f "build_packages_windows.sh" ] ; then
|
||||
echo 'must be run from inside maintenance/conda'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
ACTION="$1"
|
||||
|
||||
if [ -z "$ACTION" ] ; then
|
||||
echo "usage: build_packages.sh (dryrun|upload)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$ACTION" == "UPLOAD" ] ; then
|
||||
if [ -z "$CONDA_USERNAME" -o -z "$CONDA_PASSWORD" ] ; then
|
||||
echo "need anaconda credentials as env variables"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
conda install -y conda-build conda-verify anaconda-client numpy
|
||||
|
||||
if [ "$ACTION" == "upload" ] ; then
|
||||
anaconda login --username "$CONDA_USERNAME" --password "$CONDA_PASSWORD" --hostname conda-builder-`uname`
|
||||
conda config --set anaconda_upload yes
|
||||
function anaconda_logout {
|
||||
anaconda logout
|
||||
}
|
||||
trap anaconda_logout EXIT
|
||||
else
|
||||
conda config --set anaconda_upload no
|
||||
fi
|
||||
|
||||
conda-build --python 3.6 build
|
||||
conda-build --python 3.7 build
|
||||
conda-build --python 3.8 build
|
||||
conda-build --python 3.9 build
|
||||
|
||||
if [ "$ACTION" == "upload" ] ; then
|
||||
trap - EXIT
|
||||
anaconda_logout
|
||||
fi
|
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
destination=$1
|
||||
|
||||
if [ -z "$destination" ] ; then
|
||||
echo "usage: upload_wheels.sh (testing|live)"
|
||||
fi
|
||||
|
||||
if [ "$destination" == 'live' ] ; then
|
||||
twine upload dist/pyrocko-* \
|
||||
--username="$PYPI_USERNAME" --password="$PYPI_PASSWORD" \
|
||||
--skip-existing --disable-progress-bar
|
||||
else
|
||||
twine upload --repository-url https://test.pypi.org/legacy/ dist/pyrocko-* \
|
||||
--username="$PYPI_USERNAME" --password="$PYPI_PASSWORD" \
|
||||
--skip-existing --disable-progress-bar
|
||||
fi
|
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
from glob import glob
|
||||
|
||||
from nose.core import run_exit
|
||||
|
||||
if len(sys.argv) == 2:
|
||||
target = sys.argv[1].split('.')
|
||||
if len(target) == 3:
|
||||
scripts = [sys.argv[1]]
|
||||
elif len(target) == 2:
|
||||
scripts = glob(os.path.join(*(target + ['test_*.py'])))
|
||||
elif len(target) == 1:
|
||||
scripts = glob(os.path.join(*(target + ['*', 'test_*.py'])))
|
||||
|
||||
else:
|
||||
scripts = glob(os.path.join('test', '*', 'test_*.py'))
|
||||
|
||||
sys.argv[1:] = scripts
|
||||
run_exit()
|
@ -0,0 +1,15 @@
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.box = "win10"
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.customize ["modifyvm", :id, "--memory", "4096"]
|
||||
vb.customize ["modifyvm", :id, "--cpus", "2"]
|
||||
end
|
||||
config.vm.network :private_network, ip: '192.168.115.15'
|
||||
config.vm.network :forwarded_port, guest: 22, host: 22015, id: 'ssh'
|
||||
|
||||
config.vm.guest = :windows
|
||||
config.vm.communicator = "winrm"
|
||||
config.winssh.shell = "cmd"
|
||||
end
|
@ -0,0 +1,37 @@
|
||||
@echo off
|
||||
if not exist "C:\Users\vagrant\miniconda3.exe" (
|
||||
echo Downloading conda installer...
|
||||
call curl "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" -o "C:\Users\vagrant\miniconda3.exe" -s
|
||||
) else (
|
||||
echo Conda installer already downloaded.
|
||||
)
|
||||
|
||||
if not exist "%UserProfile%\miniconda3" (
|
||||
echo Installing conda...
|
||||
call "C:\Users\vagrant\miniconda3.exe" /InstallationType=JustMe /S /D="%UserProfile%\miniconda3"
|
||||
|
||||
echo Installing conda modules needed by Pyrocko...
|
||||
call "%UserProfile%\miniconda3\Scripts\activate.bat"
|
||||
call conda install -y m2-libiconv m2-libintl m2-vim m2-bash m2-patch git
|
||||
call conda install -y setuptools numpy scipy matplotlib pyqt pyyaml progressbar2 requests jinja2 nose
|
||||
) else (
|
||||
echo Conda is already installed, activating...
|
||||
call "%UserProfile%\miniconda3\Scripts\activate.bat"
|
||||
)
|
||||
|
||||
if exist "%UserProfile%\pyrocko" (
|
||||
rmdir /s /q "%UserProfile%\pyrocko"
|
||||
)
|
||||
|
||||
call git clone -b %1 "C:\vagrant\pyrocko.git" "%UserProfile%\pyrocko"
|
||||
|
||||
cd pyrocko
|
||||
|
||||
mklink /d "test\data" "C:\vagrant\pyrocko-test-data"
|
||||
mklink /d "test\example_run_dir" "C:\vagrant\example_run_dir"
|
||||
|
||||
call python setup.py install
|
||||
call python -m pyrocko.print_version deps > "C:\vagrant\test-%1.py3.out"
|
||||
call python maintenance\run_tests_windows.py %2 >> "C:\vagrant\test-%1.py3.out" 2>&1
|
||||
|
||||
exit 0
|
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
branch="$1"
|
||||
|
||||
if [ -z "$branch" ]; then
|
||||
branch=`git rev-parse --abbrev-ref HEAD`
|
||||
fi
|
||||
|
||||
thetest="$2"
|
||||
|
||||
if [ -z "$thetest" ]; then
|
||||
thetest="test"
|
||||
fi
|
||||
|
||||
rm -rf pyrocko.git pyrocko-test-data example_run_dir *.out *.log
|
||||
git clone --bare "../../.." "pyrocko.git"
|
||||
cp -a "../../../test/data" pyrocko-test-data
|
||||
cp -a "../../../test/example_run_dir" example_run_dir
|
||||
|
||||
echo "testing branch: $branch"
|
||||
echo "running test: $thetest"
|
||||
echo "testing branch $branch" >> log.out
|
||||
date -uIseconds >> log.out
|
||||
vagrant up
|
||||
vagrant ssh -- "C:\\vagrant\\inside.bat" "$branch" "$thetest" > >(tee -a "log.out") 2> >(tee -a "log.out" >&2) || /bin/true
|
||||
vagrant halt
|
||||
date -uIseconds >> log.out
|
@ -0,0 +1,9 @@
|
||||
|
||||
:: "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
|
||||
IF NOT EXIST "libmseed" (
|
||||
tar -xzf libmseed-2.19.6.tar.gz --exclude=doc --exclude=test --exclude=example
|
||||
patch -s -p0 < libmseed-2.19.6-speedread.patch
|
||||
) ELSE (
|
||||
ECHO libmseed found
|
||||
)
|