├── tests ├── __init__.py ├── test_settings.py └── tests.py ├── .coveragerc ├── vitals ├── __init__.py ├── apps.py ├── urls.py ├── views.py ├── conf.py └── checks.py ├── MANIFEST.in ├── .travis.yml ├── runtests.py ├── setup.py ├── .gitignore ├── README.md └── LICENSE /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = vitals 3 | -------------------------------------------------------------------------------- /vitals/__init__.py: -------------------------------------------------------------------------------- 1 | default_app_config = 'vitals.apps.VitalsConfig' 2 | -------------------------------------------------------------------------------- /vitals/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class VitalsConfig(AppConfig): 5 | name = 'vitals' 6 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.md 3 | recursive-include vitals/static * 4 | recursive-include vitals/templates * 5 | 6 | -------------------------------------------------------------------------------- /vitals/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from .views import VitalsJSONView 3 | 4 | urlpatterns = [ 5 | url(r'^$', VitalsJSONView.as_view(), name='vitals'), 6 | ] 7 | -------------------------------------------------------------------------------- /tests/test_settings.py: -------------------------------------------------------------------------------- 1 | DEBUG = True, 2 | SECRET_KEY = 'supersecret' 3 | DATABASES = { 4 | 'default': { 5 | 'ENGINE': 'django.db.backends.sqlite3', 6 | 'NAME': 'test.sqlite3', 7 | }, 8 | } 9 | INSTALLED_APPS = [ 10 | 'vitals', 11 | ] 12 | ROOT_URLCONF = 'vitals.urls' 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.4" 4 | - "3.5" 5 | - "3.6" 6 | env: 7 | - DJANGO_VERSION=">=1.8,<1.9" 8 | - DJANGO_VERSION=">=1.9,<1.10" 9 | - DJANGO_VERSION=">=1.10,<1.11" 10 | install: 11 | - pip install coverage coveralls 12 | - pip install Django$DJANGO_VERSION 13 | - pip install . 14 | script: coverage run runtests.py 15 | after_success: coveralls 16 | -------------------------------------------------------------------------------- /runtests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import os 4 | import django 5 | from django.conf import settings 6 | from django.test.utils import get_runner 7 | 8 | if __name__ == '__main__': 9 | os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings' 10 | django.setup() 11 | TestRunner = get_runner(settings) 12 | test_runner = TestRunner(verbosity=2, interactive=False, keepdb=False) 13 | failures = test_runner.run_tests(['tests']) 14 | sys.exit(bool(failures)) 15 | -------------------------------------------------------------------------------- /vitals/views.py: -------------------------------------------------------------------------------- 1 | from django.views.generic import View 2 | from django.http import JsonResponse 3 | 4 | from .conf import conf 5 | 6 | 7 | def run_checks(checks_to_run=None): 8 | if not checks_to_run: 9 | checks_to_run = conf.enabled_checks 10 | 11 | failed = {} 12 | ok = [] 13 | 14 | for c in checks_to_run: 15 | check = conf.enabled_checks[c] 16 | inst = check['class'](name=c, **check['args']) 17 | inst.run_check() 18 | if inst.errors: 19 | failed[inst.name] = inst.errors 20 | else: 21 | ok.append(inst.name) 22 | 23 | return {'ok': ok, 'failed': failed} 24 | 25 | 26 | class VitalsJSONView(View): 27 | def get(self, request): 28 | checks_to_run = request.GET.get('checks', '').split(',') 29 | checks_to_run = list(filter(len, checks_to_run)) # filter empty string 30 | results = run_checks(checks_to_run) 31 | if results['failed']: 32 | status = 500 33 | else: 34 | status = 200 35 | 36 | return JsonResponse(results, status=status) 37 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | from setuptools import find_packages, setup 3 | 4 | # allow setup.py to be run from any path 5 | os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) 6 | 7 | setup( 8 | name='django-vitals', 9 | version='1.0.0', 10 | packages=find_packages(), 11 | include_package_data=True, 12 | license='GPLv3', 13 | description='A django app that provides health check endpoints for vital services.', 14 | url='https://github.com/LCOGT/django-vitals', 15 | author='Austin Riba', 16 | author_email='ariba@lcogt.net', 17 | classifiers=[ 18 | 'Environment :: Web Environment', 19 | 'Framework :: Django', 20 | 'Intended Audience :: Developers', 21 | 'Programming Language :: Python', 22 | 'Programming Language :: Python :: 3', 23 | 'Programming Language :: Python :: 3.4', 24 | 'Programming Language :: Python :: 3.5', 25 | 'Programming Language :: Python :: 3.6', 26 | 'Topic :: Internet :: WWW/HTTP', 27 | ], 28 | install_requires=[ 29 | 'requests', 30 | 'django', 31 | ] 32 | ) 33 | -------------------------------------------------------------------------------- /vitals/conf.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from importlib import import_module 3 | 4 | 5 | DEFAULT_CHECKS = [ 6 | { 7 | 'NAME': 'DatabaseCheck', 8 | 'CLASS': 'vitals.checks.DatabaseCheck' 9 | }, 10 | { 11 | 'NAME': 'CacheCheck', 12 | 'CLASS': 'vitals.checks.CacheCheck' 13 | }, 14 | { 15 | 'NAME': 'StorageCheck', 16 | 'CLASS': 'vitals.checks.StorageCheck' 17 | } 18 | ] 19 | 20 | 21 | def import_string(val): 22 | try: 23 | parts = val.split('.') 24 | module_path, class_name = '.'.join(parts[:-1]), parts[-1] 25 | module = import_module(module_path) 26 | return getattr(module, class_name) 27 | except (ImportError, AttributeError) as e: 28 | msg = 'Could not import "{}"'.format(val) 29 | raise ImportError(msg) 30 | 31 | 32 | class Settings(object): 33 | @property 34 | def enabled_checks(self): 35 | imports = getattr(settings, 'VITALS_ENABLED_CHECKS', DEFAULT_CHECKS) 36 | checks = {} 37 | for i in imports: 38 | checks[i['NAME']] = { 39 | 'class': import_string(i['CLASS']), 40 | 'args': i.get('OPTIONS', {}) 41 | } 42 | return checks 43 | 44 | 45 | conf = Settings() 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *,cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | 93 | # Rope project settings 94 | .ropeproject 95 | -------------------------------------------------------------------------------- /vitals/checks.py: -------------------------------------------------------------------------------- 1 | from django.db import connections 2 | from django.conf import settings 3 | from django.core.cache import caches 4 | from django.core.files.storage import default_storage 5 | from django.core.files.base import ContentFile 6 | import requests 7 | 8 | 9 | class BaseHealthCheck(object): 10 | def __init__(self, *args, **kwargs): 11 | self.name = kwargs['name'] 12 | self.errors = [] 13 | 14 | def check(self): 15 | raise NotImplementedError('Must implement check() method') 16 | 17 | def add_error(self, message): 18 | self.errors.append(message) 19 | 20 | def run_check(self): 21 | try: 22 | self.check() 23 | except Exception as exc: 24 | self.add_error('Unexpected exception: {}'.format(exc)) 25 | 26 | 27 | class DatabaseCheck(BaseHealthCheck): 28 | def check(self): 29 | for db in settings.DATABASES: 30 | try: 31 | connections[db].introspection.table_names() 32 | except Exception as exc: 33 | self.add_error('Could not connect to {}: {}'.format(db, exc)) 34 | 35 | 36 | class CacheCheck(BaseHealthCheck): 37 | def check(self): 38 | for cache in settings.CACHES: 39 | try: 40 | inst = caches[cache] 41 | inst.set('vitals_health_check', 1) 42 | assert inst.get('vitals_health_check') == 1, 'Data mismatch' 43 | inst.delete('vitals_health_check') 44 | except Exception as exc: 45 | self.add_error('Cache set failed on {}: {}'.format(cache, exc)) 46 | 47 | 48 | class StorageCheck(BaseHealthCheck): 49 | def check(self): 50 | try: 51 | path = default_storage.save('vitals_test', ContentFile(b'.')) 52 | assert default_storage.open(path).read() == b'.', 'Data mismatch' 53 | default_storage.delete(path) 54 | assert not default_storage.exists(path), 'Data still exists' 55 | except Exception as exc: 56 | self.add_error('Could not write test file: {}'.format(exc)) 57 | 58 | 59 | class HTTPCheck(BaseHealthCheck): 60 | def __init__(self, *args, **kwargs): 61 | self.url = kwargs.pop('url') 62 | super(HTTPCheck, self).__init__(*args, **kwargs) 63 | 64 | def check(self): 65 | try: 66 | requests.get(self.url).raise_for_status() 67 | except Exception as exc: 68 | self.add_error('Endpoint {} unreachable: {}'.format(self.url, exc)) 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # django-vitals 2 | A django app that provides health check endpoints for vital services. 3 | 4 | [![Build Status](https://travis-ci.org/LCOGT/django-vitals.svg?branch=master)](https://travis-ci.org/LCOGT/django-vitals) 5 | [![Coverage Status](https://coveralls.io/repos/github/LCOGT/django-vitals/badge.svg?branch=master)](https://coveralls.io/github/LCOGT/django-vitals?branch=master) 6 | 7 | It is often useful to get the status of services from the perspective of the application that needs them. 8 | django-vitals provides a simple mechanism for writing a running health checks. These checks can then be exposed 9 | via an endpoint: 10 | 11 | ```json 12 | 13 | { 14 | "ok": [ 15 | "DatabaseCheck", 16 | "CacheCheck", 17 | "StorageCheck" 18 | ], 19 | "failed": {} 20 | } 21 | ``` 22 | Which in the above case, would return a status code of `200` 23 | 24 | If something is down: 25 | 26 | ```json 27 | { 28 | "ok": [ 29 | "DatabaseCheck", 30 | "CacheCheck", 31 | "StorageCheck" 32 | ], 33 | "failed": { 34 | "OtherMicroServiceEndpointCheck": [ 35 | "Endpoint http://suchabadsite11112222.com unreachable: Failed to establish a new connection: [Errno -2] Name or service not known" 36 | ] 37 | } 38 | } 39 | ``` 40 | 41 | a http code `500` is returned instead. 42 | 43 | Subsets of checks can be run by passing the `check` parameter to the endpoint: `?checks=DatabaseCheck,CacheCheck` 44 | 45 | This can be particularity useful when used along with load balancers, container orchestration and other 46 | infrastructure tools that can take automatic actions when problems arise. 47 | 48 | ## Requirements 49 | Tested with all combinations of: 50 | 51 | * Python 3.4+ 52 | * Django 1.8+ 53 | 54 | Python 2.7 probably works, but I have no interest in testing it. Support will be on a best effort basis. 55 | 56 | ## Installation 57 | 58 | Install the package from pypi: 59 | 60 | pip install django-vitals 61 | 62 | Add `vitals` to `INSTALLED_APPS`: 63 | 64 | ```python 65 | INSTALLED_APPS = ( 66 | ... 67 | 'vitals' 68 | ... 69 | ) 70 | ``` 71 | 72 | Add `vitals.urls` to your urlconf: 73 | 74 | ```python 75 | urlpatterns = [ 76 | ... 77 | url(r'^healthz/', include('vitals.urls', namespace='vitals')), 78 | ... 79 | ] 80 | ``` 81 | Visit the url in your browser. 82 | 83 | That's it if all you want is the default checks (`DatabaseCheck`, `CacheCheck`, `StorageCheck`) 84 | `HTTPCheck` is included but not enabled by default. 85 | 86 | 87 | ## Configuration 88 | 89 | By default 3 health checks are run: `DatabaseCheck`, `CacheCheck` and `StorageCheck`. 90 | Add `VITALS_ENABLED_CHECKS` to your `settings.py` to customize: 91 | 92 | ```python 93 | VITALS_ENABLED_CHECKS = [ 94 | { 95 | 'NAME': 'DatabaseCheck', 96 | 'CLASS': 'vitals.checks.DatabaseCheck' 97 | }, 98 | { 99 | 'NAME': 'CacheCheck', 100 | 'CLASS': 'vitals.checks.CacheCheck' 101 | }, 102 | { 103 | 'NAME': 'StorageCheck', 104 | 'CLASS': 'vitals.checks.StorageCheck' 105 | }, 106 | { 107 | 'NAME': 'HTTPCheck', 108 | 'CLASS': 'vitals.checks.HTTPCheck', 109 | 'OPTIONS': { 110 | 'url': 'https://google.com' 111 | } 112 | } 113 | ] 114 | ``` 115 | 116 | ## Included Checks 117 | 118 | ### DatabaseCheck 119 | Options: None 120 | 121 | Iterates over every database in `settings.DATABASES` and attempts to access the list of tables for each. 122 | 123 | ### CacheCheck 124 | Options: None 125 | 126 | Iterates over every cache in `settings.CACHES` and attempts to set a value, get it and remove it. 127 | 128 | ### StorageCheck 129 | Options: None 130 | 131 | Using the default storage backend, attempts to write a small file and delete it. 132 | 133 | ### HTTPCheck 134 | Options: `url` 135 | 136 | Attempts to GET the url provided by the `url` option. Will fail if the GET results in anything other than a `200` response code. 137 | 138 | ## Writing Custom Checks 139 | 140 | You are not limited to the included health checks. To write a custom check, simply subclass `BaseHealthCheck` 141 | and implement the `check()` method: 142 | 143 | ```python 144 | from vitals.checks import BaseHealthCheck 145 | 146 | class MyHealthCheck(BaseHealthCheck): 147 | def check(self): 148 | assert 2 == 2 149 | ``` 150 | 151 | Any exceptions thrown by your check will be added as errors. You can also manually add errors using `self.add_error(error)`: 152 | 153 | ```python 154 | from vitals.checks import BaseHealthCheck 155 | 156 | class MyHealthCheck(BaseHealthCheck): 157 | def check(self): 158 | try: 159 | assert 1 == 2 160 | except AssertionError as exc: 161 | self.add_error('Strange error! {}'.format(exc)) 162 | ``` 163 | 164 | Arguments can be passed to health checks by setting the `OPTIONS` key in settings: 165 | 166 | ```python 167 | VITALS_ENABLED_CHECKS = [ 168 | { 169 | 'NAME': 'MyFailingHealthCheck', 170 | 'CLASS': 'foo.MyHealthCheck', 171 | 'OPTIONS': { 172 | 'number': 3 173 | } 174 | } 175 | ] 176 | ``` 177 | 178 | They will be passed a kwargs to your class constructor: 179 | 180 | ```python 181 | from vitals.checks import BaseHealthCheck 182 | 183 | class MyHealthCheck(BaseHealthCheck): 184 | def __init__(self, *args, **kwargs): 185 | self.number = kwargs.pop('number') 186 | super(MyHealthCheck, self).__init__(*args, **kwargs) 187 | 188 | def check(self): 189 | assert self.number == 2 190 | ``` 191 | 192 | Add your custom checks to `VITALS_ENABLED_CHECKS` in `settings.py` providing the path to them in the `CLASS` key. 193 | -------------------------------------------------------------------------------- /tests/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase, modify_settings, override_settings 2 | from django.core.files.storage import Storage 3 | from unittest.mock import MagicMock, patch 4 | from requests.exceptions import HTTPError 5 | import json 6 | 7 | from vitals.conf import import_string, conf, DEFAULT_CHECKS 8 | from vitals.checks import DatabaseCheck, CacheCheck, StorageCheck, HTTPCheck 9 | from vitals.checks import BaseHealthCheck 10 | from vitals.views import run_checks 11 | 12 | 13 | class TestConf(TestCase): 14 | def test_import_string(self): 15 | module = import_string('numbers.Number') 16 | self.assertTrue(isinstance(1, module)) 17 | 18 | def test_bad_import(self): 19 | with self.assertRaises(ImportError): 20 | import_string('not.really.a.module') 21 | 22 | def test_settings_object(self): 23 | for check in DEFAULT_CHECKS: 24 | self.assertIn(check['NAME'], conf.enabled_checks.keys()) 25 | 26 | 27 | class TestChecks(TestCase): 28 | @modify_settings(DATABASES={'append': {'nonsense': {'ENGINE': 'nonsene'}}}) 29 | def test_database_check(self): 30 | check = DatabaseCheck(name='TestCheck') 31 | check.run_check() 32 | self.assertIn('Could not connect', check.errors[0]) 33 | self.assertEqual(len(check.errors), 1) 34 | 35 | def test_database_check_passes(self): 36 | check = DatabaseCheck(name='TestCheck') 37 | check.run_check() 38 | self.assertFalse(check.errors) 39 | 40 | @override_settings(CACHES={ 41 | 'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'} 42 | }) 43 | def test_cache_check(self): 44 | check = CacheCheck(name='TestCacheCheck') 45 | check.run_check() 46 | self.assertIn('Data mismatch', check.errors[0]) 47 | self.assertEqual(len(check.errors), 1) 48 | 49 | def test_cache_check_passes(self): 50 | check = CacheCheck(name='TestCacheCheck') 51 | check.run_check() 52 | self.assertFalse(check.errors) 53 | 54 | def test_storage_check(self): 55 | sm = MagicMock(spec=Storage, name='StorageMock') 56 | with patch('django.core.files.storage.default_storage._wrapped', sm): 57 | check = StorageCheck(name='TestStorageCheck') 58 | check.run_check() 59 | self.assertIn('Data mismatch', check.errors[0]) 60 | self.assertEqual(len(check.errors), 1) 61 | 62 | def test_stoage_check_passes(self): 63 | check = StorageCheck(name='TestStorageCheck') 64 | check.run_check() 65 | self.assertFalse(check.errors) 66 | 67 | @patch('requests.get', side_effect=HTTPError) 68 | def test_http_check(self, get_mock): 69 | check = HTTPCheck(name='TestHTTPCheck', url='groogle.nom') 70 | check.run_check() 71 | self.assertIn('groogle.nom unreachable', check.errors[0]) 72 | self.assertEqual(len(check.errors), 1) 73 | 74 | @patch('requests.get') 75 | def test_http_check_passes(self, get_mock): 76 | check = HTTPCheck(name='TestHTTPCheck', url='groogle.nom') 77 | check.run_check() 78 | self.assertFalse(check.errors) 79 | 80 | @patch('vitals.checks.CacheCheck.check', side_effect=Exception) 81 | def test_check_unexecpted_exception(self, mock_check): 82 | check = CacheCheck(name='TestCacheCheck') 83 | check.run_check() 84 | self.assertEqual(len(check.errors), 1) 85 | 86 | 87 | class TestViews(TestCase): 88 | def test_run_checks(self): 89 | result = run_checks() 90 | self.assertEqual(len(result['ok']), len(DEFAULT_CHECKS)) 91 | 92 | def test_run_single_check(self): 93 | result = run_checks(['DatabaseCheck']) 94 | self.assertEqual(len(result['ok']), 1) 95 | 96 | def test_run_multiple_checks(self): 97 | result = run_checks(['DatabaseCheck', 'CacheCheck']) 98 | self.assertEqual(len(result['ok']), 2) 99 | 100 | def test_run_checks_bad_check(self): 101 | with self.assertRaises(KeyError): 102 | run_checks(['notacheck']) 103 | 104 | def test_jsonview(self): 105 | result = json.loads(str(self.client.get('/').content, encoding='utf8')) 106 | self.assertEqual(len(result['ok']), len(DEFAULT_CHECKS)) 107 | 108 | def test_jsonview_check_param(self): 109 | response = self.client.get('/?checks=DatabaseCheck') 110 | result = json.loads(str(response.content, encoding='utf8')) 111 | self.assertEqual(len(result['ok']), 1) 112 | self.assertEqual(result['ok'][0], 'DatabaseCheck') 113 | 114 | def test_jsonview_check_param_multiple(self): 115 | response = self.client.get('/?checks=DatabaseCheck,CacheCheck') 116 | result = json.loads(str(response.content, encoding='utf8')) 117 | self.assertEqual(len(result['ok']), 2) 118 | self.assertEqual(result['ok'], ['DatabaseCheck', 'CacheCheck']) 119 | self.assertNotIn('StorageCheck', result['ok']) 120 | self.assertNotIn('StorageCheck', result['failed']) 121 | 122 | @patch('vitals.checks.CacheCheck.check', side_effect=Exception) 123 | def test_jsonview_check_fails(self, check_mock): 124 | response = self.client.get('/') 125 | result = json.loads(str(response.content, encoding='utf8')) 126 | self.assertEqual(len(result['failed']), 1) 127 | self.assertEqual(len(result['ok']), 2) 128 | self.assertEqual(response.status_code, 500) 129 | 130 | 131 | class BadCheck(BaseHealthCheck): 132 | pass 133 | 134 | 135 | class TestBadCheckImpl(TestCase): 136 | def test_check_has_no_check(self): 137 | bc = BadCheck(name='notgonnawork') 138 | bc.run_check() 139 | self.assertEqual(len(bc.errors), 1) 140 | self.assertIn('Must implement', bc.errors[0]) 141 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The GNU General Public License, Version 3, 29 June 2007 (GPLv3) 2 | =============================================================== 3 | 4 | > Copyright © 2007 5 | > Free Software Foundation, Inc. 6 | > <> 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this license 9 | document, but changing it is not allowed. 10 | 11 | 12 | Preamble 13 | -------- 14 | 15 | The GNU General Public License is a free, copyleft license for software and 16 | other kinds of works. 17 | 18 | The licenses for most software and other practical works are designed to take 19 | away your freedom to share and change the works. By contrast, the GNU General 20 | Public License is intended to guarantee your freedom to share and change all 21 | versions of a program--to make sure it remains free software for all its users. 22 | We, the Free Software Foundation, use the GNU General Public License for most of 23 | our software; it applies also to any other work released this way by its 24 | authors. You can apply it to your programs, too. 25 | 26 | When we speak of free software, we are referring to freedom, not price. Our 27 | General Public Licenses are designed to make sure that you have the freedom to 28 | distribute copies of free software (and charge for them if you wish), that you 29 | receive source code or can get it if you want it, that you can change the 30 | software or use pieces of it in new free programs, and that you know you can do 31 | these things. 32 | 33 | To protect your rights, we need to prevent others from denying you these rights 34 | or asking you to surrender the rights. Therefore, you have certain 35 | responsibilities if you distribute copies of the software, or if you modify it: 36 | responsibilities to respect the freedom of others. 37 | 38 | For example, if you distribute copies of such a program, whether gratis or for a 39 | fee, you must pass on to the recipients the same freedoms that you received. You 40 | must make sure that they, too, receive or can get the source code. And you must 41 | show them these terms so they know their rights. 42 | 43 | Developers that use the GNU GPL protect your rights with two steps: (1) assert 44 | copyright on the software, and (2) offer you this License giving you legal 45 | permission to copy, distribute and/or modify it. 46 | 47 | For the developers' and authors' protection, the GPL clearly explains that there 48 | is no warranty for this free software. For both users' and authors' sake, the 49 | GPL requires that modified versions be marked as changed, so that their problems 50 | will not be attributed erroneously to authors of previous versions. 51 | 52 | Some devices are designed to deny users access to install or run modified 53 | versions of the software inside them, although the manufacturer can do so. This 54 | is fundamentally incompatible with the aim of protecting users' freedom to 55 | change the software. The systematic pattern of such abuse occurs in the area of 56 | products for individuals to use, which is precisely where it is most 57 | unacceptable. Therefore, we have designed this version of the GPL to prohibit 58 | the practice for those products. If such problems arise substantially in other 59 | domains, we stand ready to extend this provision to those domains in future 60 | versions of the GPL, as needed to protect the freedom of users. 61 | 62 | Finally, every program is threatened constantly by software patents. States 63 | should not allow patents to restrict development and use of software on 64 | general-purpose computers, but in those that do, we wish to avoid the special 65 | danger that patents applied to a free program could make it effectively 66 | proprietary. To prevent this, the GPL assures that patents cannot be used to 67 | render the program non-free. 68 | 69 | The precise terms and conditions for copying, distribution and modification 70 | follow. 71 | 72 | 73 | TERMS AND CONDITIONS 74 | -------------------- 75 | 76 | 77 | ### 0. Definitions. 78 | 79 | "This License refers to version 3 of the GNU General Public License. 80 | 81 | "Copyright" also means copyright-like laws that apply to other kinds of works, 82 | such as semiconductor masks. 83 | 84 | "The Program" refers to any copyrightable work licensed under this License. Each 85 | licensee is addressed as "you". "Licensees" and "recipients" may be individuals 86 | or organizations. 87 | 88 | To "modify" a work means to copy from or adapt all or part of the work in a 89 | fashion requiring copyright permission, other than the making of an exact copy. 90 | The resulting work is called a "modified version" of the earlier work or a work 91 | "based on" the earlier work. 92 | 93 | A "covered work" means either the unmodified Program or a work based on the 94 | Program. 95 | 96 | To "propagate" a work means to do anything with it that, without permission, 97 | would make you directly or secondarily liable for infringement under applicable 98 | copyright law, except executing it on a computer or modifying a private copy. 99 | Propagation includes copying, distribution (with or without modification), 100 | making available to the public, and in some countries other activities as well. 101 | 102 | To "convey" a work means any kind of propagation that enables other parties to 103 | make or receive copies. Mere interaction with a user through a computer network, 104 | with no transfer of a copy, is not conveying. 105 | 106 | An interactive user interface displays "Appropriate Legal Notices" to the extent 107 | that it includes a convenient and prominently visible feature that (1) displays 108 | an appropriate copyright notice, and (2) tells the user that there is no 109 | warranty for the work (except to the extent that warranties are provided), that 110 | licensees may convey the work under this License, and how to view a copy of this 111 | License. If the interface presents a list of user commands or options, such as a 112 | menu, a prominent item in the list meets this criterion. 113 | 114 | 115 | ### 1. Source Code. 116 | 117 | The "source code" for a work means the preferred form of the work for making 118 | modifications to it. "Object code" means any non-source form of a work. 119 | 120 | A "Standard Interface" means an interface that either is an official standard 121 | defined by a recognized standards body, or, in the case of interfaces specified 122 | for a particular programming language, one that is widely used among developers 123 | working in that language. 124 | 125 | The "System Libraries" of an executable work include anything, other than the 126 | work as a whole, that (a) is included in the normal form of packaging a Major 127 | Component, but which is not part of that Major Component, and (b) serves only to 128 | enable use of the work with that Major Component, or to implement a Standard 129 | Interface for which an implementation is available to the public in source code 130 | form. A "Major Component", in this context, means a major essential component 131 | (kernel, window system, and so on) of the specific operating system (if any) on 132 | which the executable work runs, or a compiler used to produce the work, or an 133 | object code interpreter used to run it. 134 | 135 | The "Corresponding Source" for a work in object code form means all the source 136 | code needed to generate, install, and (for an executable work) run the object 137 | code and to modify the work, including scripts to control those activities. 138 | However, it does not include the work's System Libraries, or general-purpose 139 | tools or generally available free programs which are used unmodified in 140 | performing those activities but which are not part of the work. For example, 141 | Corresponding Source includes interface definition files associated with source 142 | files for the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, such as by 144 | intimate data communication or control flow between those subprograms and other 145 | parts of the work. 146 | 147 | The Corresponding Source need not include anything that users can regenerate 148 | automatically from other parts of the Corresponding Source. 149 | 150 | The Corresponding Source for a work in source code form is that same work. 151 | 152 | 153 | ### 2. Basic Permissions. 154 | 155 | All rights granted under this License are granted for the term of copyright on 156 | the Program, and are irrevocable provided the stated conditions are met. This 157 | License explicitly affirms your unlimited permission to run the unmodified 158 | Program. The output from running a covered work is covered by this License only 159 | if the output, given its content, constitutes a covered work. This License 160 | acknowledges your rights of fair use or other equivalent, as provided by 161 | copyright law. 162 | 163 | You may make, run and propagate covered works that you do not convey, without 164 | conditions so long as your license otherwise remains in force. You may convey 165 | covered works to others for the sole purpose of having them make modifications 166 | exclusively for you, or provide you with facilities for running those works, 167 | provided that you comply with the terms of this License in conveying all 168 | material for which you do not control copyright. Those thus making or running 169 | the covered works for you must do so exclusively on your behalf, under your 170 | direction and control, on terms that prohibit them from making any copies of 171 | your copyrighted material outside their relationship with you. 172 | 173 | Conveying under any other circumstances is permitted solely under the conditions 174 | stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 175 | 176 | 177 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 178 | 179 | No covered work shall be deemed part of an effective technological measure under 180 | any applicable law fulfilling obligations under article 11 of the WIPO copyright 181 | treaty adopted on 20 December 1996, or similar laws prohibiting or restricting 182 | circumvention of such measures. 183 | 184 | When you convey a covered work, you waive any legal power to forbid 185 | circumvention of technological measures to the extent such circumvention is 186 | effected by exercising rights under this License with respect to the covered 187 | work, and you disclaim any intention to limit operation or modification of the 188 | work as a means of enforcing, against the work's users, your or third parties' 189 | legal rights to forbid circumvention of technological measures. 190 | 191 | 192 | ### 4. Conveying Verbatim Copies. 193 | 194 | You may convey verbatim copies of the Program's source code as you receive it, 195 | in any medium, provided that you conspicuously and appropriately publish on each 196 | copy an appropriate copyright notice; keep intact all notices stating that this 197 | License and any non-permissive terms added in accord with section 7 apply to the 198 | code; keep intact all notices of the absence of any warranty; and give all 199 | recipients a copy of this License along with the Program. 200 | 201 | You may charge any price or no price for each copy that you convey, and you may 202 | offer support or warranty protection for a fee. 203 | 204 | 205 | ### 5. Conveying Modified Source Versions. 206 | 207 | You may convey a work based on the Program, or the modifications to produce it 208 | from the Program, in the form of source code under the terms of section 4, 209 | provided that you also meet all of these conditions: 210 | 211 | * **a)** The work must carry prominent notices stating that you modified it, 212 | and giving a relevant date. 213 | 214 | * **b)** The work must carry prominent notices stating that it is released 215 | under this License and any conditions added under section 7. This 216 | requirement modifies the requirement in section 4 to "keep intact all 217 | notices". 218 | 219 | * **c)** You must license the entire work, as a whole, under this License to 220 | anyone who comes into possession of a copy. This License will therefore 221 | apply, along with any applicable section 7 additional terms, to the whole of 222 | the work, and all its parts, regardless of how they are packaged. This 223 | License gives no permission to license the work in any other way, but it 224 | does not invalidate such permission if you have separately received it. 225 | 226 | * **d)** If the work has interactive user interfaces, each must display 227 | Appropriate Legal Notices; however, if the Program has interactive 228 | interfaces that do not display Appropriate Legal Notices, your work need not 229 | make them do so. 230 | 231 | A compilation of a covered work with other separate and independent works, 232 | which are not by their nature extensions of the covered work, and which are 233 | not combined with it such as to form a larger program, in or on a volume of 234 | a storage or distribution medium, is called an "aggregate" if the 235 | compilation and its resulting copyright are not used to limit the access or 236 | legal rights of the compilation's users beyond what the individual works 237 | permit. Inclusion of a covered work in an aggregate does not cause this 238 | License to apply to the other parts of the aggregate. 239 | 240 | 241 | ### 6. Conveying Non-Source Forms. 242 | 243 | You may convey a covered work in object code form under the terms of sections 4 244 | and 5, provided that you also convey the machine-readable Corresponding Source 245 | under the terms of this License, in one of these ways: 246 | 247 | * **a)** Convey the object code in, or embodied in, a physical product 248 | (including a physical distribution medium), accompanied by the Corresponding 249 | Source fixed on a durable physical medium customarily used for software 250 | interchange. 251 | 252 | * **b)** Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by a written offer, 254 | valid for at least three years and valid for as long as you offer spare 255 | parts or customer support for that product model, to give anyone who 256 | possesses the object code either (1) a copy of the Corresponding Source for 257 | all the software in the product that is covered by this License, on a 258 | durable physical medium customarily used for software interchange, for a 259 | price no more than your reasonable cost of physically performing this 260 | conveying of source, or (2) access to copy the Corresponding Source from a 261 | network server at no charge. 262 | 263 | * **c)** Convey individual copies of the object code with a copy of the 264 | written offer to provide the Corresponding Source. This alternative is 265 | allowed only occasionally and noncommercially, and only if you received the 266 | object code with such an offer, in accord with subsection 6b. 267 | 268 | * **d)** Convey the object code by offering access from a designated place 269 | (gratis or for a charge), and offer equivalent access to the Corresponding 270 | Source in the same way through the same place at no further charge. You need 271 | not require recipients to copy the Corresponding Source along with the 272 | object code. If the place to copy the object code is a network server, the 273 | Corresponding Source may be on a different server (operated by you or a 274 | third party) that supports equivalent copying facilities, provided you 275 | maintain clear directions next to the object code saying where to find the 276 | Corresponding Source. Regardless of what server hosts the Corresponding 277 | Source, you remain obligated to ensure that it is available for as long as 278 | needed to satisfy these requirements. 279 | 280 | * **e)** Convey the object code using peer-to-peer transmission, provided you 281 | inform other peers where the object code and Corresponding Source of the 282 | work are being offered to the general public at no charge under subsection 283 | 6d. 284 | 285 | A separable portion of the object code, whose source code is excluded from 286 | the Corresponding Source as a System Library, need not be included in 287 | conveying the object code work. 288 | 289 | A "User Product" is either (1) a "consumer product", which means any 290 | tangible personal property which is normally used for personal, family, or 291 | household purposes, or (2) anything designed or sold for incorporation into 292 | a dwelling. In determining whether a product is a consumer product, doubtful 293 | cases shall be resolved in favor of coverage. For a particular product 294 | received by a particular user, "normally used" refers to a typical or common 295 | use of that class of product, regardless of the status of the particular 296 | user or of the way in which the particular user actually uses, or expects or 297 | is expected to use, the product. A product is a consumer product regardless 298 | of whether the product has substantial commercial, industrial or non- 299 | consumer uses, unless such uses represent the only significant mode of use 300 | of the product. 301 | 302 | "Installation Information" for a User Product means any methods, procedures, 303 | authorization keys, or other information required to install and execute 304 | modified versions of a covered work in that User Product from a modified 305 | version of its Corresponding Source. The information must suffice to ensure 306 | that the continued functioning of the modified object code is in no case 307 | prevented or interfered with solely because modification has been made. 308 | 309 | If you convey an object code work under this section in, or with, or 310 | specifically for use in, a User Product, and the conveying occurs as part of 311 | a transaction in which the right of possession and use of the User Product 312 | is transferred to the recipient in perpetuity or for a fixed term 313 | (regardless of how the transaction is characterized), the Corresponding 314 | Source conveyed under this section must be accompanied by the Installation 315 | Information. But this requirement does not apply if neither you nor any 316 | third party retains the ability to install modified object code on the User 317 | Product (for example, the work has been installed in ROM). 318 | 319 | The requirement to provide Installation Information does not include a 320 | requirement to continue to provide support service, warranty, or updates for 321 | a work that has been modified or installed by the recipient, or for the User 322 | Product in which it has been modified or installed. Access to a network may 323 | be denied when the modification itself materially and adversely affects the 324 | operation of the network or violates the rules and protocols for 325 | communication across the network. 326 | 327 | Corresponding Source conveyed, and Installation Information provided, in 328 | accord with this section must be in a format that is publicly documented 329 | (and with an implementation available to the public in source code form), 330 | and must require no special password or key for unpacking, reading or 331 | copying. 332 | 333 | 334 | ### 7. Additional Terms. 335 | 336 | "Additional permissions" are terms that supplement the terms of this License by 337 | making exceptions from one or more of its conditions. Additional permissions 338 | that are applicable to the entire Program shall be treated as though they were 339 | included in this License, to the extent that they are valid under applicable 340 | law. If additional permissions apply only to part of the Program, that part may 341 | be used separately under those permissions, but the entire Program remains 342 | governed by this License without regard to the additional permissions. 343 | 344 | When you convey a copy of a covered work, you may at your option remove any 345 | additional permissions from that copy, or from any part of it. (Additional 346 | permissions may be written to require their own removal in certain cases when 347 | you modify the work.) You may place additional permissions on material, added by 348 | you to a covered work, for which you have or can give appropriate copyright 349 | permission. 350 | 351 | Notwithstanding any other provision of this License, for material you add to a 352 | covered work, you may (if authorized by the copyright holders of that material) 353 | supplement the terms of this License with terms: 354 | 355 | * **a)** Disclaiming warranty or limiting liability differently from the terms 356 | of sections 15 and 16 of this License; or 357 | 358 | * **b)** Requiring preservation of specified reasonable legal notices or 359 | author attributions in that material or in the Appropriate Legal Notices 360 | displayed by works containing it; or 361 | 362 | * **c)** Prohibiting misrepresentation of the origin of that material, or 363 | requiring that modified versions of such material be marked in reasonable 364 | ways as different from the original version; or 365 | 366 | * **d)** Limiting the use for publicity purposes of names of licensors or 367 | authors of the material; or 368 | 369 | * **e)** Declining to grant rights under trademark law for use of some trade 370 | names, trademarks, or service marks; or 371 | 372 | * **f)** Requiring indemnification of licensors and authors of that material 373 | by anyone who conveys the material (or modified versions of it) with 374 | contractual assumptions of liability to the recipient, for any liability 375 | that these contractual assumptions directly impose on those licensors and 376 | authors. 377 | 378 | All other non-permissive additional terms are considered "further restrictions" 379 | within the meaning of section 10. If the Program as you received it, or any part 380 | of it, contains a notice stating that it is governed by this License along with 381 | a term that is a further restriction, you may remove that term. If a license 382 | document contains a further restriction but permits relicensing or conveying 383 | under this License, you may add to a covered work material governed by the terms 384 | of that license document, provided that the further restriction does not survive 385 | such relicensing or conveying. 386 | 387 | If you add terms to a covered work in accord with this section, you must place, 388 | in the relevant source files, a statement of the additional terms that apply to 389 | those files, or a notice indicating where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the form of a 392 | separately written license, or stated as exceptions; the above requirements 393 | apply either way. 394 | 395 | 396 | ### 8. Termination. 397 | 398 | You may not propagate or modify a covered work except as expressly provided 399 | under this License. Any attempt otherwise to propagate or modify it is void, and 400 | will automatically terminate your rights under this License (including any 401 | patent licenses granted under the third paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your license from a 404 | particular copyright holder is reinstated (a) provisionally, unless and until 405 | the copyright holder explicitly and finally terminates your license, and (b) 406 | permanently, if the copyright holder fails to notify you of the violation by 407 | some reasonable means prior to 60 days after the cessation. 408 | 409 | Moreover, your license from a particular copyright holder is reinstated 410 | permanently if the copyright holder notifies you of the violation by some 411 | reasonable means, this is the first time you have received notice of violation 412 | of this License (for any work) from that copyright holder, and you cure the 413 | violation prior to 30 days after your receipt of the notice. 414 | 415 | Termination of your rights under this section does not terminate the licenses of 416 | parties who have received copies or rights from you under this License. If your 417 | rights have been terminated and not permanently reinstated, you do not qualify 418 | to receive new licenses for the same material under section 10. 419 | 420 | 421 | ### 9. Acceptance Not Required for Having Copies. 422 | 423 | You are not required to accept this License in order to receive or run a copy of 424 | the Program. Ancillary propagation of a covered work occurring solely as a 425 | consequence of using peer-to-peer transmission to receive a copy likewise does 426 | not require acceptance. However, nothing other than this License grants you 427 | permission to propagate or modify any covered work. These actions infringe 428 | copyright if you do not accept this License. Therefore, by modifying or 429 | propagating a covered work, you indicate your acceptance of this License to do 430 | so. 431 | 432 | 433 | ### 10. Automatic Licensing of Downstream Recipients. 434 | 435 | Each time you convey a covered work, the recipient automatically receives a 436 | license from the original licensors, to run, modify and propagate that work, 437 | subject to this License. You are not responsible for enforcing compliance by 438 | third parties with this License. 439 | 440 | An "entity transaction" is a transaction transferring control of an 441 | organization, or substantially all assets of one, or subdividing an 442 | organization, or merging organizations. If propagation of a covered work results 443 | from an entity transaction, each party to that transaction who receives a copy 444 | of the work also receives whatever licenses to the work the party's predecessor 445 | in interest had or could give under the previous paragraph, plus a right to 446 | possession of the Corresponding Source of the work from the predecessor in 447 | interest, if the predecessor has it or can get it with reasonable efforts. 448 | 449 | You may not impose any further restrictions on the exercise of the rights 450 | granted or affirmed under this License. For example, you may not impose a 451 | license fee, royalty, or other charge for exercise of rights granted under this 452 | License, and you may not initiate litigation (including a cross-claim or 453 | counterclaim in a lawsuit) alleging that any patent claim is infringed by 454 | making, using, selling, offering for sale, or importing the Program or any 455 | portion of it. 456 | 457 | 458 | ### 11. Patents. 459 | 460 | A "contributor" is a copyright holder who authorizes use under this License of 461 | the Program or a work on which the Program is based. The work thus licensed is 462 | called the contributor's "contributor version". 463 | 464 | A contributor's "essential patent claims" are all patent claims owned or 465 | controlled by the contributor, whether already acquired or hereafter acquired, 466 | that would be infringed by some manner, permitted by this License, of making, 467 | using, or selling its contributor version, but do not include claims that would 468 | be infringed only as a consequence of further modification of the contributor 469 | version. For purposes of this definition, "control" includes the right to grant 470 | patent sublicenses in a manner consistent with the requirements of this License. 471 | 472 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent 473 | license under the contributor's essential patent claims, to make, use, sell, 474 | offer for sale, import and otherwise run, modify and propagate the contents of 475 | its contributor version. 476 | 477 | In the following three paragraphs, a "patent license" is any express agreement 478 | or commitment, however denominated, not to enforce a patent (such as an express 479 | permission to practice a patent or covenant not to sue for patent infringement). 480 | To "grant" such a patent license to a party means to make such an agreement or 481 | commitment not to enforce a patent against the party. 482 | 483 | If you convey a covered work, knowingly relying on a patent license, and the 484 | Corresponding Source of the work is not available for anyone to copy, free of 485 | charge and under the terms of this License, through a publicly available network 486 | server or other readily accessible means, then you must either (1) cause the 487 | Corresponding Source to be so available, or (2) arrange to deprive yourself of 488 | the benefit of the patent license for this particular work, or (3) arrange, in a 489 | manner consistent with the requirements of this License, to extend the patent 490 | license to downstream recipients. "Knowingly relying" means you have actual 491 | knowledge that, but for the patent license, your conveying the covered work in a 492 | country, or your recipient's use of the covered work in a country, would 493 | infringe one or more identifiable patents in that country that you have reason 494 | to believe are valid. 495 | 496 | If, pursuant to or in connection with a single transaction or arrangement, you 497 | convey, or propagate by procuring conveyance of, a covered work, and grant a 498 | patent license to some of the parties receiving the covered work authorizing 499 | them to use, propagate, modify or convey a specific copy of the covered work, 500 | then the patent license you grant is automatically extended to all recipients of 501 | the covered work and works based on it. 502 | 503 | A patent license is "discriminatory" if it does not include within the scope of 504 | its coverage, prohibits the exercise of, or is conditioned on the non- exercise 505 | of one or more of the rights that are specifically granted under this License. 506 | You may not convey a covered work if you are a party to an arrangement with a 507 | third party that is in the business of distributing software, under which you 508 | make payment to the third party based on the extent of your activity of 509 | conveying the work, and under which the third party grants, to any of the 510 | parties who would receive the covered work from you, a discriminatory patent 511 | license (a) in connection with copies of the covered work conveyed by you (or 512 | copies made from those copies), or (b) primarily for and in connection with 513 | specific products or compilations that contain the covered work, unless you 514 | entered into that arrangement, or that patent license was granted, prior to 28 515 | March 2007. 516 | 517 | Nothing in this License shall be construed as excluding or limiting any implied 518 | license or other defenses to infringement that may otherwise be available to you 519 | under applicable patent law. 520 | 521 | 522 | ### 12. No Surrender of Others' Freedom. 523 | 524 | If conditions are imposed on you (whether by court order, agreement or 525 | otherwise) that contradict the conditions of this License, they do not excuse 526 | you from the conditions of this License. If you cannot convey a covered work so 527 | as to satisfy simultaneously your obligations under this License and any other 528 | pertinent obligations, then as a consequence you may not convey it at all. For 529 | example, if you agree to terms that obligate you to collect a royalty for 530 | further conveying from those to whom you convey the Program, the only way you 531 | could satisfy both those terms and this License would be to refrain entirely 532 | from conveying the Program. 533 | 534 | 535 | ### 13. Use with the GNU Affero General Public License. 536 | 537 | Notwithstanding any other provision of this License, you have permission to link 538 | or combine any covered work with a work licensed under version 3 of the GNU 539 | Affero General Public License into a single combined work, and to convey the 540 | resulting work. The terms of this License will continue to apply to the part 541 | which is the covered work, but the special requirements of the GNU Affero 542 | General Public License, section 13, concerning interaction through a network 543 | will apply to the combination as such. 544 | 545 | 546 | ### 14. Revised Versions of this License. 547 | 548 | The Free Software Foundation may publish revised and/or new versions of the GNU 549 | General Public License from time to time. Such new versions will be similar in 550 | spirit to the present version, but may differ in detail to address new problems 551 | or concerns. 552 | 553 | Each version is given a distinguishing version number. If the Program specifies 554 | that a certain numbered version of the GNU General Public License "or any later 555 | version" applies to it, you have the option of following the terms and 556 | conditions either of that numbered version or of any later version published by 557 | the Free Software Foundation. If the Program does not specify a version number 558 | of the GNU General Public License, you may choose any version ever published by 559 | the Free Software Foundation. 560 | 561 | If the Program specifies that a proxy can decide which future versions of the 562 | GNU General Public License can be used, that proxy's public statement of 563 | acceptance of a version permanently authorizes you to choose that version for 564 | the Program. 565 | 566 | Later license versions may give you additional or different permissions. 567 | However, no additional obligations are imposed on any author or copyright holder 568 | as a result of your choosing to follow a later version. 569 | 570 | 571 | ### 15. Disclaimer of Warranty. 572 | 573 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 574 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER 575 | PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 576 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 577 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 578 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 579 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 580 | 581 | 582 | ### 16. Limitation of Liability. 583 | 584 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY 585 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS 586 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 587 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE 588 | THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED 589 | INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE 590 | PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY 591 | HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 592 | 593 | ### 17. Interpretation of Sections 15 and 16. 594 | 595 | If the disclaimer of warranty and limitation of liability provided above cannot 596 | be given local legal effect according to their terms, reviewing courts shall 597 | apply local law that most closely approximates an absolute waiver of all civil 598 | liability in connection with the Program, unless a warranty or assumption of 599 | liability accompanies a copy of the Program in return for a fee. 600 | 601 | END OF TERMS AND CONDITIONS 602 | 603 | 604 | How to Apply These Terms to Your New Programs 605 | --------------------------------------------- 606 | 607 | If you develop a new program, and you want it to be of the greatest possible use 608 | to the public, the best way to achieve this is to make it free software which 609 | everyone can redistribute and change under these terms. 610 | 611 | To do so, attach the following notices to the program. It is safest to attach 612 | them to the start of each source file to most effectively state the exclusion of 613 | warranty; and each file should have at least the "copyright" line and a pointer 614 | to where the full notice is found. 615 | 616 | 617 | Copyright (C) 618 | 619 | This program is free software: you can redistribute it and/or modify it 620 | under the terms of the GNU General Public License as published by the Free 621 | Software Foundation, either version 3 of the License, or (at your option) 622 | any later version. 623 | 624 | This program is distributed in the hope that it will be useful, but WITHOUT 625 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 626 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 627 | more details. 628 | 629 | You should have received a copy of the GNU General Public License along with 630 | this program. If not, see . 631 | 632 | Also add information on how to contact you by electronic and paper mail. 633 | 634 | If the program does terminal interaction, make it output a short notice like 635 | this when it starts in an interactive mode: 636 | 637 | Copyright (C) 638 | This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. 639 | This is free software, and you are welcome to redistribute it under certain 640 | conditions; type 'show c' for details. 641 | 642 | The hypothetical commands 'show w' and 'show c' should show the appropriate 643 | parts of the General Public License. Of course, your program's commands might be 644 | different; for a GUI interface, you would use an "about box". 645 | 646 | You should also get your employer (if you work as a programmer) or school, if 647 | any, to sign a "copyright disclaimer" for the program, if necessary. For more 648 | information on this, and how to apply and follow the GNU GPL, see 649 | <>. 650 | 651 | The GNU General Public License does not permit incorporating your program into 652 | proprietary programs. If your program is a subroutine library, you may consider 653 | it more useful to permit linking proprietary applications with the library. If 654 | this is what you want to do, use the GNU Lesser General Public License instead 655 | of this License. But first, please read 656 | <>. 657 | --------------------------------------------------------------------------------