- Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
72 lines (63 loc) · 1.96 KB
/
Copy pathsetup.py
File metadata and controls
72 lines (63 loc) · 1.96 KB
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
64
65
66
67
68
69
70
71
72
from __future__ importprint_function
importos
importre
importsys
importsite
importshutil
fromsiximportadd_metaclass
fromdistutils.sysconfigimportget_python_lib
fromsetuptoolsimportsetup, find_packages, Extension
fromsetuptools.command.installimportinstallasinstall_default
defget_version():
v=''
withopen('VERSION', 'r') aslines:
v=list(lines)[0]
returnv
defprebuild():
suffix=''
ifsys.platform=='linux'orsys.platform=='linux2':
suffix='.so'
elifsys.platform=='darwin':
suffix='.so'
elifsys.platform=='win32':
suffix='.pyd'
else:
print('Sorry, unsupported OS: {}'.format(sys.platform))
return
out_dir='build/lib'
out_format=re.compile('pylime\.?([a-zA-Z0-9]+)?(-[a-zA-Z0-9_]+)?(-[a-zA-Z0-9\-_]+)?'+suffix)
out_file=None
forfinos.listdir(out_dir):
m=out_format.search(f)
ifmisnotNone:
out_file=m.group(0)
break
ifout_fileisNone:
print('Please build the library with CMake first.')
print('If you did it, please make sure the path of the shared library.')
raiseException('Installation failed!!')
return (get_python_lib(), [os.path.join(out_dir, out_file)])
# Install
classinstall(install_default):
defrun(self):
install_default.run(self)
# Setup
setup(
cmdclass={ 'install' : install },
name='pylime',
version=get_version(),
author='tatsy',
author_email='tatsy.mail@gmail.com',
url='https://github.com/tatsy/lime.git',
description='Library for IMage Editing.',
license='MIT',
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: C++',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
data_files=[prebuild()]
)