diff --git a/docs/config_reference.rst b/docs/config_reference.rst index 09ec71b74d..4a4863fbe5 100644 --- a/docs/config_reference.rst +++ b/docs/config_reference.rst @@ -14,8 +14,8 @@ The syntax we use in the following to describe the different configuration objec .. |jq| replace:: :attr:`jq(1)` .. _jq: https://stedolan.github.io/jq/manual/ -.. |schemas/config.json| replace:: ``schemas/config.json`` -.. _schemas/config.json: https://github.com/eth-cscs/reframe/blob/master/schemas/config.json +.. |schemas/config.json| replace:: ``reframe/schemas/config.json`` +.. _schemas/config.json: https://github.com/eth-cscs/reframe/blob/master/reframe/schemas/config.json .. |access| replace:: :attr:`access` .. _access: #.systems[].partitions[].access .. |basedir| replace:: :attr:`basedir` diff --git a/docs/manpage.rst b/docs/manpage.rst index aae6c41378..ae8bfe2f0c 100644 --- a/docs/manpage.rst +++ b/docs/manpage.rst @@ -497,6 +497,10 @@ Miscellaneous options This option can also be set using the :envvar:`RFM_COLORIZE` environment variable or the :js:attr:`colorize` general configuration parameter. +.. option:: --upgrade-config-file=OLD[:NEW] + + Convert the old-style configuration file ``OLD``, place it into the new file ``NEW`` and exit. + If a new file is not given, a file in the system temporary directory will be created. .. option:: -v, --verbose diff --git a/docs/migration_2_to_3.rst b/docs/migration_2_to_3.rst index 22d8fb6ab9..7ef51604dd 100644 --- a/docs/migration_2_to_3.rst +++ b/docs/migration_2_to_3.rst @@ -24,17 +24,13 @@ As soon as it detects an old-style configuration file, it will convert it to the ./bin/reframe: the syntax of the configuration file 'unittests/resources/settings_old_syntax.py' is deprecated ./bin/reframe: configuration file has been converted to the new syntax here: '/var/folders/h7/k7cgrdl13r996m4dmsvjq7v80000gp/T/tmph5n8u3kf.py' -Alternatively, you can convert any old configuration file using the conversion tool |convert_config|_: - -.. |convert_config| replace:: :obj:`convert-config` -.. _convert_config: https://github.com/eth-cscs/reframe/blob/master/tools/convert-config +Alternatively, you can convert any old configuration file using the command line option :option:`--upgrade-config-file`: .. code-block:: none - $ ./tools/convert-config unittests/resources/settings_old_syntax.py new_config.py + $ ./bin/reframe --upgrade-config-file unittests/resources/settings_old_syntax.py:new_config.py Conversion successful! The converted file can be found at 'new_config.py'. - Another important change is that default locations for looking up a configuration file has changed (see `Configuring ReFrame for Your Site `__ for more details). That practically means that if you were relying on ReFrame loading your ``reframe/settings.py`` by default, this is no longer true. You have to move it to any of the default settings locations or set the corresponding command line option or environment variable. diff --git a/docs/started.rst b/docs/started.rst index 96625580d1..1a9b386a71 100644 --- a/docs/started.rst +++ b/docs/started.rst @@ -44,6 +44,11 @@ ReFrame's latest stable version is available through different channels: pip install reframe-hpc + .. note:: + + The above method performs a bare installation of ReFrame not including unittests and tutorial examples. + + - As a `Spack `__ package: .. code:: bash @@ -58,7 +63,6 @@ ReFrame's latest stable version is available through different channels: eb easybuild/easyconfigs/r/ReFrame/ReFrame-VERSION.eb -r - ------------------------------- Getting the Latest and Greatest ------------------------------- diff --git a/reframe/core/config.py b/reframe/core/config.py index 85b1ae52c7..afdbd77d98 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -50,7 +50,7 @@ def __init__(self, site_config, filename): self._sticky_options = {} # Open and store the JSON schema for later validation - schema_filename = os.path.join(reframe.INSTALL_PREFIX, + schema_filename = os.path.join(reframe.INSTALL_PREFIX, 'reframe', 'schemas', 'config.json') with open(schema_filename) as fp: try: diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index db49136aa9..deb763713d 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -330,6 +330,10 @@ def main(): '--system', action='store', help='Load configuration for SYSTEM', envvar='RFM_SYSTEM' ) + misc_options.add_argument( + '--upgrade-config-file', action='store', metavar='OLD[:NEW]', + help='Upgrade old configuration file to new syntax' + ) misc_options.add_argument( '-V', '--version', action='version', version=os_ext.reframe_version() ) @@ -368,6 +372,24 @@ def main(): printer.colorize = site_config.get('general/0/colorize') printer.inc_verbosity(site_config.get('general/0/verbose')) + if options.upgrade_config_file is not None: + old_config, *new_config = options.upgrade_config_file.split( + ':', maxsplit=1) + new_config = new_config[0] if new_config else None + + try: + new_config = config.convert_old_config(old_config, new_config) + except Exception as e: + printer.error(f'could not convert file: {e}') + sys.exit(1) + + printer.info( + f'Conversion successful! ' + f'The converted file can be found at {new_config!r}.' + ) + + sys.exit(0) + # Now configure ReFrame according to the user configuration file try: try: diff --git a/schemas/config.json b/reframe/schemas/config.json similarity index 100% rename from schemas/config.json rename to reframe/schemas/config.json diff --git a/setup.py b/setup.py index e0aee1c403..b65e0ca6ea 100644 --- a/setup.py +++ b/setup.py @@ -19,9 +19,14 @@ long_description=long_description, long_description_content_type='text/markdown', url='https://github.com/eth-cscs/reframe', - licence='BSD 3-Clause', - packages=setuptools.find_packages(exclude=['unittests']), - python_requires='>=3.5', + license='BSD 3-Clause', + packages=setuptools.find_namespace_packages( + include=['reframe', 'reframe.*'] + ), + package_data={'reframe': ['schemas/*']}, + include_package_data=True, + install_requires=['jsonschema'], + python_requires='>=3.6', scripts=['bin/reframe'], classifiers=( 'Development Status :: 5 - Production/Stable', diff --git a/tools/convert-config b/tools/convert-config deleted file mode 120000 index 2ad48ad1cf..0000000000 --- a/tools/convert-config +++ /dev/null @@ -1 +0,0 @@ -convert_config.py \ No newline at end of file diff --git a/tools/convert_config.py b/tools/convert_config.py deleted file mode 100755 index 627ea73ffe..0000000000 --- a/tools/convert_config.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich) -# ReFrame Project Developers. See the top-level LICENSE file for details. -# -# SPDX-License-Identifier: BSD-3-Clause - -import os -import sys - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) - -import reframe.core.config as config # noqa: F401, F403 - - -if __name__ == '__main__': - try: - old_config = sys.argv[1] - except IndexError: - print(f'{sys.argv[0]}: too few arguments', file=sys.stderr) - print(f'Usage: {sys.argv[0]} OLD_CONFIG_FILE [NEW_CONFIG_FILE]', - file=sys.stderr) - print(' Use the extension of NEW_CONFIG_FILE to specify\n' - ' python (.py) or json (.json) format.', - file=sys.stderr) - sys.exit(1) - - try: - new_config = sys.argv[2] - except IndexError: - new_config = None - - try: - new_config = config.convert_old_config(old_config, new_config) - except Exception as e: - print(f'{sys.argv[0]}: could not convert file: {e}', - file=sys.stderr) - sys.exit(1) - - print( - f"Conversion successful! " - f"The converted file can be found at '{new_config}'." - )