Fix setup.py
parent
0ed1e6381e
commit
077b3c3e0f
|
|
@ -3,6 +3,7 @@ from pprint import pprint
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
|
from . import __version__
|
||||||
from .io import read_pdf
|
from .io import read_pdf
|
||||||
from .plotting import plot_geometry
|
from .plotting import plot_geometry
|
||||||
from .utils import validate_input, remove_extra
|
from .utils import validate_input, remove_extra
|
||||||
|
|
@ -17,6 +18,7 @@ class Mutex(click.Option):
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
|
@click.version_option(version=__version__)
|
||||||
@click.option("-p", "--pages", default="1", help="Comma-separated page numbers"
|
@click.option("-p", "--pages", default="1", help="Comma-separated page numbers"
|
||||||
" to parse. Example: 1,3,4 or 1,4-end")
|
" to parse. Example: 1,3,4 or 1,4-end")
|
||||||
@click.option("-o", "--output", help="Output filepath.")
|
@click.option("-o", "--output", help="Output filepath.")
|
||||||
|
|
|
||||||
|
|
@ -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==3.8.0
|
||||||
pytest-runner==4.2
|
pytest-runner==4.2
|
||||||
Sphinx==1.8.0b1
|
Sphinx==1.7.9
|
||||||
|
|
@ -4,5 +4,4 @@ numpy==1.13.3
|
||||||
opencv-python==3.4.2.17
|
opencv-python==3.4.2.17
|
||||||
pandas==0.23.4
|
pandas==0.23.4
|
||||||
pdfminer==20140328
|
pdfminer==20140328
|
||||||
Pillow==5.2.0
|
|
||||||
PyPDF2==1.26.0
|
PyPDF2==1.26.0
|
||||||
55
setup.py
55
setup.py
|
|
@ -1,9 +1,16 @@
|
||||||
|
import os
|
||||||
|
from setuptools import find_packages
|
||||||
from pkg_resources import parse_version
|
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'
|
NAME = 'camelot'
|
||||||
VERSION = camelot.__version__
|
VERSION = about['__version__']
|
||||||
DESCRIPTION = 'PDF Table Parsing for Humans'
|
DESCRIPTION = 'PDF Table Parsing for Humans'
|
||||||
with open('README.md') as f:
|
with open('README.md') as f:
|
||||||
LONG_DESCRIPTION = f.read()
|
LONG_DESCRIPTION = f.read()
|
||||||
|
|
@ -12,27 +19,6 @@ AUTHOR = 'Vinayak Mehta'
|
||||||
AUTHOR_EMAIL = 'vmehta94@gmail.com'
|
AUTHOR_EMAIL = 'vmehta94@gmail.com'
|
||||||
LICENSE = 'MIT License'
|
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():
|
def setup_package():
|
||||||
reqs = []
|
reqs = []
|
||||||
|
|
@ -40,12 +26,10 @@ def setup_package():
|
||||||
for line in f:
|
for line in f:
|
||||||
reqs.append(line.strip())
|
reqs.append(line.strip())
|
||||||
|
|
||||||
extra_reqs = {
|
dev_reqs = []
|
||||||
'dev': []
|
|
||||||
}
|
|
||||||
with open('requirements-dev.txt', 'r') as f:
|
with open('requirements-dev.txt', 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
extra_reqs['dev'].append(line.strip())
|
dev_reqs.append(line.strip())
|
||||||
|
|
||||||
metadata = dict(name=NAME,
|
metadata = dict(name=NAME,
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
|
|
@ -55,9 +39,11 @@ def setup_package():
|
||||||
author=AUTHOR,
|
author=AUTHOR,
|
||||||
author_email=AUTHOR_EMAIL,
|
author_email=AUTHOR_EMAIL,
|
||||||
license=LICENSE,
|
license=LICENSE,
|
||||||
packages=['camelot'],
|
packages=find_packages(exclude=('tests',)),
|
||||||
install_requires=reqs,
|
install_requires=reqs,
|
||||||
extra_requires=extra_reqs,
|
extras_require={
|
||||||
|
'dev': dev_reqs
|
||||||
|
},
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'camelot = camelot.cli:cli',
|
'camelot = camelot.cli:cli',
|
||||||
|
|
@ -75,17 +61,6 @@ def setup_package():
|
||||||
except:
|
except:
|
||||||
from distutils.core import setup
|
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)
|
setup(**metadata)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue