#!/usr/bin/env python
from setuptools import setup
setup(
  name = 'cs.app.svcd',
  description = 'SvcD class and "svcd" command to run persistent service programmes.',
  author = 'Cameron Simpson',
  author_email = 'cs@cskk.id.au',
  version = '20190729',
  url = 'https://bitbucket.org/cameron_simpson/css/commits/all',
  classifiers = ['Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: Utilities', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)'],
  entry_points = {'console_scripts': ['svcd = cs.app.svcd:main']},
  include_package_data = True,
  install_requires = ['cs.app.flag', 'cs.env', 'cs.logutils', 'cs.pfx', 'cs.psutils', 'cs.py3', 'cs.sh'],
  keywords = ['python2', 'python3'],
  license = 'GNU General Public License v3 or later (GPLv3+)',
  long_description = 'Release 20190729:\nGet DEVNULL via cs.py3 instead of directly from subprocess.\n\nSvcD class and "svcd" command to run persistent service programmes.\n\nThis provides the features one wants from a daemon\nfor arbitrary commands providing a service:\n\n* process id (pid) files for both svcd and the service command\n* filesystem visible status (command running, service enabled)\n  via `cs.app.flag <https://pypi.org/project/cs.app.flag/>`_\n* command restart if the command exits\n* command control (stop, restart, disable)\n  via `cs.app.flag <https://pypi.org/project/cs.app.flag/>`_\n* test function to monitor for service viability;\n  if the test function fails, do not run the service.\n  This typically monitors something like\n  network routing (suspend service while laptop offline)\n  or a ping (suspend ssh tunnel while target does not answer pings).\n* signature function to monitor for service restart;\n  if the signature changes, restart the service.\n  This typically monitors something like\n  file contents (restart service on configuration change)\n  or network routing (restart ssh tunnel on network change)\n* callbacks for service command start and end,\n  for example to display desktop notifications\n\nI use this to run persistent ssh port forwards\nand a small collection of other personal services.\nI have convenient shell commands to look up service status\nand to start/stop/restart services.\n\nSee `cs.app.portfwd <https://pypi.org/project/cs.app.portfwd/>`_\nwhich I use to manage my ssh tunnels;\nit is a single Python programme\nrunning multiple ssh commands, each via its own SvcD instance.\n\n## Function `main(argv=None)`\n\nCommand line main programme.\n\n## Class `SvcD`\n\nMRO: `cs.app.flag.FlaggedMixin`  \nA process based service.\n\n### Method `SvcD.__init__(self, argv, name=None, environ=None, flags=None, group_name=None, pidfile=None, sig_func=None, test_flags=None, test_func=None, test_rate=None, restart_delay=None, once=False, quiet=False, trace=False, on_spawn=None, on_reap=None)`\n\nInitialise the SvcD.\n\nParameters:\n* `argv`: command to run as a subprocess.\n* `flags`: a cs.app.flag.Flags -like object, default None;\n  if None the default flags will be used.\n* `group_name`: alert group name, default "SVCD " + `name`.\n* `pidfile`: path to pid file, default $VARRUN/{name}.pid.\n* `sig_func`: signature function to compute a string which\n  causes a restart if it changes\n* `test_flags`: map of {flagname: truthiness} which should\n  be monitored at test time; truthy flags must be true and\n  untruthy flags must be false\n* `test_func`: test function with must return true if the comannd can run\n* `test_rate`: frequency of tests, default TEST_RATE\n* `restart_delay`: delay before start of an exiting command,\n  default RESTART_DELAY\n* `once`: if true, run the command only once\n* `quiet`: if true, do not issue alerts\n* `trace`: trace actions, default False\n* `on_spawn`: to be called after a new subprocess is spawned\n* `on_reap`: to be called after a subprocess is reaped\n\n\n\n#Release Log#\n\nRelease 20190729:\nGet DEVNULL via cs.py3 instead of directly from subprocess.\n\nRelease 20190602.2:\nAnother doc tweak.\n\nRelease 20190602.1:\nImprove module documentation formatting.\n\nRelease 20190602:\nSupport alert groups.\nCatch and report exceptions from the monitor signature function.\nPython 2 port fix for DEVNULL.\n\nRelease 20171118:\nBugfix for su invocation in setuid mode. Improved signature command tracing with -x option.\n\nRelease 20171026:\nImproved logic around signature changes.\n\nRelease 20171025:\nNew "-F flag,..." option for svcd. Improve stop logic. Other small fixes.\n\nRelease 20170906:\nInitial PyPI release.',
  long_description_content_type = 'text/markdown',
  package_dir = {'': 'lib/python'},
  py_modules = ['cs.app.svcd'],
)
