diff options
author | Robin Krahl <me@robin-krahl.de> | 2018-03-09 16:17:11 +0100 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2018-03-09 16:17:11 +0100 |
commit | 5be2e9ae50f9358d16f14e09c2e7d51ec1dc8755 (patch) | |
tree | a30d68209d07a085e16d76f77be5ec816e4a9414 | |
parent | 4a0cdafd28b4288b8f9fae9db84b0ebd8dfba8a8 (diff) | |
download | bibtool-5be2e9ae50f9358d16f14e09c2e7d51ec1dc8755.tar.gz bibtool-5be2e9ae50f9358d16f14e09c2e7d51ec1dc8755.tar.bz2 |
Add setup.py for Pip/setuptools support
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | bibtool/cli.py | 5 | ||||
-rw-r--r-- | setup.py | 29 |
3 files changed, 40 insertions, 2 deletions
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 <robin.krahl@ireas.org> +# 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', + ], + }, +) |