-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
57 lines (49 loc) · 1.67 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
#!/usr/bin/env python
"""
setup.py file for SWIG
written by [email protected]
"""
from distutils.core import setup, Extension, Command
import sys,os,platform
osname=platform.uname()[0]
if osname=='Darwin':
prefix="/opt/local"
else:
prefix=sys.prefix
incl=os.path.join(prefix,"include")
print "include path=%s"%incl
version_number=os.getcwd().split("-")[-1]
print "Current Version : %s"%version_number
class CleanCommand(Command):
description = "custom clean command that forcefully removes dist/build directories"
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
assert os.getcwd() == self.cwd, 'Must be in package root: %s' % self.cwd
os.system('rm -rf ./build ./dist')
def inclpath(mlib):
return os.path.join(incl,mlib)
tesseract_module = Extension('_tesseract',
sources=['tesseract.i','' 'main_dummy.cpp','fmemopen.c'],
swig_opts=["-c++", "-I"+inclpath('tesseract'),
"-I"+incl,
"-I"+inclpath('leptonica')],
include_dirs=['.',inclpath('tesseract'),
incl,
inclpath('leptonica')],
libraries=['stdc++','tesseract','lept'],
)
setup (name = 'python-tesseract',
version = version_number,
author = "FreeToGo Nowhere",
description = """${python:Provides} Wrapper for Python-${python:Versions} """,
ext_modules = [tesseract_module],
py_modules = ["tesseract"],
cmdclass={
'clean': CleanCommand
}
# data_files=[('.',['test.py','eurotext.tif','eurotext.jpg']),],
)