├── isbnlib_kb ├── test │ ├── __init__.py │ ├── README.md │ └── test_metadata.py ├── __init__.py └── _kb.py ├── requirements.txt ├── MANIFEST.in ├── CHANGES.txt ├── requirements-appveyor.in ├── requirements-appveyor.txt ├── requirements-dev.in ├── requirements-dev.txt ├── setup.cfg ├── README.rst ├── tox-dev.ini ├── tox.ini ├── COPYRIGHT.txt ├── .travis.yml ├── CONTRIBUTING.md ├── setup.py ├── CODE_OF_CONDUCT.md └── LICENSE-LGPL.txt /isbnlib_kb/test/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | isbnlib>=3.9.1,<3.11.0 2 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | include *.rst 3 | -------------------------------------------------------------------------------- /isbnlib_kb/test/README.md: -------------------------------------------------------------------------------- 1 | Put here some tests... 2 | -------------------------------------------------------------------------------- /CHANGES.txt: -------------------------------------------------------------------------------- 1 | v0.0.1, 2021-29-10 -- Initial beta release. 2 | -------------------------------------------------------------------------------- /requirements-appveyor.in: -------------------------------------------------------------------------------- 1 | coverage 2 | flake8 3 | nose 4 | tox 5 | wheel 6 | isbnlib 7 | -------------------------------------------------------------------------------- /requirements-appveyor.txt: -------------------------------------------------------------------------------- 1 | coverage==4.4.2 2 | flake8==3.7.6 3 | isbnlib==3.9.5 4 | nose==1.3.7 5 | tox==3.7.0 6 | wheel==0.33.1 7 | -------------------------------------------------------------------------------- /requirements-dev.in: -------------------------------------------------------------------------------- 1 | coverage 2 | flake8 3 | flake8-bugbear 4 | flake8-commas 5 | flake8-docstrings 6 | flake8-import-order 7 | isort 8 | nose 9 | pep8-naming 10 | tox 11 | wheel 12 | yapf 13 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | coverage==4.5.2 2 | flake8-bugbear==18.8.0 3 | flake8-commas==2.0.0 4 | flake8-docstrings==1.3.0 5 | flake8-import-order==0.16 6 | flake8==3.7.6 7 | isort==4.2.15 8 | nose==1.3.7 9 | pep8-naming==0.7.0 10 | tox==3.7.0 11 | wheel==0.33.1 12 | yapf==0.20.1 13 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | 4 | 5 | [nosetests] 6 | verbosity=1 7 | with-coverage=1 8 | cover-package=isbnlib_kb 9 | cover-branches=1 10 | cover-min-percentage=90 11 | 12 | 13 | [pep257] 14 | ignore=D203 15 | 16 | 17 | [flake8] 18 | ignore=N806,E721,W503 19 | exclude=*/test/* 20 | max-complexity=13 21 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | A metadata plugin for ``isbnlib`` (https://pypi.python.org/pypi/isbnlib) using the service of the KB (National Library of the Netherlands). 2 | 3 | After install, a new metadata provider (``kb``) is available in isbnlib. 4 | 5 | For available plugins check_ here. 6 | 7 | 8 | 9 | .. _check: https://pypi.python.org/pypi?%3Aaction=search&term=isbnlib_&submit=search 10 | 11 | -------------------------------------------------------------------------------- /isbnlib_kb/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # flake8: noqa 3 | # pylint: skip-file 4 | from ._kb import query 5 | 6 | __version__ = '0.0.1' 7 | 8 | __plugin_author__ = 'willemjan' 9 | __plugin_description__ = 'Metadata for books from the National Library of the Netherlands' 10 | __plugin_homepage__ = 'github.com/kbNLresearch/isbnlib-kb' 11 | __plugin_service_language__ = 'nl' 12 | __plugin_service_name__ = 'kb' 13 | __plugin_type__ = 'metadata' 14 | -------------------------------------------------------------------------------- /tox-dev.ini: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore=N806,I100,I101,I201,N802,C901,E722,E741 3 | exclude=*/test/* 4 | max-complexity=10 5 | 6 | [pep257] 7 | ignore=D203 8 | 9 | [tox] 10 | envlist=py27,py37,py38,nightly 11 | 12 | [testenv] 13 | deps= 14 | nose 15 | coverage 16 | https://github.com/xlcnd/isbnlib/archive/dev.zip 17 | commands= 18 | nosetests -v --with-coverage --cover-package=isbnlib_loc --cover-min-percentage=90 19 | python -c "from isbnlib_loc import query;print(query('9780321534965'))" 20 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore=N806,I100,I101,I201,N802,C901,E722,E741 3 | exclude=*/test/* 4 | max-complexity=10 5 | 6 | [pep257] 7 | ignore=D203 8 | 9 | [tox] 10 | envlist=py27,py38,py36,py37,py38,py39,nightly,checkers 11 | 12 | [testenv] 13 | deps= 14 | nose 15 | coverage 16 | isbnlib 17 | commands= 18 | nosetests -v --with-coverage --cover-package=isbnlib_kb --cover-min-percentage=90 19 | python -c "from isbnlib_kb import query;print(query('9021615258'))" 20 | 21 | [testenv:checkers] 22 | basepython=python 23 | deps= 24 | isbnlib 25 | flake8 26 | flake8-bugbear 27 | flake8-commas 28 | flake8-import-order 29 | pep8-naming 30 | commands= 31 | flake8 isbnlib_kb 32 | -------------------------------------------------------------------------------- /COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | 2 | isbnlib-loc -- an isbnlib plugin that pulls metadata from LoC Library of Congress (US) 3 | Copyright (C) 2018-2019 Alexandre Lima Conde 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | -------------------------------------------------------------------------------- /isbnlib_kb/test/test_metadata.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # flake8: noqa 3 | # pylint: skip-file 4 | """nose tests for metadata.""" 5 | 6 | from nose.tools import assert_equals 7 | from isbnlib import meta 8 | from .._kb import query 9 | 10 | 11 | def test_query(): 12 | """Test the query of metadata (National Library of the Netherlands (KB)) with 'low level' queries.""" 13 | assert_equals(len(repr(query('9789045040110'))) > 100, True) 14 | print(repr(query('9021615258'))) 15 | print(len(repr(query('9021615258')))) 16 | assert_equals(len(repr(query('9021615258'))) > 100, True) 17 | 18 | 19 | def test_query_missing(): 20 | """Test KB with 'low level' queries (missing data).""" 21 | assert_equals(len(repr(query('9781849692341'))) <= 2, True) 22 | assert_equals(len(repr(query('9781849692343'))) <= 2, True) 23 | 24 | 25 | def test_query_wrong(): 26 | """Test KB with 'low level' queries (wrong data).""" 27 | assert_equals(len(repr(query('9780000000'))) <= 2, True) 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: python 3 | branches: 4 | only: 5 | - dev 6 | - v1.0.2 7 | - master 8 | matrix: 9 | include: 10 | - os: osx 11 | language: generic 12 | env: TOXENV=py37 13 | - python: "2.7" 14 | env: TOXENV=py27 15 | - python: "3.8" 16 | env: TOXENV=py38 17 | - python: "nightly" 18 | env: TOXENV=nightly 19 | - python: "3.7" 20 | env: TOXENV=checkers 21 | - python: "3.8" 22 | env: ENV=dev 23 | - python: "3.7" 24 | env: TOXENV=py37 25 | - python: "3.9" 26 | env: TOXENV=py39 27 | allow_failures: 28 | - env: TOXENV=nightly 29 | - env: ENV=dev 30 | install: 31 | - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then pip3 install tox; fi 32 | - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then pip3 install -r requirements.txt; fi 33 | - if [[ $TRAVIS_OS_NAME == 'linux' ]]; then pip install tox; fi 34 | - if [[ $TRAVIS_OS_NAME == 'linux' ]]; then pip install -r requirements.txt; fi 35 | - if [[ $TOXENV == 'checkers' ]]; then pip install -r requirements.txt; fi 36 | - if [[ $TOXENV == 'checkers' ]]; then pip install flake8; fi 37 | - if [[ $TOXENV == 'checkers' ]]; then pip install pep8-naming; fi 38 | - if [[ $TOXENV == 'py37' ]]; then pip install coveralls; fi 39 | - if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then pip install yapf; fi 40 | script: 41 | - if [[ $TRAVIS_PULL_REQUEST != 'false' ]] && [[ $TOXENV == 'checkers' ]]; then yapf -i isbnlib_kb; fi 42 | - if [[ ! -z $TOXENV ]]; then tox -e $TOXENV; fi 43 | - if [[ $ENV == 'dev' ]]; then tox -e py38 -c tox-dev.ini; fi 44 | after_success: 45 | - if [[ $TOXENV == 'py37' ]]; then coveralls; fi 46 | notifications: 47 | email: false 48 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | `isbnlib-loc` has a very small code base, so it is a good project to begin your 4 | adventure in open-source. 5 | 6 | > **NOTE**: By contributing you agree with the [license terms](LICENSE-LGPL.txt) 7 | (**LGPL v3**) of the project. 8 | 9 | 10 | ## Main Steps 11 | 12 | 1. Make sure you have a [GitHub account](https://github.com/signup/free) 13 | 2. Submit a ticket for your issue or idea 14 | ([help](https://www.youtube.com/watch?v=TJlYiMp8FuY)), 15 | on https://github.com/xlcnd/isbnlib_porbase/issues, 16 | (if possible wait for some feedback before any serious commitment... :) 17 | 3. **Fork** the repository on GitHub and **clone it locally** 18 | ([help](https://help.github.com/articles/fork-a-repo)). 19 | 4. `pip install -r requirements-dev.txt` (at your local directory). 20 | 5. Do your code... (**remember the code must run on python 2.7, 3.4+, 21 | and be OS independent** It is easier if you start to write in python 3 and then 22 | adapt for python 2) (you will find [Travis](https://travis-ci.org) very handy for 23 | testing with this requirement!) 24 | 6. Write tests for your code using `nose` and put then in the directory `isbnlib_porbase/test` 25 | 7. Pass **all tests** and with **coverage > 90%**. 26 | Check the coverage in [Coveralls](https://coveralls.io) or locally with the command 27 | `nosetests --with-coverage --cover-package=isbnlib_porbase`. 28 | 8. **Check if all requirements are fulfilled**! 29 | 9. **Push** your local changes to GitHub and make there a **pull request** 30 | ([help](https://help.github.com/articles/using-pull-requests/)) 31 | **using `dev` as base branch** (by the way, we follow the *fork & pull* model with this small change). 32 | 33 | > **NOTE**: *Travis*, *coverage* and *flake8*, have already 34 | configuration files adapted to the project. 35 | 36 | ## Style 37 | 38 | Your code **must** be [PEP8](http://legacy.python.org/dev/peps/pep-0008/) compliant 39 | and be concise as possible (use `yapf` then check it with 40 | `flake8` and `pylint`). 41 | 42 | Use doc strings ([PEP257](http://legacy.python.org/dev/peps/pep-0257/)) 43 | for users and comments (**few**) as signposts 44 | for fellow developers. Make your code as clear as possible. 45 | 46 | 47 | ## Red Lines 48 | 49 | **Don't submit pull requests that are only comments to the code that is 50 | already in the repo!** 51 | 52 | **No** doc tests! Remember point 6 above. 53 | 54 | **Don't** submit pull requests without checking point 8! 55 | 56 | 57 | 58 | ## Important 59 | 60 | If you don't have experience with these issues, don't be put off by these requirements, 61 | see them as a learning opportunity. Thanks! 62 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # flake8: noqa 3 | # isort:skip_file 4 | 5 | # This version of isbnlib_kb-kb is a clone of: 6 | # isbnlib-loc -- an isbnlib plugin for the LoC Library of Congress (US) 7 | # Copyright (C) 2018 Alexandre Lima Conde 8 | 9 | # This program is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU Lesser General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU Lesser General Public License 20 | # along with this program. If not, see . 21 | 22 | from setuptools import setup 23 | from isbnlib_kb import __version__ 24 | 25 | setup( 26 | name='isbnlib-kb', 27 | version=__version__, 28 | author='willemjan', 29 | author_email='willemjan.faber@kb.nl', 30 | url='https://github.com/kbNLresearch/isbnlib-kb', 31 | download_url='https://github.com/kbNLresearch/isbnlib-kb/archive/v%s.zip' % __version__, 32 | packages=['isbnlib_kb/'], 33 | entry_points={'isbnlib.metadata': ['kb=isbnlib_kb:query']}, 34 | install_requires=["isbnlib>=3.9.1,<3.11.0"], 35 | license='LGPL v3', 36 | description='A plugin for isbnlib that pulls metadata from the KB (National Library of the Netherlands).', 37 | long_description=open('README.rst').read(), 38 | keywords='ISBN isbnlib kb bibliographic-references', 39 | classifiers=[ 40 | 'Programming Language :: Python', 41 | 'Programming Language :: Python :: 2', 42 | 'Programming Language :: Python :: 2.7', 43 | 'Programming Language :: Python :: 3', 44 | 'Programming Language :: Python :: 3.4', 45 | 'Programming Language :: Python :: 3.5', 46 | 'Programming Language :: Python :: 3.6', 47 | 'Programming Language :: Python :: 3.7', 48 | 'Programming Language :: Python :: 3.8', 49 | 'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)', 50 | 'Operating System :: OS Independent', 51 | 'Development Status :: 5 - Production/Stable', 52 | 'Intended Audience :: Developers', 53 | 'Intended Audience :: End Users/Desktop', 54 | 'Environment :: Console', 55 | 'Topic :: Text Processing :: General', 56 | 'Topic :: Software Development :: Libraries :: Python Modules', 57 | ], 58 | ) 59 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [xlcnd@outlook.com]. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | -------------------------------------------------------------------------------- /isbnlib_kb/_kb.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Query the KB (National Library of the Netherlands) service for metadata.""" 3 | 4 | import logging 5 | from xml.dom.minidom import parseString 6 | 7 | from isbnlib import to_isbn10 8 | from isbnlib.dev import stdmeta 9 | from isbnlib.dev._bouth23 import u 10 | from isbnlib.dev.webquery import query as wquery 11 | 12 | LOGGER = logging.getLogger(__name__) 13 | UA = "isbnlib (gzip)" 14 | SERVICE_URL = ( 15 | "https://jsru.kb.nl/sru/sru?" 16 | "version=1.2&maximumRecords=1&" 17 | "operation=searchRetrieve&startRecord=0" 18 | "&recordSchema=dc&x-collection=GGC&" 19 | "query=query=identifier.ISBN%20exact%20{isbn}" 20 | ) 21 | 22 | 23 | def _get_text(topnode): 24 | """Get the text values in the child nodes.""" 25 | text = "" 26 | for node in topnode.childNodes: 27 | if node.nodeType == node.TEXT_NODE: # pragma: no cover 28 | text = text + node.data 29 | return text 30 | 31 | 32 | def _clean_title(title): 33 | """Clean the Title field of some unnecessary annotations.""" 34 | title = title.replace("<", "")\ 35 | .replace(">", "")\ 36 | .replace(" :", ":")\ 37 | .split("/")[0] 38 | return title.strip(":.,; ") 39 | 40 | 41 | def _clean_publisher(publisher): 42 | """Clean the Publisher field of some unnecessary annotations.""" 43 | if ":" in publisher: 44 | publisher = publisher.split(":")[1] 45 | publisher = publisher.replace(" ; ", "; ").replace("/", "") 46 | return publisher.strip(":.,; ") 47 | 48 | 49 | def _clean_author(author): 50 | """Clean the Author field of some unnecessary annotations.""" 51 | author = author.replace("author", "")\ 52 | .replace(" :", ":")\ 53 | .split("/")[0]\ 54 | .split(";")[0] 55 | if "(" in author: 56 | author = author.split(")")[0] + ")" 57 | if "-" in author: 58 | author = author.split("-")[0][:-4] 59 | return author.strip(":.,; ") 60 | 61 | 62 | def parser_kb(xml): 63 | """Parse the response from the KB (National Library of the Netherlands) service (NL).""" 64 | # handle special case 65 | if "numberOfRecords>0<" in xml: 66 | return {} 67 | # parse xml and extract canonical fields (Dublin Core) 68 | dom = parseString(xml) 69 | keys = ("Title", "Authors", "Publisher", "Year", "Language") 70 | fields = ("dc:title", 71 | "dc:creator", 72 | "dc:publisher", 73 | "dc:date", 74 | "dc:language") 75 | recs = {} 76 | try: 77 | for key, field in zip(keys, fields): 78 | nodes = dom.getElementsByTagName("srw:recordData")[0]\ 79 | .getElementsByTagName(field) 80 | txt = "|".join([_get_text(node) for node in nodes]) 81 | recs[key] = u(txt) 82 | # cleanning 83 | publisher = recs["Publisher"].split("|")[0] 84 | recs["Publisher"] = _clean_publisher(publisher) 85 | authors = recs["Authors"].split("|") 86 | recs["Authors"] = [_clean_author(author) for author in authors] 87 | recs["Year"] = recs["Year"].split(" ")[-1] 88 | recs["Title"] = _clean_title(recs["Title"]) 89 | recs["Language"] = recs["Language"].split("|")[0] 90 | except Exception as exc: 91 | LOGGER.debug("Check the parsing for KB (%r)", exc, exc_info=True) 92 | return recs 93 | 94 | 95 | def _mapper(isbn, records): 96 | """Make records canonical. 97 | 98 | canonical: ISBN-13, Title, Authors, Publisher, Year, Language 99 | """ 100 | # handle special case 101 | if not records: # pragma: no cover 102 | LOGGER.debug("No data from KB for isbn %s", isbn) 103 | return {} 104 | # add ISBN-13 105 | records["ISBN-13"] = u(isbn) 106 | # call stdmeta for extra cleanning and validation 107 | return stdmeta(records) 108 | 109 | 110 | def query(isbn): 111 | """Query the KB service for metadata.""" 112 | data = wquery(SERVICE_URL.format(isbn=isbn), 113 | user_agent=UA, 114 | parser=parser_kb) 115 | if not data.get("Title") and len(isbn) > 10: 116 | try: 117 | data = wquery( 118 | SERVICE_URL.format(isbn=to_isbn10(isbn)), 119 | user_agent=UA, 120 | parser=parser_kb, 121 | ) 122 | except Exception as exc: 123 | LOGGER.debug("Check the parsing for KB (%r)", exc, exc_info=True) 124 | data = {} 125 | return _mapper(isbn, data) 126 | -------------------------------------------------------------------------------- /LICENSE-LGPL.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | --------------------------------------------------------------------------------