diff --git a/Marlin/MANIFEST.in b/Marlin/MANIFEST.in deleted file mode 100644 index 3d3823f9..00000000 --- a/Marlin/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include README.rst -include __pkg_metadata__.py diff --git a/Marlin/README.rst b/Marlin/README.rst deleted file mode 100644 index fd9cf138..00000000 --- a/Marlin/README.rst +++ /dev/null @@ -1,29 +0,0 @@ -************************************************* -Marlin -- Salish Sea NEMO svn-hg Maintenance Tool -************************************************* - -``marlin`` is a command line tool for maintenance of the Salish Sea MEOPAR project NEMO-hg-mirror code repository. -It's main purpose is to automate the process of incorporating Subversion revisions from the NEMO master repository into our Mercurial repository. - -Use ``marlin --help`` to get a list of the sub-commands available. -Use ``marline help `` to get a synopsis of what a sub-command does, -what its required arguments are, -and what options are available to control it. - -Documentation for ``marlin`` is in the ``docs/`` directory and is rendered at -https://salishsea-meopar-tools.readthedocs.org/en/latest/Marlin/. - -Yes, -``marlin`` is named for `Nemo's over-protective father`_... - -.. _Nemo's over-protective father: https://www.google.com/search?q=nemo%27s+father+images - - -License -======= - -The ``marlin`` code and documentation are copyright 2014-2021 by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. - -They are licensed under the Apache License, Version 2.0. -https://www.apache.org/licenses/LICENSE-2.0 -Please see the LICENSE file for details of the license. diff --git a/Marlin/__pkg_metadata__.py b/Marlin/__pkg_metadata__.py deleted file mode 100644 index 16a62d66..00000000 --- a/Marlin/__pkg_metadata__.py +++ /dev/null @@ -1,22 +0,0 @@ -"""Marlin -- Salish Sea NEMO svn-hg Maintenance Tool - - -Copyright 2015-2021 The Salish Sea MEOPAR Contributors -and The University of British Columbia - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -PROJECT = 'Marlin' -DESCRIPTION = 'Salish Sea NEMO svn-hg Maintenance Tool' -VERSION = '0.1' -DEV_STATUS = '1 - Planning' diff --git a/Marlin/docs/commands.rst b/Marlin/docs/commands.rst deleted file mode 100644 index 01bbf727..00000000 --- a/Marlin/docs/commands.rst +++ /dev/null @@ -1,88 +0,0 @@ -.. Copyright 2013-2021 The Salish Sea MEOPAR contributors -.. and The University of British Columbia -.. -.. Licensed under the Apache License, Version 2.0 (the "License"); -.. you may not use this file except in compliance with the License. -.. You may obtain a copy of the License at -.. -.. https://www.apache.org/licenses/LICENSE-2.0 -.. -.. Unless required by applicable law or agreed to in writing, software -.. distributed under the License is distributed on an "AS IS" BASIS, -.. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -.. See the License for the specific language governing permissions and -.. limitations under the License. - - -*************** -Marlin Commands -*************** - -The main purpose of the :py:obj:`Marlin` package is to automate the process of incorporating Subversion revisions from the NEMO master repository into our Mercurial repository. -See :ref:`PullChangesFromNEMO-3.6svn` for details of how the :command:`marlin` command is used. - -Use :kbd:`marlin --help` to see the available options and sub-commands:: - - (marlin)$ marlin --help - usage: marlin [--version] [-v] [--log-file LOG_FILE] [-q] [-h] [--debug] - - Salish Sea NEMO svn-hg Maintenance Tool - - optional arguments: - --version show program's version number and exit - -v, --verbose Increase verbosity of output. Can be repeated. - --log-file LOG_FILE Specify a file to log output. Disabled by default. - -q, --quiet suppress output except warnings and errors - -h, --help show this help message and exit - --debug show tracebacks on errors - - Commands: - complete print bash completion command - help print detailed help for another command - incoming Display SVN log of revisions that have not yet been brought in - update Apply SVN updates from upstream repo & commit them to Mercurial - - -:kbd:`incoming` -=============== - -The :kbd:`incoming` sub-command displays a list of SVN revisions from the upstream repo that have not yet been applied to the local working copy. -The list defaults to just the next revision that would be applied by an update operation, -but the :kbd:`-l` or :kbd:`--limit` option allows the list to be extended. -In particular, -:kbd:`-l 0` will show all revisions between the working copy revision and the upstream repo HEAD revision. - -.. code-block:: bash - - (marlin)$ marlin help incoming - usage: marlin incoming [-h] [-l LIMIT] - - Display SVN log of revisions that have not yet been brought in from the - upstream repo. - - optional arguments: - -h, --help show this help message and exit - -l LIMIT, --limit LIMIT - maximum number of log messages to show; defaults to 1 - - -:kbd:`update` -============= - -The :kbd:`update` sub-command applies SVN updates from the upstream repo one revision at a time. -After each :command:`svn update` operation is completed the changes are committed to Mercurial using a commit message that identifies the SVN revision of the changes, -and which includes the SVN commit message. - -:kbd:`update` defaults to applying just the next revision, -but the :kbd:`--to-rev` option allows revisions up to and including a specific revision number to be applied. - -.. code-block:: bash - - $ marlin help update - usage: marlin update [-h] [--to-rev TO_REV] - - Apply SVN updates from upstream repo & commit them to Mercurial one at a time. - - optional arguments: - -h, --help show this help message and exit - --to-rev TO_REV SVN revision number to update repo to diff --git a/Marlin/docs/index.rst b/Marlin/docs/index.rst deleted file mode 100644 index 80eb4668..00000000 --- a/Marlin/docs/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. _Marlin: - -************************************************* -Marlin -- Salish Sea NEMO svn-hg Maintenance Tool -************************************************* - -:py:obj:`Marlin` is a command line tool for maintenance of the Salish Sea MEOPAR project NEMO-hg-mirror code repository. -Its main purpose is to automate the process of incorporating Subversion revisions from the NEMO master repository into our Mercurial repository. - -Yes, -:py:obj:`Marlin` is named for `Nemo's over-protective father`_... - -.. _Nemo's over-protective father: https://www.google.com/search?q=nemo%27s+father+images - - -Contents: - -.. toctree:: - :maxdepth: 2 - - install - commands diff --git a/Marlin/docs/install.rst b/Marlin/docs/install.rst deleted file mode 100644 index d50e697c..00000000 --- a/Marlin/docs/install.rst +++ /dev/null @@ -1,79 +0,0 @@ -.. Copyright 2013-2021 The Salish Sea MEOPAR contributors -.. and The University of British Columbia -.. -.. Licensed under the Apache License, Version 2.0 (the "License"); -.. you may not use this file except in compliance with the License. -.. You may obtain a copy of the License at -.. -.. https://www.apache.org/licenses/LICENSE-2.0 -.. -.. Unless required by applicable law or agreed to in writing, software -.. distributed under the License is distributed on an "AS IS" BASIS, -.. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -.. See the License for the specific language governing permissions and -.. limitations under the License. - - -************ -Installation -************ - -Python Version -============== - -:py:obj:`Marlin` is developed and tested under Python 2.7. - - -Dependencies -============ - -:py:obj:`Marlin` depends on the pysvn_ library. -On :kbd:`salish` pysvn_ is installed as the system-side :kbd:`python-svn` package. -Include it in the virtualenv in which :py:obj:`Marlin` is installed by symlinking it into the virtualenv :file:`site-packages/` directory. - -:py:obj:`Marlin` also depends on the :ref:`SalishSeaToolsPackage` :ref:`salishsea_tools.hg_commands` - -Details of how to install both of these dependencies are included in the :ref:`BasicInstallation` section below. - -.. _pysvn: https://pysvn.sourceforge.io - - -.. _BasicInstallation: - -Basic Installation -================== - -#. Create a :kbd:`marlin` virtualenv: - - .. code-block:: bash - - $ cd /data/dlatorne/.virtualenvs/ - $ virturalenv marlin - -#. Symlink pysvn_ into the :kbd:`marlin` virtualenv :file:`site-packages/` directory: - - .. code-block:: bash - - $ cd /data/dlatorne/.virtualenvs/marlin/lib/python2.7/site-packages/ - $ ln -s /usr/lib/python2.7/dist-packages/pysvn - -#. Activate the :kbd:`marlin` virtualenv and install the :py:obj:`SalishSeaTools` and :py:obj:`Marlin` packages in editable mode: - - .. code-block:: bash - - $ . /data/dlatorne/.virtualenvs/marlin/bin/activate - (marlin)$ cd /data/dlatorne/MEOPAR/tools/ - (marlin)$ pip install --no-deps -e SalishSeaTools - (marlin)$ pip install -e Marlin - - -Source Code -=========== - -The source code is hosted on GitHub: https://github.com/SalishSeaCast/tools/blob/main/Marlin/. - - -Reporting Bugs -============== - -Please report bugs through the GitHub project: https://github.com/SalishSeaCast/tools/issues?q=label:Marlin marked with "Marlin" as a label. diff --git a/Marlin/marlin/__init__.py b/Marlin/marlin/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/Marlin/marlin/__pkg_metadata__.py b/Marlin/marlin/__pkg_metadata__.py deleted file mode 120000 index eb861a0d..00000000 --- a/Marlin/marlin/__pkg_metadata__.py +++ /dev/null @@ -1 +0,0 @@ -../__pkg_metadata__.py \ No newline at end of file diff --git a/Marlin/marlin/main.py b/Marlin/marlin/main.py deleted file mode 100644 index df5647e4..00000000 --- a/Marlin/marlin/main.py +++ /dev/null @@ -1,51 +0,0 @@ -"""Marlin application - -Salish Sea NEMO svn-hg Maintenance Tool - -This module is connected to the `marlin` command via a console_scripts -entry point in setup.py. - -Copyright 2015-2021 The Salish Sea MEOPAR Contributors -and The University of British Columbia - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import sys - -import cliff.app -import cliff.commandmanager - -from . import __pkg_metadata__ - - -__all__ = [ - 'MarlinApp', 'main', -] - - -class MarlinApp(cliff.app.App): - def __init__(self): - super(MarlinApp, self).__init__( - description=__pkg_metadata__.DESCRIPTION, - version=__pkg_metadata__.VERSION, - command_manager=cliff.commandmanager.CommandManager('marlin.app') - ) - - -def main(argv=sys.argv[1:]): - app = MarlinApp() - return app.run(argv) - - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) diff --git a/Marlin/marlin/svn.py b/Marlin/marlin/svn.py deleted file mode 100644 index 5dd6c82d..00000000 --- a/Marlin/marlin/svn.py +++ /dev/null @@ -1,142 +0,0 @@ -"""Marlin command plug-ins for SVN-ish commands. - -Copyright 2015-2021 The Salish Sea MEOPAR Contributors -and The University of British Columbia - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import logging -import tempfile -import sys - -import arrow -import cliff.command -import pysvn - -from salishsea_tools import hg_commands - - -__all__ = [ - 'SVNIncoming', 'SVNUpdate', - 'get_working_copy_info', 'get_working_copy_rev', 'get_upstream_url', - 'get_upstream_logs', 'apply_update', -] - - -HEAD = pysvn.Revision(pysvn.opt_revision_kind.head) - - -class SVNIncoming(cliff.command.Command): - """Display SVN log of revisions that have not yet been brought in - from the upstream repo. - """ - def get_parser(self, prog_name): - parser = super(SVNIncoming, self).get_parser(prog_name) - parser.add_argument( - '-l', '--limit', - type=int, - default=1, - help='maximum number of log messages to show; defaults to 1', - ) - return parser - - def take_action(self, parsed_args): - svn_logs = get_upstream_logs(limit=parsed_args.limit) - for chunk in self._format(svn_logs): - sys.stdout.write(chunk) - - def _format(self, svn_logs): - for svn_log in svn_logs: - timestamp = arrow.get(svn_log.date) - chunk = ( - 'r{0.revision.number} {1} UTC\n' - ' {0.message}' - '\n' - .format(svn_log, timestamp.format('YYYY-MM-DD HH:mm:ss')) - ) - yield chunk - - -class SVNUpdate(cliff.command.Command): - """Apply SVN updates from upstream repo & commit them to Mercurial - one at a time. - """ - log = logging.getLogger(__name__) - - def get_parser(self, prog_name): - parser = super(SVNUpdate, self).get_parser(prog_name) - parser.add_argument( - '--to-rev', - type=int, - help='SVN revision number to update repo to', - ) - return parser - - def take_action(self, parsed_args): - end_rev = parsed_args.to_rev - limit = 1 if end_rev is None else 0 - svn_logs = get_upstream_logs(limit) - end_rev = svn_logs[0].revision.number if end_rev is None else end_rev - for svn_log in svn_logs: - if svn_log.revision.number > end_rev: - break - apply_update(svn_log.revision.number) - hg_commit_msg = ( - 'Update to svn r{0.revision.number}.' - '\n\n' - '{0.message}' - .format(svn_log) - ) - with tempfile.NamedTemporaryFile() as msg_file: - msg_file.write(hg_commit_msg) - msg_file.flush() - hg_commands.commit(logfile=msg_file.name) - self.log.info(hg_commit_msg + '\n') - - -def get_working_copy_info(path='.'): - client = pysvn.Client() - info = client.info(path) - return info - - -def get_working_copy_rev(path='.'): - info = get_working_copy_info() - return info.revision.number - - -def get_upstream_url(path='.'): - info = get_working_copy_info() - return info.url - - -def get_upstream_logs(limit=0): - limit = limit + 1 if limit != 0 else 0 - url = get_upstream_url() - tip_rev = pysvn.Revision( - pysvn.opt_revision_kind.number, get_working_copy_rev()) - client = pysvn.Client() - svn_logs = client.log( - url, - revision_start=tip_rev, - revision_end=HEAD, - limit=limit, - ) - return svn_logs[1:] - - -def apply_update(revision, path='.'): - client = pysvn.Client() - rev = pysvn.Revision(pysvn.opt_revision_kind.number, revision) - tip_rev = client.update(path, revision=rev) - return tip_rev diff --git a/Marlin/requirements.txt b/Marlin/requirements.txt deleted file mode 100644 index 4c244db1..00000000 --- a/Marlin/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Python packages and versions used in the Marlin development environment - -argparse==1.2.1 -arrow==0.4.2 -cliff==1.5.2 -cmd2==0.6.7 -prettytable==0.7.2 -pyparsing==2.0.1 -python-dateutil==2.2 -six==1.5.2 -stevedore==0.14.1 -wsgiref==0.1.2 diff --git a/Marlin/setup.py b/Marlin/setup.py deleted file mode 100644 index 467c643f..00000000 --- a/Marlin/setup.py +++ /dev/null @@ -1,80 +0,0 @@ -"""Marlin -- Salish Sea NEMO svn-hg Maintenance Tool - -Copyright 2015-2021 The Salish Sea MEOPAR Contributors -and The University of British Columbia - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -from setuptools import ( - find_packages, - setup, -) - -import __pkg_metadata__ - - -python_classifiers = [ - 'Programming Language :: Python :: {0}'.format(py_version) - for py_version in ['2', '2.7']] -other_classifiers = [ - 'Development Status :: ' + __pkg_metadata__.DEV_STATUS, - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: Implementation :: CPython', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: POSIX :: Linux', - 'Operating System :: Unix', - 'Environment :: Console', - 'Intended Audience :: Science/Research', - 'Intended Audience :: Education', - 'Intended Audience :: Developers', - 'Intended Audience :: End Users/Desktop', -] -try: - long_description = open('README.rst', 'rt').read() -except IOError: - long_description = '' -install_requires = [ - # see requirements.txt for versions most recently used in development - 'arrow', - 'cliff', - # 'SalishSeaTools', - # on Ubuntu symlink pysvn from /usr/lib/python2.7/dist-packages/pysvn -] - -setup( - name=__pkg_metadata__.PROJECT, - version=__pkg_metadata__.VERSION, - description=__pkg_metadata__.DESCRIPTION, - long_description=long_description, - author='Doug Latornell', - author_email='djl@douglatornell.ca', - url='https://salishsea-meopar-tools.readthedocs.org/en/latest/Marlin/', - license='Apache License, Version 2.0', - classifiers=python_classifiers + other_classifiers, - platforms=['MacOS X', 'Linux'], - install_requires=install_requires, - packages=find_packages(), - include_package_data=True, - zip_safe=False, - entry_points={ - # The marlin command: - 'console_scripts': [ - 'marlin = marlin.main:main', - ], - # Sub-command plug-ins: - 'marlin.app': [ - 'incoming = marlin.svn:SVNIncoming', - 'update = marlin.svn:SVNUpdate', - ], - }, -) diff --git a/docs/index.rst b/docs/index.rst index a79aa16a..22deeb70 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,8 +18,6 @@ The :file:`tools` repo contains several Python packages: * :py:obj:`SOGTools` - :ref:`Python functions ` for working with the output of the SOG 1-D model -* :py:obj:`Marlin` - the :ref:`Salish Sea NEMO svn-hg Maintenance Tool ` - Also documented here are: * Notes are how the Python packages in the repo are :ref:`developed and maintained ` @@ -47,7 +45,6 @@ Contents: bathymetry/index I_ForcingFiles/index LiveOcean/index - Marlin/index python_packaging/index nemo-tools/index legacy_docs/index diff --git a/docs/python_packaging/library_code.rst b/docs/python_packaging/library_code.rst index 561250da..d4b248fd 100644 --- a/docs/python_packaging/library_code.rst +++ b/docs/python_packaging/library_code.rst @@ -42,7 +42,6 @@ checkout out the code in these packages: * `SalishSeaCast NEMO Command Processor`_ * `SalishSeaNowcast Package`_ -* :ref:`Marlin` .. _SalishSeaCast NEMO Command Processor: https://github.com/SalishSeaCast/SalishSeaCmd .. _SalishSeaNowcast Package: https://github.com/SalishSeaCast/SalishSeaNowcast