Commit f6c39c31 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added URL checker CI job and fixed all dead URLs. Removed travis related file


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent fcd57585
Pipeline #16662 failed
......@@ -48,6 +48,15 @@ test_styles:
when: always
test_urls:
stage: test
script:
- source /root/miniconda3/bin/activate ci_env
- pip install -U urlchecker
- make urlcheck
when: always
test_arosics_install:
stage: test
script:
......@@ -139,3 +148,11 @@ create_github_release:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
except:
- dev
rever:
stage: deploy
dependencies:
- deploy_pypi
script:
# Config file for automatic testing at travis-ci.org
# This file will be regenerated if you run travis_pypi_setup.py
language: python
python:
- 3.5
- 3.4
- 3.3
- 2.7
- 2.6
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -U tox-travis
# command to run tests, e.g. python setup.py test
script: tox
# After you create the Github repo and add it to Travis, run the
# travis_pypi_setup.py script to finish PyPI deployment setup
deploy:
provider: pypi
distributions: sdist bdist_wheel
user: danschef
password:
secure: PLEASE_REPLACE_ME
on:
tags: true
repo: danschef/arosics
python: 2.7
......@@ -56,6 +56,9 @@ lint: ## check style with flake8
pycodestyle arosics --exclude="*.ipynb,*.ipynb*" --max-line-length=120 > ./tests/linting/pycodestyle.log
-pydocstyle arosics > ./tests/linting/pydocstyle.log
urlcheck: ## check for dead URLs
urlchecker check . --file-types .py,.rst,.md,.json
test: ## run tests quickly with the default Python
python setup.py test
......
......@@ -24,18 +24,6 @@ An Automated and Robust Open-Source Image Co-Registration Software for Multi-Sen
Status
------
.. .. image:: https://img.shields.io/travis/danschef/arosics.svg
:target: https://travis-ci.org/danschef/arosics
.. .. image:: https://readthedocs.org/projects/arosics/badge/?version=latest
:target: https://arosics.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. .. image:: https://pyup.io/repos/github/danschef/arosics/shield.svg
:target: https://pyup.io/repos/github/danschef/arosics/
:alt: Updates
.. image:: https://gitext.gfz-potsdam.de/danschef/arosics/badges/master/pipeline.svg
:target: https://gitext.gfz-potsdam.de/danschef/arosics/commits/master
.. image:: https://gitext.gfz-potsdam.de/danschef/arosics/badges/master/coverage.svg
......@@ -81,8 +69,7 @@ also allows to align the output image to the reference image coordinate grid if
Here is an example of a Landsat-8 / Sentinel-2 image pair before and after co-registration using AROSICS:
.. image:: https://gitext.gfz-potsdam.de/danschef/arosics/raw/master/docs/images/
animation_testcase1_zoom_L8_S2_global_coreg_before_after_900x456.gif
.. image:: https://gitext.gfz-potsdam.de/danschef/arosics/raw/master/docs/images/animation_testcase1_zoom_L8_S2_global_coreg_before_after_900x456.gif
Local co-registration - for spatially variable shifts but a bit slower
......
......@@ -573,7 +573,7 @@ class COREG(object):
# view both states
print('Matching window before and after correction (above and below): ')
# get layouts (docs on options: http://build.holoviews.org/Tutorials/Options.html)
# get layouts (docs on options: https://holoviews.org/user_guide)
layout_before = (hvIm_matchWin + hvIm_matchWin).opts(plot=dict(fig_inches=figsize))
layout_after = (hvIm_otherWin_orig + hvIm_otherWin_corr).opts(plot=dict(fig_inches=figsize))
......
......@@ -131,8 +131,8 @@ def setup(app):
# Add mappings for intersphinx extension (allows to link to the API reference of other sphinx documentations)
intersphinx_mapping = {
'geoarray': ('http://danschef.gitext.gfz-potsdam.de/geoarray/doc/', None),
'python': ('http://docs.python.org/3', None),
'geoarray': ('https://danschef.gitext-pages.gfz-potsdam.de/geoarray/doc/', None),
'python': ('https://docs.python.org/3', None),
}
......
......@@ -64,7 +64,7 @@ req_setup = [
req_intplot = ['holoviews', 'ipython']
req_test = ['coverage', 'nose', 'nose2', 'nose-htmloutput', 'rednose'] + req_intplot
req_test = ['coverage', 'nose', 'nose2', 'nose-htmloutput', 'rednose', 'urlchecker'] + req_intplot
req_doc = ['sphinx-argparse', 'sphinx_rtd_theme', 'sphinx-autodoc-typehints']
......
......@@ -39,3 +39,4 @@ dependencies:
- pylint
- rednose
- sphinx-argparse
- urlchecker
......@@ -121,6 +121,60 @@ class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
CRL.calculate_spatial_shifts()
class Test_Issue70(unittest.TestCase):
def test_coreg_local_fullArrays(self):
import dill
with open('/home/gfz-fe/scheffler/temp/coreg_issue70/kwargs_dump_assertionerror_issue_70b.dill', 'rb') as inF:
kw = dill.load(inF)
kw['r_b4match'] = 1
kw['q'] = False
CRL = COREG_LOCAL(**kw)
CRL.calculate_spatial_shifts()
CRL.correct_shifts()
if CRL.success:
CRL.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', hide_filtered=False)
else:
print('Result not co-registered.')
def test_coreg_local_bandsonly(self):
import dill
with open('/home/gfz-fe/scheffler/temp/coreg_issue70/kwargs_dump_assertionerror_issue_70.dill', 'rb') as inF:
kw = dill.load(inF)
kw['r_b4match'] = 1
kw['q'] = False
CRL = COREG_LOCAL(**kw)
CRL.calculate_spatial_shifts()
CRL.correct_shifts()
if CRL.success:
CRL.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', hide_filtered=False)
else:
print('Result not co-registered.')
class Test_Issue47(unittest.TestCase):
def test_coreg_local(self):
import dill
with open('/home/gfz-fe/scheffler/temp/coreg_issue47/kwargs_dump_assertionerror_issue_47.dill', 'rb') as inF:
kw = dill.load(inF)
kw['r_b4match'] = 1
kw['q'] = False
kw['CPUs'] = 32
CRL = COREG_LOCAL(**kw)
CRL.calculate_spatial_shifts()
CRL.correct_shifts()
if not CRL.success:
print('Result not co-registered.')
CRL.view_CoRegPoints(backgroundIm='tgt', hide_filtered=False)
# CRL.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', hide_filtered=False)
if __name__ == '__main__':
import nose2
nose2.main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# AROSICS - Automated and Robust Open-Source Image Co-Registration Software
#
# Copyright (C) 2017-2020 Daniel Scheffler (GFZ Potsdam, daniel.scheffler@gfz-potsdam.de)
#
# This software was developed within the context of the GeoMultiSens project funded
# by the German Federal Ministry of Education and Research
# (project grant code: 01 IS 14 010 A-C).
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser 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 Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""Update encrypted deploy password in Travis config file."""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
GITHUB_REPO = 'danschef/arosics'
TRAVIS_CONFIG_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)), '.travis.yml')
def load_key(pubkey):
"""Load public RSA key.
Work around keys with incorrect header/footer format.
Read more about RSA encryption with cryptography:
https://cryptography.io/latest/hazmat/primitives/asymmetric/rsa/
"""
try:
return load_pem_public_key(pubkey.encode(), default_backend())
except ValueError:
# workaround for https://github.com/travis-ci/travis-api/issues/196
pubkey = pubkey.replace('BEGIN RSA', 'BEGIN').replace('END RSA', 'END')
return load_pem_public_key(pubkey.encode(), default_backend())
def encrypt(pubkey, password):
"""Encrypt password using given RSA public key and encode it with base64.
The encrypted password can only be decrypted by someone with the
private key (in this case, only Travis).
"""
key = load_key(pubkey)
encrypted_password = key.encrypt(password, PKCS1v15())
return base64.b64encode(encrypted_password)
def fetch_public_key(repo):
"""Download RSA public key Travis will use for this repo.
Travis API docs: http://docs.travis-ci.com/api/#repository-keys
"""
keyurl = 'https://api.travis-ci.org/repos/{0}/key'.format(repo)
data = json.loads(urlopen(keyurl).read().decode())
if 'key' not in data:
errmsg = "Could not find public key for repo: {}.\n".format(repo)
errmsg += "Have you already added your GitHub repo to Travis?"
raise ValueError(errmsg)
return data['key']
def prepend_line(filepath, line):
"""Rewrite a file adding a line to its beginning."""
with open(filepath) as f:
lines = f.readlines()
lines.insert(0, line)
with open(filepath, 'w') as f:
f.writelines(lines)
def load_yaml_config(filepath):
"""Load yaml config file at the given path."""
with open(filepath) as f:
return yaml.load(f)
def save_yaml_config(filepath, config):
"""Save yaml config file at the given path."""
with open(filepath, 'w') as f:
yaml.dump(config, f, default_flow_style=False)
def update_travis_deploy_password(encrypted_password):
"""Put `encrypted_password` into the deploy section of .travis.yml."""
config = load_yaml_config(TRAVIS_CONFIG_FILE)
config['deploy']['password'] = dict(secure=encrypted_password)
save_yaml_config(TRAVIS_CONFIG_FILE, config)
line = ('# This file was autogenerated and will overwrite'
' each time you run travis_pypi_setup.py\n')
prepend_line(TRAVIS_CONFIG_FILE, line)
def main(args):
"""Add a PyPI password to .travis.yml so that Travis can deploy to PyPI.
Fetch the Travis public key for the repo, and encrypt the PyPI password
with it before adding, so that only Travis can decrypt and use the PyPI
password.
"""
public_key = fetch_public_key(args.repo)
password = args.password or getpass('PyPI password: ')
update_travis_deploy_password(encrypt(public_key, password.encode()))
print("Wrote encrypted password to .travis.yml -- you're ready to deploy")
if '__main__' == __name__:
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--repo', default=GITHUB_REPO,
help='GitHub repo (default: %s)' % GITHUB_REPO)
parser.add_argument('--password',
help='PyPI password (will prompt if not provided)')
args = parser.parse_args()
main(args)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment