diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-10 21:57:54 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 21:57:54 +0000 |
commit | 98aad402e2399c13a2c531433b40eca9d4cd66b8 (patch) | |
tree | 3254ebb6a4a85f8f271edabb78df516f19df1d4d | |
parent | 5d8c3354f4811cf58ce7f0c7a851e9a469379c5a (diff) |
automatic import of python-ebooklib
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-ebooklib.spec | 387 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 389 insertions, 0 deletions
@@ -0,0 +1 @@ +/EbookLib-0.18.tar.gz diff --git a/python-ebooklib.spec b/python-ebooklib.spec new file mode 100644 index 0000000..455da84 --- /dev/null +++ b/python-ebooklib.spec @@ -0,0 +1,387 @@ +%global _empty_manifest_terminate_build 0 +Name: python-EbookLib +Version: 0.18 +Release: 1 +Summary: Ebook library which can handle EPUB2/EPUB3 and Kindle format +License: GNU Affero General Public License +URL: https://github.com/aerkalov/ebooklib +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e8/1d/90bb33317d756c25b40bb55312dda30a94afb691755763fc00976250c82b/EbookLib-0.18.tar.gz +BuildArch: noarch + + +%description +# About EbookLib + +EbookLib is a Python library for managing EPUB2/EPUB3 and Kindle files. It's capable of reading and writing EPUB files programmatically (Kindle support is under development). + +The API is designed to be as simple as possible, while at the same time making complex things possible too. It has support for covers, table of contents, spine, guide, metadata and etc. + +EbookLib is used in `Booktype <https://github.com/sourcefabric/Booktype/>`_ from Sourcefabric, as well as `sprits-it! <https://github.com/the-happy-hippo/sprits-it>`_, `fanfiction2ebook <https://github.com/ltouroumov/fanfiction2ebook>`_, `viserlalune <https://github.com/vjousse/viserlalune>`_ and `Telemeta <https://github.com/Parisson/Telemeta>`_. + +Packages of EbookLib for GNU/Linux are available in `Debian <https://packages.debian.org/python-ebooklib>`_ and `Ubuntu <http://packages.ubuntu.com/python-ebooklib>`_. + +Sphinx documentation is generated from the templates in the docs/ directory and made available at http://ebooklib.readthedocs.io + +# Usage + +## Reading +```py +import ebooklib +from ebooklib import epub + +book = epub.read_epub('test.epub') + +for image in book.get_items_of_type(ebooklib.ITEM_IMAGE): + print(image) +``` + + +## Writing +```py +from ebooklib import epub + +book = epub.EpubBook() + +# set metadata +book.set_identifier("id123456") +book.set_title("Sample book") +book.set_language("en") + +book.add_author("Author Authorowski") +book.add_author( + "Danko Bananko", + file_as="Gospodin Danko Bananko", + role="ill", + uid="coauthor", +) + +# create chapter +c1 = epub.EpubHtml(title="Intro", file_name="chap_01.xhtml", lang="hr") +c1.content = ( + "<h1>Intro heading</h1>" + "<p>Zaba je skocila u baru.</p>" + '<p><img alt="[ebook logo]" src="static/ebooklib.gif"/><br/></p>' +) + +# create image from the local image +image_content = open("ebooklib.gif", "rb").read() +img = epub.EpubImage( + uid="image_1", + file_name="static/ebooklib.gif", + media_type="image/gif", + content=image_content, +) + +# add chapter +book.add_item(c1) +# add image +book.add_item(img) + +# define Table Of Contents +book.toc = ( + epub.Link("chap_01.xhtml", "Introduction", "intro"), + (epub.Section("Simple book"), (c1,)), +) + +# add default NCX and Nav file +book.add_item(epub.EpubNcx()) +book.add_item(epub.EpubNav()) + +# define CSS style +style = "BODY {color: white;}" +nav_css = epub.EpubItem( + uid="style_nav", + file_name="style/nav.css", + media_type="text/css", + content=style, +) + +# add CSS file +book.add_item(nav_css) + +# basic spine +book.spine = ["nav", c1] + +# write to the file +epub.write_epub("test.epub", book, {}) +``` + + +# License +EbookLib is licensed under the `AGPL license <LICENSE.txt>`_. + + +# Authors +Full list of authors is in `AUTHORS.txt <AUTHORS.txt>`_ file. + + + + +%package -n python3-EbookLib +Summary: Ebook library which can handle EPUB2/EPUB3 and Kindle format +Provides: python-EbookLib +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-EbookLib +# About EbookLib + +EbookLib is a Python library for managing EPUB2/EPUB3 and Kindle files. It's capable of reading and writing EPUB files programmatically (Kindle support is under development). + +The API is designed to be as simple as possible, while at the same time making complex things possible too. It has support for covers, table of contents, spine, guide, metadata and etc. + +EbookLib is used in `Booktype <https://github.com/sourcefabric/Booktype/>`_ from Sourcefabric, as well as `sprits-it! <https://github.com/the-happy-hippo/sprits-it>`_, `fanfiction2ebook <https://github.com/ltouroumov/fanfiction2ebook>`_, `viserlalune <https://github.com/vjousse/viserlalune>`_ and `Telemeta <https://github.com/Parisson/Telemeta>`_. + +Packages of EbookLib for GNU/Linux are available in `Debian <https://packages.debian.org/python-ebooklib>`_ and `Ubuntu <http://packages.ubuntu.com/python-ebooklib>`_. + +Sphinx documentation is generated from the templates in the docs/ directory and made available at http://ebooklib.readthedocs.io + +# Usage + +## Reading +```py +import ebooklib +from ebooklib import epub + +book = epub.read_epub('test.epub') + +for image in book.get_items_of_type(ebooklib.ITEM_IMAGE): + print(image) +``` + + +## Writing +```py +from ebooklib import epub + +book = epub.EpubBook() + +# set metadata +book.set_identifier("id123456") +book.set_title("Sample book") +book.set_language("en") + +book.add_author("Author Authorowski") +book.add_author( + "Danko Bananko", + file_as="Gospodin Danko Bananko", + role="ill", + uid="coauthor", +) + +# create chapter +c1 = epub.EpubHtml(title="Intro", file_name="chap_01.xhtml", lang="hr") +c1.content = ( + "<h1>Intro heading</h1>" + "<p>Zaba je skocila u baru.</p>" + '<p><img alt="[ebook logo]" src="static/ebooklib.gif"/><br/></p>' +) + +# create image from the local image +image_content = open("ebooklib.gif", "rb").read() +img = epub.EpubImage( + uid="image_1", + file_name="static/ebooklib.gif", + media_type="image/gif", + content=image_content, +) + +# add chapter +book.add_item(c1) +# add image +book.add_item(img) + +# define Table Of Contents +book.toc = ( + epub.Link("chap_01.xhtml", "Introduction", "intro"), + (epub.Section("Simple book"), (c1,)), +) + +# add default NCX and Nav file +book.add_item(epub.EpubNcx()) +book.add_item(epub.EpubNav()) + +# define CSS style +style = "BODY {color: white;}" +nav_css = epub.EpubItem( + uid="style_nav", + file_name="style/nav.css", + media_type="text/css", + content=style, +) + +# add CSS file +book.add_item(nav_css) + +# basic spine +book.spine = ["nav", c1] + +# write to the file +epub.write_epub("test.epub", book, {}) +``` + + +# License +EbookLib is licensed under the `AGPL license <LICENSE.txt>`_. + + +# Authors +Full list of authors is in `AUTHORS.txt <AUTHORS.txt>`_ file. + + + + +%package help +Summary: Development documents and examples for EbookLib +Provides: python3-EbookLib-doc +%description help +# About EbookLib + +EbookLib is a Python library for managing EPUB2/EPUB3 and Kindle files. It's capable of reading and writing EPUB files programmatically (Kindle support is under development). + +The API is designed to be as simple as possible, while at the same time making complex things possible too. It has support for covers, table of contents, spine, guide, metadata and etc. + +EbookLib is used in `Booktype <https://github.com/sourcefabric/Booktype/>`_ from Sourcefabric, as well as `sprits-it! <https://github.com/the-happy-hippo/sprits-it>`_, `fanfiction2ebook <https://github.com/ltouroumov/fanfiction2ebook>`_, `viserlalune <https://github.com/vjousse/viserlalune>`_ and `Telemeta <https://github.com/Parisson/Telemeta>`_. + +Packages of EbookLib for GNU/Linux are available in `Debian <https://packages.debian.org/python-ebooklib>`_ and `Ubuntu <http://packages.ubuntu.com/python-ebooklib>`_. + +Sphinx documentation is generated from the templates in the docs/ directory and made available at http://ebooklib.readthedocs.io + +# Usage + +## Reading +```py +import ebooklib +from ebooklib import epub + +book = epub.read_epub('test.epub') + +for image in book.get_items_of_type(ebooklib.ITEM_IMAGE): + print(image) +``` + + +## Writing +```py +from ebooklib import epub + +book = epub.EpubBook() + +# set metadata +book.set_identifier("id123456") +book.set_title("Sample book") +book.set_language("en") + +book.add_author("Author Authorowski") +book.add_author( + "Danko Bananko", + file_as="Gospodin Danko Bananko", + role="ill", + uid="coauthor", +) + +# create chapter +c1 = epub.EpubHtml(title="Intro", file_name="chap_01.xhtml", lang="hr") +c1.content = ( + "<h1>Intro heading</h1>" + "<p>Zaba je skocila u baru.</p>" + '<p><img alt="[ebook logo]" src="static/ebooklib.gif"/><br/></p>' +) + +# create image from the local image +image_content = open("ebooklib.gif", "rb").read() +img = epub.EpubImage( + uid="image_1", + file_name="static/ebooklib.gif", + media_type="image/gif", + content=image_content, +) + +# add chapter +book.add_item(c1) +# add image +book.add_item(img) + +# define Table Of Contents +book.toc = ( + epub.Link("chap_01.xhtml", "Introduction", "intro"), + (epub.Section("Simple book"), (c1,)), +) + +# add default NCX and Nav file +book.add_item(epub.EpubNcx()) +book.add_item(epub.EpubNav()) + +# define CSS style +style = "BODY {color: white;}" +nav_css = epub.EpubItem( + uid="style_nav", + file_name="style/nav.css", + media_type="text/css", + content=style, +) + +# add CSS file +book.add_item(nav_css) + +# basic spine +book.spine = ["nav", c1] + +# write to the file +epub.write_epub("test.epub", book, {}) +``` + + +# License +EbookLib is licensed under the `AGPL license <LICENSE.txt>`_. + + +# Authors +Full list of authors is in `AUTHORS.txt <AUTHORS.txt>`_ file. + + + + +%prep +%autosetup -n EbookLib-0.18 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-EbookLib -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.18-1 +- Package Spec generated @@ -0,0 +1 @@ +715eb4ce7ee5cbeaff506e16c965ae6a EbookLib-0.18.tar.gz |