forked from niwinz/phantompy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
74 lines (61 loc) · 2.15 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
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.spawn import find_executable
import distutils.command.build
import subprocess
import shutil
import shlex
import os.path
from os.path import join
import glob
class build(distutils.command.build.build):
def run(self):
result = distutils.command.build.build.run(self)
cwd = os.path.dirname(os.path.abspath(__file__))
new_module_dir = join(cwd, 'build', 'lib', 'phantompy')
self._compile_phantompy(cwd)
for filename in glob.glob(os.path.join(cwd, 'build', '_phantompy*')):
if os.path.isfile(filename) and not os.path.islink(filename):
shutil.copy(filename, os.path.join(new_module_dir, '_phantompy.so'))
return result
def _compile_phantompy(self, cwd):
retval = subprocess.call(shlex.split('cmake ..'),
cwd=os.path.join(cwd, 'build'))
if retval:
raise Exception("CMake Error!")
retval = subprocess.call(shlex.split('make'),
cwd=os.path.join(cwd, 'build'))
if retval:
raise Exception("CMake Error!")
setup(
name = 'phantompy',
version = "0.10",
description = "Headless WebKit engine for python build on top of Qt5 and Webkit",
long_description = "",
keywords = 'webkit, headless, qt, engine',
author = 'Andrey Antukh',
author_email = '[email protected]',
url = 'https://github.com/niwibe/phantompy',
license = 'BSD',
zip_safe = False,
packages = [
"phantompy",
],
#cmdclass={
# 'build': build,
#},
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Topic :: Internet :: WWW/HTTP',
]
)