From 5be2e9ae50f9358d16f14e09c2e7d51ec1dc8755 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 9 Mar 2018 16:17:11 +0100 Subject: Add setup.py for Pip/setuptools support --- Makefile | 8 ++++++++ bibtool/cli.py | 5 +++-- setup.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100644 setup.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a56e3f4 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +FILES := $(wildcard bibtool/*.py) + +.PHONY: all checkstyle + +all: checkstyle + +checkstyle: $(FILES) + flake8 $^ diff --git a/bibtool/cli.py b/bibtool/cli.py index 3356d16..74855b9 100644 --- a/bibtool/cli.py +++ b/bibtool/cli.py @@ -37,7 +37,8 @@ def _import(filename, directory): if edited_data: bibtex_data = bibtexparser.loads(edited_data) if len(bibtex_data.entries) != 1: - raise Exception('The edited data must contain exactly one Bibtex entry.') + raise Exception('The edited data must contain exactly one' + 'Bibtex entry.') entry = bibtex_data.entries[0] click.confirm('Add {} to the repository?'.format(entry['ID']), @@ -46,7 +47,7 @@ def _import(filename, directory): bibfilename = os.path.join(directory, entry['ID'] + '.bib') outfileext = os.path.splitext(filename)[1] outfilename = os.path.join(directory, entry['ID'] + outfileext) - + if os.path.exists(bibfilename) or os.path.exists(outfilename): click.confirm('There is already a document with this ID in the ' 'repository. Continue anyway?', abort=True) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d871b5c --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +# Copyright (C) 2018 Robin Krahl +# SPDX-License-Identifier: MIT + +import setuptools + + +setuptools.setup( + name='bibtool', + version='0.0.1', + description='bibliography management tool', + author='Robin Krahl', + author_email='robin.krahl@ireas.org', + license='MIT', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'License :: OSI Approvied :: MIT License', + 'Programming Language :: Python :: 3', + ], + packages=['bibtool'], + install_requires=['bibtexparser', 'click', 'PyPDF2'], + extras_require={ + 'checkstyle': ['flake8'], + }, + entry_points={ + 'console_scripts': [ + 'bibtool=bibtool.cli:cli', + ], + }, +) -- cgit v1.2.1