Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Rosie Work under packaging (branched from #2360) #2366

Merged
merged 3 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .bandit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
skips: ['B101']
skips: ['B101', 'B322']
10 changes: 5 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
doc/*
lib/html/static/js/bootstrap*
lib/html/static/js/dataTables.bootstrap*
lib/html/static/js/jquery*
lib/html/static/js/livestamp.min.js
lib/html/static/js/moment.min.js
metomi/rosie/lib/html/static/js/bootstrap*
metomi/rosie/lib/html/static/js/dataTables.bootstrap*
metomi/rosie/lib/html/static/js/jquery*
metomi/rosie/lib/html/static/js/livestamp.min.js
metomi/rosie/lib/html/static/js/moment.min.js
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ etc/opt
lib/bash/rose_init_site
doc
venv
metomi_rose.egg-info
dist

# coverage
.coverage
Expand Down
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ jobs:
include:
- name: "Unit Tests"
install:
- now install coverage cylc linters pytest rose
- now install coverage linters pytest cylc rose
script:
- now test style
- now test units

- name: "Test Battery"
before_install:
- export PATH="$PWD/.travis:$PATH"
- now install coverage cylc fcm rose rosie tut_suite
- now install coverage fcm tut_suite
install:
- now install isodatetime cylc rose
script:
- now test battery

- name: "Documentation"
install:
- now install coverage rose sphinx tut_suite
- now install coverage isodatetime rose sphinx tut_suite
script:
- now test docs
- now build docs
2 changes: 1 addition & 1 deletion .travis/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


def main():
command = ['rose', 'test-battery', '-j', '5']
command = ['etc/bin/rose-test-battery', '-j', '5']
if call(command + ['--state=save']):
# Non-zero return code
sys.stderr.write('\n\nRerunning Failed Tests...\n\n')
Expand Down
25 changes: 15 additions & 10 deletions .travis/now
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ WANDISCO=false


_build_docs () {
rose make-docs --strict clean html slides latexpdf
etc/bin/rose-make-docs --strict clean html slides latexpdf
}

_gh_extract () { # extract project from GitHub to $HOME
Expand Down Expand Up @@ -79,12 +79,24 @@ _install_coverage () {
PY_PATH+=("${TRAVIS_BUILD_DIR}/.travis")
}

_install_rose () {
pip install -e .
PY_PATH+=("${TRAVIS_BUILD_DIR}/metomi")
RC_PATH+=("${TRAVIS_BUILD_DIR}/bin")
}

_install_cylc () {
APT+=(at heirloom-mailx)
GIT+=('cylc|cylc-flow|master')
RC_PATH+=("${HOME}/cylc-master/bin")
}

_install_isodatetime () {
wget 'https://github.com/metomi/isodatetime/archive/master.tar.gz' \
-O - | tar -xz -C "${HOME}"
pip install -e "${HOME}/isodatetime-master"
}

_install_fcm () {
APT+=(subversion build-essential gfortran libxml-parser-perl \
libconfig-inifiles-perl libdbi-perl libdbd-sqlite3-perl)
Expand All @@ -98,12 +110,6 @@ _install_pytest () {
PIP+=(pytest)
}

_install_rose () {
PIP+=(aiofiles)
PY_PATH+=("${TRAVIS_BUILD_DIR}/lib/python/")
RC_PATH+=("${TRAVIS_BUILD_DIR}/bin")
}

_install_rosie () {
PIP+=(requests tornado sqlalchemy)
RI_PATH+=("$(_path_for python)" "$(_path_for rose)")
Expand Down Expand Up @@ -140,7 +146,7 @@ _path_for () {
}

_test_units () {
pytest --cov-append lib/python/rose/tests/*
pytest --cov-append metomi/rose/tests/*
}

_test_style () {
Expand All @@ -152,11 +158,10 @@ _test_style () {
_test_battery () {
cp "${TRAVIS_BUILD_DIR}/.travis/sitecustomize.py" ./lib/python
coverage run .travis/cover.py
rm ./lib/python/sitecustomize.py
}

_test_docs () {
rose make-docs --strict clean linkcheck doctest
etc/bin/rose-make-docs --strict clean linkcheck doctest
}

_wandisco_configure () { # extract Wandisco stuff
Expand Down
2 changes: 1 addition & 1 deletion .travis/shellchecker
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ default () {
main . \
--exclude etc/rose-bash-completion \
--exclude t \
-- -e SC1090
-- -e SC1090 -e SC2119

# run a lenient check on all test scripts
main t -- -S error -e SC1090
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ release for production use.

[Installation](http://metomi.github.io/rose/doc/html/installation.html) |
[User Guide](http://metomi.github.io/rose/) |
[How to Contribute](CONTRIBUTING.md)
[How to Contribute](https://github.com/metomi/rose/blob/master/CONTRIBUTING.md)

## Copyright and Terms of Use

Expand All @@ -46,4 +46,4 @@ See <http://metomi.github.io/rose/doc/html/terms.html>.

## Acknowledgement for non-Rose Work

See [Acknowledgement for Non-Rose Work](ACKNOWLEDGEMENT.md).
See [Acknowledgement for Non-Rose Work](https://github.com/metomi/rose/blob/master/ACKNOWLEDGEMENT.md).
15 changes: 7 additions & 8 deletions bin/rose
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
if ${ROSE_DEBUG:-false}; then
set -x
fi
. "$(dirname "$0")/../lib/bash/rose_init"
# shellcheck source=lib/bash/rose_init
# shellcheck source=lib/bash/rose_usage
. rose_init
rose_init

# Print actual command of a command alias
Expand Down Expand Up @@ -100,10 +102,11 @@ path_lead() {

# Print Rose version
function print_version() {
echo "Rose $ROSE_VERSION ($ROSE_HOME)"
echo "Rose $ROSE_VERSION ($ROSE_HOME_BIN)"
}

#-------------------------------------------------------------------------------
# if "rose x" input then set UTIL=x
UTIL="help"
if (($# > 0)); then
UTIL=$1
Expand Down Expand Up @@ -147,10 +150,8 @@ version|--version|-V)
exit
:;;
doc)
PATH=$(path_lead "${PATH:-}" "$ROSE_HOME_BIN")
PYTHONPATH=$(path_lead "${PYTHONPATH:-}" "$ROSE_HOME/lib/python")
ROSE_UTIL=$UTIL
export PATH PYTHONPATH ROSE_UTIL
export ROSE_UTIL
ns_len=$(( ${#ROSE_NS}+2 ))
for U in $(cd "$ROSE_HOME_BIN" && ls "$ROSE_NS-"*); do
NAME="$(sed "s/^$ROSE_NS-\\(.*\\)\$/\1/" <<<"$U")"
Expand Down Expand Up @@ -185,8 +186,6 @@ if (($# > 0)) && [[ $1 == '--help' || $1 == '-h' ]]; then
help_util "$UTIL"
exit
fi
PATH=$(path_lead "${PATH:-}" "$ROSE_HOME_BIN")
PYTHONPATH=$(path_lead "${PYTHONPATH:-}" "$ROSE_HOME/lib/python")
ROSE_UTIL=$UTIL
export PATH PYTHONPATH ROSE_UTIL
export ROSE_UTIL
exec "$COMMAND" "$@"
2 changes: 1 addition & 1 deletion bin/rose-app-run
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@
# optional ROSE_FILE_INSTALL_ROOT
# If specified, change to the specified directory to install files.
#-------------------------------------------------------------------------------
exec python3 -m rose.app_run "$@"
exec python3 -m metomi.rose.app_run "$@"
2 changes: 1 addition & 1 deletion bin/rose-app-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
# optional ROSE_META_PATH
# Prepend `$ROSE_META_PATH` to the metadata search path.
#-------------------------------------------------------------------------------
exec python3 -m rose.upgrade "$@"
exec python3 -m metomi.rose.upgrade "$@"
2 changes: 1 addition & 1 deletion bin/rose-config
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@
# optional ROSE_META_PATH
# Prepend `$ROSE_META_PATH` to the metadata search path.
#-------------------------------------------------------------------------------
exec python3 -m rose.config_cli "$@"
exec python3 -m metomi.rose.config_cli "$@"
2 changes: 1 addition & 1 deletion bin/rose-config-diff
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@
# rose config-diff --ignore=namelist:bar --ignore=namelist:baz ...
#
#-------------------------------------------------------------------------------
exec python3 -m rose.config_diff "$@"
exec python3 -m metomi.rose.config_diff "$@"
2 changes: 1 addition & 1 deletion bin/rose-config-dump
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
# --quiet, -q
# Decrement verbosity. Do not report modified files.
#-------------------------------------------------------------------------------
exec python3 -m rose.config_dump "$@"
exec python3 -m metomi.rose.config_dump "$@"
2 changes: 1 addition & 1 deletion bin/rose-config-edit
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
# optional ROSE_META_PATH
# Prepend `$ROSE_META_PATH` to the metadata search path.
#-------------------------------------------------------------------------------
exec python3 -m rose.config_editor.main "$@"
exec python3 -m metomi.rose.config_editor.main "$@"
2 changes: 1 addition & 1 deletion bin/rose-date
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ PRINT FORMAT
import sys
import os

from isodatetime.main import main as iso_main
from metomi.isodatetime.main import main as iso_main


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/rose-env-cat
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
# variable with the value of `STRING`, (which can be an empty string),
# instead of failing.
#-------------------------------------------------------------------------------
exec python3 -m rose.env_cat "$@"
exec python3 -m metomi.rose.env_cat "$@"
2 changes: 1 addition & 1 deletion bin/rose-host-select
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@
# Set the timeout in seconds of SSH commands to hosts.
# (default=10.0)
#-------------------------------------------------------------------------------
exec python3 -m rose.host_select "$@"
exec python3 -m metomi.rose.host_select "$@"
2 changes: 1 addition & 1 deletion bin/rose-macro
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
# optional ROSE_META_PATH
# Prepend `$ROSE_META_PATH` to the metadata search path.
#-------------------------------------------------------------------------------
exec python3 -m rose.macro "$@"
exec python3 -m metomi.rose.macro "$@"
2 changes: 1 addition & 1 deletion bin/rose-metadata-check
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
# metadata e.g.`env=FOO` or `namelist:bar`. If specified, only
# this section will be checked.
#-------------------------------------------------------------------------------
exec python3 -m rose.metadata_check "$@"
exec python3 -m metomi.rose.metadata_check "$@"
2 changes: 1 addition & 1 deletion bin/rose-metadata-gen
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
# every setting e.g. `compulsory=true`. If `=VALUE` is missing,
# the property will be set to a null string in each setting.
#-------------------------------------------------------------------------------
exec python3 -m rose.metadata_gen "$@"
exec python3 -m metomi.rose.metadata_gen "$@"
2 changes: 1 addition & 1 deletion bin/rose-metadata-graph
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
# optional ROSE_META_PATH
# Prepend `$ROSE_META_PATH` to the metadata search path.
#-------------------------------------------------------------------------------
exec python3 -m rose.metadata_graph "$@"
exec python3 -m metomi.rose.metadata_graph "$@"
3 changes: 2 additions & 1 deletion bin/rose-mpi-launch
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
# DIAGNOSTICS
# Return 0 on success, 1 or exit code of the launcher program on failure.
#-------------------------------------------------------------------------------
. "$(dirname "$0")/../lib/bash/rose_init"
# shellcheck source=lib/bash/rose_init
. rose_init
rose_init rose_log

# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion bin/rose-namelist-dump
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
# -u, --upper
# Shorthand for `--case=upper`.
#-------------------------------------------------------------------------------
exec python3 -m rose.namelist_dump "$@"
exec python3 -m metomi.rose.namelist_dump "$@"
2 changes: 1 addition & 1 deletion bin/rose-stem
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
# is intended to specify the revision of `fcm-make` config files.
#
#-------------------------------------------------------------------------------
exec python3 -m rose.stem "$@"
exec python3 -m metomi.rose.stem "$@"
2 changes: 1 addition & 1 deletion bin/rose-suite-clean
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
# Return the difference between the number of arguments and number of
# successfully cleaned suites, i.e. 0 if all successful.
#-------------------------------------------------------------------------------
exec python3 -m rose.suite_clean "$@"
exec python3 -m metomi.rose.suite_clean "$@"
2 changes: 1 addition & 1 deletion bin/rose-suite-cmp-vc
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
# --verbose, -v
# Increment verbosity.
#-------------------------------------------------------------------------------
exec python3 -m rose.cmp_source_vc "$@"
exec python3 -m metomi.rose.cmp_source_vc "$@"
2 changes: 1 addition & 1 deletion bin/rose-suite-hook
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
# --verbose, -v
# Increment verbosity.
#-------------------------------------------------------------------------------
exec python3 -m rose.suite_hook "$@"
exec python3 -m metomi.rose.suite_hook "$@"
2 changes: 1 addition & 1 deletion bin/rose-suite-log
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
# --view
# Launch web browser to view suite log.
#-------------------------------------------------------------------------------
exec python3 -m rose.suite_log "$@"
exec python3 -m metomi.rose.suite_log "$@"
2 changes: 1 addition & 1 deletion bin/rose-suite-restart
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
# --verbose, -v
# Increment verbosity.
#-------------------------------------------------------------------------------
exec python3 -m rose.suite_restart "$@"
exec python3 -m metomi.rose.suite_restart "$@"
2 changes: 1 addition & 1 deletion bin/rose-suite-run
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@
# * `cylc help register`
# * `cylc help run`
#-------------------------------------------------------------------------------
exec python3 -m rose.suite_run "$@"
exec python3 -m metomi.rose.suite_run "$@"
2 changes: 1 addition & 1 deletion bin/rose-suite-shutdown
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
# See the cylc documentation, cylc shutdown for options and details on
# `EXTRA-ARGS`.
#-------------------------------------------------------------------------------
exec python3 -m rose.suite_control shutdown "$@"
exec python3 -m metomi.rose.suite_control shutdown "$@"
2 changes: 1 addition & 1 deletion bin/rose-task-env
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@
# `env-script = eval $(rose task-env)`.
#
#-------------------------------------------------------------------------------
exec python3 -m rose.task_env "$@"
exec python3 -m metomi.rose.task_env "$@"
2 changes: 1 addition & 1 deletion bin/rose-task-run
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
# * `rose app-run`
# * `rose task-env`
#-------------------------------------------------------------------------------
exec python3 -m rose.task_run "$@"
exec python3 -m metomi.rose.task_run "$@"
3 changes: 2 additions & 1 deletion bin/rose-tutorial
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
# Make a copy of one of the tutorial SUITE in the cylc-run directory.
#
#-------------------------------------------------------------------------------
. "$(dirname "$0")/../lib/bash/rose_init"
# shellcheck source=lib/bash/rose_init
. rose_init
mkdir -p "$HOME/cylc-run"

usage () {
Expand Down
2 changes: 1 addition & 1 deletion bin/rosie-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
# --verbose, -v
# Increment verbosity.
#-------------------------------------------------------------------------------
exec python3 -m rosie.vc checkout "$@"
exec python3 -m metomi.rosie.vc checkout "$@"
2 changes: 1 addition & 1 deletion bin/rosie-create
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
# --verbose, -v
# Increment verbosity.
#-------------------------------------------------------------------------------
exec python3 -m rosie.vc create "$@"
exec python3 -m metomi.rosie.vc create "$@"
2 changes: 1 addition & 1 deletion bin/rosie-delete
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
# --verbose, -v
# Increment verbosity.
#-------------------------------------------------------------------------------
exec python3 -m rosie.vc delete "$@"
exec python3 -m metomi.rosie.vc delete "$@"
2 changes: 1 addition & 1 deletion bin/rosie-disco
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
# --service-root, -R
# (For start only.) Include web service name under root of URL.
#-------------------------------------------------------------------------------
exec python3 -m rosie.ws "$@"
exec python3 -m metomi.rosie.ws "$@"
2 changes: 1 addition & 1 deletion bin/rosie-go
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@
# * `rosie lookup`
# * `rosie ls`
#-------------------------------------------------------------------------------
exec python3 -m rosie.browser.main "$@"
exec python3 -m metomi.rosie.browser.main "$@"

Loading