Skip to content

Commit

Permalink
Response to OS review
Browse files Browse the repository at this point in the history
Co-Authored-By: Oliver Sanders <[email protected]>

Allow for change in isodatetime namespace to metomi.isodatetime
  • Loading branch information
wxtim committed Jul 12, 2019
1 parent 1745cf1 commit 49d422b
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 53 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ lib/bash/rose_init_site
doc
venv
metomi_rose.egg-info
<<<<<<< HEAD
=======
dist
>>>>>>> another-rose-package-branch-rebaser

# coverage
.coverage
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:

- name: "Documentation"
install:
- now install coverage rose sphinx tut_suite
- now install coverage isodatetime rose sphinx tut_suite
script:
- now test docs
1 change: 0 additions & 1 deletion .travis/now
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ _install_coverage () {

_install_rose () {
pip install -e .
PIP+=(aiofiles)
PY_PATH+=("${TRAVIS_BUILD_DIR}/metomi")
RC_PATH+=("${TRAVIS_BUILD_DIR}/bin")
}
Expand Down
1 change: 0 additions & 1 deletion .travis/shellchecker
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ default () {
main t -- -S error -e SC1090
}

shellcheck -V
if [[ $# -gt 0 ]]; then
main "$@"
else
Expand Down
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
8 changes: 4 additions & 4 deletions metomi/rose/apps/ana_builtin/grepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SingleCommandStatus(AnalysisTask):
"""

def run_analysis(self):
"""Main analysis routine called from metomi.rose_ana."""
"""Main analysis routine called from rose_ana."""
self.process_opt_files()
self.process_opt_kgo()
self.process_opt_command()
Expand Down Expand Up @@ -234,7 +234,7 @@ class SingleCommandPattern(SingleCommandStatus):
"""

def run_analysis(self):
"""Main analysis routine called from metomi.rose_ana."""
"""Main analysis routine called from rose_ana."""
# Note that this is identical to the above class, only it has the
# additional pattern option; so call back to the parent class
self.process_opt_pattern()
Expand Down Expand Up @@ -304,7 +304,7 @@ class FilePattern(SingleCommandPattern):
"""

def run_analysis(self):
"""Main analysis routine called from metomi.rose_ana."""
"""Main analysis routine called from rose_ana."""
self.process_opt_files()
self.process_opt_kgo()
self.process_opt_pattern()
Expand Down Expand Up @@ -484,7 +484,7 @@ class FileCommandPattern(FilePattern):
"""

def run_analysis(self):
"""Main analysis routine called from metomi.rose_ana."""
"""Main analysis routine called from rose_ana."""
# Note that this is identical to the above class, only it has the
# additional command option; so call back to the parent class
self.process_opt_command()
Expand Down
22 changes: 11 additions & 11 deletions metomi/rose/apps/rose_ana.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def enter_comparison(
"INSERT OR REPLACE INTO comparisons VALUES (?, ?, ?, ?, ?)")
# Prepend the task_name onto each entry, to try and ensure it is
# unique (the individual comparison names may not be, but the
# metomi.rose task name + the comparison task name should)
# rose task name + the comparison task name should)
sql_args = [self.task_name + " - " + comp_task,
kgo_file, suite_file, status, comparison]
# Add the command and arguments to the buffer
Expand Down Expand Up @@ -244,17 +244,17 @@ def run(self, app_runner, conf_tree, opts, args, uuid, work_files):
self.config = conf_tree.node
self.app_runner = app_runner

# Attach to the main metomi.rose config (for retrieving settings from
# Attach to the main rose config (for retrieving settings from
# things like the user's ~/.metomi/rose.conf)
self.rose_conf = ResourceLocator.default().get_conf()

# Attach to a reporter instance for sending messages.
self._init_reporter(app_runner.event_handler)

# As part of the introduction of a re-written metomi.rose_ana,
# As part of the introduction of a re-written rose_ana,
# backwards compatibility is maintained here by detecting the lack of
# the newer syntax in the app config and falling back to the old
# version of the metomi.rose_ana app (renamed to rose_ana_v1)
# version of the rose_ana app (renamed to rose_ana_v1)
# **Once the old behaviour is removed the below block can be too**.
new_style_app = False
for keys, _ in self.config.walk(no_ignore=True):
Expand All @@ -265,8 +265,8 @@ def run(self, app_runner, conf_tree, opts, args, uuid, work_files):
if not new_style_app:
# Use the previous app by instantiating and calling it explicitly
self.reporter(
"!!WARNING!! - Detected old style metomi.rose_ana app; "
"Using previous metomi.rose_ana version...")
"!!WARNING!! - Detected old style rose_ana app; "
"Using previous rose_ana version...")
from metomi.rose.apps.rose_ana_v1 import RoseAnaV1App
old_app = RoseAnaV1App(manager=self.manager)
return old_app.run(
Expand All @@ -287,7 +287,7 @@ def run(self, app_runner, conf_tree, opts, args, uuid, work_files):
self.titlebar("Initialising KGO database")
self.kgo_db.buffer_to_db(self.reporter)

self.titlebar("Launching metomi.rose_ana")
self.titlebar("Launching rose_ana")

# Load available methods for analysis and the tasks in the app.
self._load_analysis_modules()
Expand Down Expand Up @@ -381,7 +381,7 @@ def run(self, app_runner, conf_tree, opts, args, uuid, work_files):
self.titlebar("Final status")
self.reporter(msg, prefix=prefix)

self.titlebar("Completed metomi.rose_ana")
self.titlebar("Completed rose_ana")

# Finally if there were legitimate test failures raise an exception
# so that the task is caught by cylc as failed. Also fail if it looks
Expand Down Expand Up @@ -503,7 +503,7 @@ def _load_tasks(self):

# If the user passed a blank curled-braces expression
# it should be expanded to contain each of the arguments
# passed to metomi.rose_ana
# passed to rose_ana
new_values = []
for value in values:
if "{}" in value:
Expand Down Expand Up @@ -575,7 +575,7 @@ def _get_method_paths(self):
if os.path.exists(ana_dir):
method_paths.append(ana_dir)

# The metomi.rose config can specify a directory for site-specific
# The rose config can specify a directory for site-specific
# methods
config_paths = self.rose_conf.get_value(["rose-ana", "method-path"])
if config_paths:
Expand All @@ -592,7 +592,7 @@ def _get_method_paths(self):

class TestsFailedException(Exception):

"""Exception raised if any metomi.rose-ana comparisons fail."""
"""Exception raised if any rose-ana comparisons fail."""

def __init__(self, num_failed):
self.failed = num_failed
Expand Down
4 changes: 2 additions & 2 deletions metomi/rose/apps/rose_ana_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def run(self, app_runner, conf_tree, opts, args, uuid, work_files):
# Update the database
for task in tasks:
# The primary key in the database is composed from both the
# metomi.rose_ana app name and the task index (to make it unique)
# rose_ana app name and the task index (to make it unique)
app_task = "{0} ({1})".format(metomi.rose_ana_task_name, task.name)
# Include an indication of what extract/comparison was performed
comparison = "{0} : {1} : {2}".format(
Expand Down Expand Up @@ -228,7 +228,7 @@ def __repr__(self):

class TestsFailedException(Exception):

"""Exception raised if any metomi.rose-ana comparisons fail."""
"""Exception raised if any rose-ana comparisons fail."""

def __init__(self, num_failed):
self.ret_code = num_failed
Expand Down
4 changes: 2 additions & 2 deletions metomi/rose/apps/rose_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------------
"""Builtin application: metomi.rose_arch: transform and archive suite files."""
"""Builtin application: rose_arch: transform and archive suite files."""

import errno
from glob import glob
Expand Down Expand Up @@ -105,7 +105,7 @@ def run(self, app_runner, conf_tree, opts, args, uuid, work_files):
suite_name = os.getenv("ROSE_SUITE_NAME")
if not suite_name:
app_runner.handle_event(
'rose_arch must be run under metomi.rose task-run.',
'rose_arch must be run under rose task-run.',
level=Reporter.FAIL, kind=Reporter.KIND_ERR)
return 1
suite_dir = app_runner.suite_engine_proc.get_suite_dir(suite_name)
Expand Down
5 changes: 3 additions & 2 deletions metomi/rose/apps/rose_bunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------------
# Builtin application: metomi.rose_bunch: run multiple commands in parallel.
"""Builtin application: rose_bunch: run multiple commands in parallel.
"""


import itertools
Expand Down Expand Up @@ -406,7 +407,7 @@ def get_log_prefix(self):


class RoseBunchDAO(object):
"""Database object for metomi.rose_bunch"""
"""Database object for rose_bunch"""

TABLE_COMMANDS = "commands"
TABLE_CONFIG = "config"
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/apps/rose_prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------------
"""Builtin application: metomi.rose_prune: suite housekeeping application."""
"""Builtin application: rose_prune: suite housekeeping application."""

import os
from random import shuffle
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/cmp_source_vc.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def main():
else:
if lines is None:
event_handler(
'%s: metomi.rose-suite-run.version: VC info not found' % (
'%s: rose-suite-run.version: VC info not found' % (
suite_name),
kind=Reporter.KIND_ERR, level=Reporter.FAIL)
sys.exit(2)
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/config_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

class ConfigDiffDefaults(object):

"""Store default settings for the metomi.rose config-diff command."""
"""Store default settings for the rose config-diff command."""

PROPERTIES = ",".join(
[metomi.rose.META_PROP_TITLE, metomi.rose.META_PROP_NS,
Expand Down
3 changes: 2 additions & 1 deletion metomi/rose/config_processors/empy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
# Process a section in a metomi.rose.config.ConfigNode into a EmPy template.
"""Process a section in a metomi.rose.config.ConfigNode into a EmPy template.
"""


from metomi.rose.config_processors.jinja2 import ConfigProcessorForJinja2
Expand Down
3 changes: 2 additions & 1 deletion metomi/rose/config_processors/fileinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------------
# Process "file:*" sections in node of a metomi.rose.config_tree.ConfigTree.
"""Process "file:*" sections in node of a metomi.rose.config_tree.ConfigTree.
"""

from fnmatch import fnmatch
from glob import glob
Expand Down
3 changes: 2 additions & 1 deletion metomi/rose/config_processors/jinja2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with Rose. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
# Process a section in a metomi.rose.config.ConfigNode into a Jinja2 template.
"""Process a section in a metomi.rose.config.ConfigNode into a Jinja2 template.
"""

import filecmp
from metomi.rose.config_processor import (
Expand Down
20 changes: 10 additions & 10 deletions metomi/rose/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_metadata_for_config_id(self, setting_id, meta_config):
dict: A dictionary containing metadata options.
Example:
>>> # Create a metomi.rose app.
>>> # Create a rose app.
>>> with open('rose-app.conf', 'w+') as app_config:
... _ = app_config.write('''
... [foo]
Expand Down Expand Up @@ -312,7 +312,7 @@ def get_resource_path(self, filename=''):
macro_root_dir = os.path.dirname(macro_path)
library_dir = os.path.dirname(os.path.dirname(macro_root_dir))
root_dir = os.path.dirname(library_dir)
# root_dir is the directory of the metomi.rose-meta.conf file.
# root_dir is the directory of the rose-meta.conf file.
etc_path = os.path.join(root_dir, 'etc')
resource_path = os.path.join(etc_path, 'macros')
resource_path = os.path.join(resource_path, macro_name)
Expand Down Expand Up @@ -376,7 +376,7 @@ class MacroBaseRoseEdit(MacroBase):
metomi.rose.variable.Variable instance],
"env": [metomi.rose.variable.Variable instance]}
}
This makes it easy to interface with metomi.rose edit, which uses the
This makes it easy to interface with rose edit, which uses the
latter data structure internally.
"""
Expand Down Expand Up @@ -596,8 +596,8 @@ def load_meta_path(config=None, directory=None, is_upgrade=False,
"""Retrieve the path to the configuration metadata directory.
Arguments:
config - a metomi.rose config, perhaps with a meta= or project= flag
directory - the directory of the metomi.rose config file
config - a rose config, perhaps with a meta= or project= flag
directory - the directory of the rose config file
is_upgrade - if True, load the path in an upgrade-specific way
locator - a metomi.rose.resource.ResourceLocator instance.
Expand Down Expand Up @@ -794,8 +794,8 @@ def get_macros_for_config(config=None,
metomi.rose.config.ConfigNode
config_directory - The directory that the config file is located in.
return_modules - If true then a list of macro modules is also returned.
include_system - Include default metomi.rose macros?
include_custom - Include non-default metomi.rose macros?
include_system - Include default rose macros?
include_custom - Include non-default rose macros?
no_warn - Output metadata warnings?
"""
if config is None:
Expand Down Expand Up @@ -1022,7 +1022,7 @@ def get_metadata_for_config_id(setting_id, meta_config):
dict: A dictionary containing metadata options.
Example:
>>> # Create a metomi.rose app.
>>> # Create a rose app.
>>> with open('rose-app.conf', 'w+') as app_config:
... _ = app_config.write('''
... [foo]
Expand Down Expand Up @@ -1529,7 +1529,7 @@ def load_conf_from_file(conf_dir, config_file_path, mode="macro"):


def parse_macro_args(argv=None):
"""Parse options/arguments for metomi.rose macro and upgrade."""
"""Parse options/arguments for rose macro and upgrade."""
opt_parser = RoseOptionParser()
options = ["conf_dir", "meta_path", "non_interactive", "output_dir",
"fix", "validate_all", "no_warn", "suite_only", "transform_all"]
Expand Down Expand Up @@ -1564,7 +1564,7 @@ def _report_error(exception=None, text=""):


def scan_rose_directory(conf_dir, suite_only=False):
"""Returns a list of metomi.rose config files found within the given
"""Returns a list of rose config files found within the given
conf_dir.
* If the conf_dir is an application directory then return only the
Expand Down
2 changes: 1 addition & 1 deletion metomi/rose/suite_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def suite_log_view(opts, args, event_handler=None):
if url.startswith("file://"):
if (opts.non_interactive or
input(
"Start metomi.rose bush? [y/n] (default=n) ") == "y"):
"Start rose bush? [y/n] (default=n) ") == "y"):
suite_engine_proc.popen.run_bg(
"rose", "bush", "start", preexec_fn=os.setpgrp)
is_rose_bush_started = True
Expand Down
4 changes: 2 additions & 2 deletions metomi/rose/suite_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ def run_impl(self, opts, args, uuid, work_files):
mode = "local-install-only"
prefix = "rose-conf/%s-%s" % (strftime("%Y%m%dT%H%M%S"), mode)

# Dump the actual configuration as metomi.rose-suite-run.conf
# Dump the actual configuration as rose-suite-run.conf
ConfigDumper()(conf_tree.node, "log/" + prefix + ".conf")

# Install version information file
write_source_vc_info(
suite_conf_dir, "log/" + prefix + ".version", self.popen)

# If run through metomi.rose-stem, install version information
# If run through rose-stem, install version information
# files for each source tree if they're a working copy
if hasattr(opts, 'source') and hasattr(opts, 'project'):
for i, url in enumerate(opts.source):
Expand Down
4 changes: 2 additions & 2 deletions metomi/rose/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def get_meta_upgrade_module(meta_path):


def parse_upgrade_args(argv=None):
"""Parse options/arguments for metomi.rose macro and upgrade."""
"""Parse options/arguments for rose macro and upgrade."""
opt_parser = metomi.rose.macro.RoseOptionParser()
options = ["conf_dir", "meta_path", "non_interactive", "output_dir",
"downgrade", "all_versions"]
Expand Down Expand Up @@ -734,7 +734,7 @@ def parse_upgrade_args(argv=None):


def main():
"""Run metomi.rose upgrade."""
"""Run rose upgrade."""
return_objects = parse_upgrade_args()
if return_objects is None:
sys.exit(1)
Expand Down
Loading

0 comments on commit 49d422b

Please sign in to comment.