forked from virantha/pypdfocr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
63 lines (55 loc) · 1.66 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from __future__ import print_function
from setuptools import setup, find_packages
import pypdfocr
import io
from pypdfocr.version import __version__
from setuptools import Command
import os
class PyTest(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import sys,subprocess
cwd = os.getcwd()
os.chdir('test')
errno = subprocess.call([sys.executable, 'runtests.py'])
os.chdir(cwd)
raise SystemExit(errno)
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
buf.append(f.read())
return sep.join(buf)
packages = find_packages(exclude="tests")
long_description = read('README.rst', 'CHANGES.rst', 'TODO.rst')
with open("requirements.txt") as f:
required = f.read().splitlines()
setup (
name = "pypdfocr",
version = __version__,
description="Converts a scanned PDF into an OCR'ed pdf using Tesseract-OCR and Ghostscript",
license = "ASL 2.0",
long_description = long_description,
author="Virantha N. Ekanayake",
author_email="virantha@gmail.com", # Removed.
package_data = {'': ['*.xml']},
zip_safe = True,
include_package_data = True,
packages = packages,
install_requires = required,
entry_points = {
'console_scripts': [
'pypdfocr = pypdfocr.pypdfocr:main'
],
},
options = {
"pyinstaller": {"packages": packages}
},
cmdclass = {'test':PyTest}
)