Fix setup.py

pull/2/head
Vinayak Mehta 2018-09-11 05:57:24 +05:30
parent 0ed1e6381e
commit 077b3c3e0f
4 changed files with 19 additions and 51 deletions

View File

@ -3,6 +3,7 @@ from pprint import pprint
import click
from . import __version__
from .io import read_pdf
from .plotting import plot_geometry
from .utils import validate_input, remove_extra
@ -17,6 +18,7 @@ class Mutex(click.Option):
@click.command()
@click.version_option(version=__version__)
@click.option("-p", "--pages", default="1", help="Comma-separated page numbers"
" to parse. Example: 1,3,4 or 1,4-end")
@click.option("-o", "--output", help="Output filepath.")

View File

@ -1,11 +1,3 @@
click==6.7
matplotlib==2.2.3
numpy==1.13.3
opencv-python==3.4.2.17
pandas==0.23.4
pdfminer==20140328
Pillow==5.2.0
PyPDF2==1.26.0
pytest==3.8.0
pytest-runner==4.2
Sphinx==1.8.0b1
Sphinx==1.7.9

View File

@ -4,5 +4,4 @@ numpy==1.13.3
opencv-python==3.4.2.17
pandas==0.23.4
pdfminer==20140328
Pillow==5.2.0
PyPDF2==1.26.0

View File

@ -1,9 +1,16 @@
import os
from setuptools import find_packages
from pkg_resources import parse_version
import camelot
here = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(here, 'camelot', '__version__.py'), 'r') as f:
exec(f.read(), about)
# TODO: Move these to __version__.py
NAME = 'camelot'
VERSION = camelot.__version__
VERSION = about['__version__']
DESCRIPTION = 'PDF Table Parsing for Humans'
with open('README.md') as f:
LONG_DESCRIPTION = f.read()
@ -12,27 +19,6 @@ AUTHOR = 'Vinayak Mehta'
AUTHOR_EMAIL = 'vmehta94@gmail.com'
LICENSE = 'MIT License'
opencv_min_version = '2.4.8'
def get_opencv_status():
"""
Returns a dictionary containing a boolean specifying whether OpenCV
is up-to-date, along with the version string (empty string if
not installed).
"""
opencv_status = {}
try:
import cv2
opencv_version = cv2.__version__
opencv_status['up_to_date'] = parse_version(
opencv_version) >= parse_version(opencv_min_version)
opencv_status['version'] = opencv_version
except ImportError:
opencv_status['up_to_date'] = False
opencv_status['version'] = ""
return opencv_status
def setup_package():
reqs = []
@ -40,12 +26,10 @@ def setup_package():
for line in f:
reqs.append(line.strip())
extra_reqs = {
'dev': []
}
dev_reqs = []
with open('requirements-dev.txt', 'r') as f:
for line in f:
extra_reqs['dev'].append(line.strip())
dev_reqs.append(line.strip())
metadata = dict(name=NAME,
version=VERSION,
@ -55,9 +39,11 @@ def setup_package():
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENSE,
packages=['camelot'],
packages=find_packages(exclude=('tests',)),
install_requires=reqs,
extra_requires=extra_reqs,
extras_require={
'dev': dev_reqs
},
entry_points={
'console_scripts': [
'camelot = camelot.cli:cli',
@ -75,19 +61,8 @@ def setup_package():
except:
from distutils.core import setup
opencv_status = get_opencv_status()
opencv_req_str = "camelot requires OpenCV >= {0}.\n".format(opencv_min_version)
if opencv_status['up_to_date'] is False:
if opencv_status['version']:
raise ImportError("Your installation of OpenCV {} is out-of-date.\n{}"
.format(opencv_status['version'], opencv_req_str))
else:
raise ImportError("OpenCV is not installed.\n{}"
.format(opencv_req_str))
setup(**metadata)
if __name__ == '__main__':
setup_package()
setup_package()