forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py.template
More file actions
103 lines (94 loc) · 3.22 KB
/
setup.py.template
File metadata and controls
103 lines (94 loc) · 3.22 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
try:
# The setuptools package is not installed by default
# on a clean Ubuntu. Might be also a case on Windows.
# Python Eggs and Wheels can be created only with setuptools.
from setuptools import setup
from setuptools.command.install import install as _install
from setuptools.dist import Distribution
print("[setup.py] Using setuptools")
except:
from distutils.core import setup
from distutils.command.install import install as _install
from distutils.dist import Distribution
print("[setup.py] Using distutils")
import sys
import os
import subprocess
def post_install():
""" Post install tasks """
print("[setup.py] post_install()")
# Find package directory.
# Do not import from local cefpython3/ directory.
del sys.path[0]
sys.path.append('')
import cefpython3
package_dir = os.path.dirname(cefpython3.__file__)
# Make sure this is not a local package imported
print("[setup.py] package_dir = %s" % package_dir)
assert not package_dir.startswith(
os.path.dirname(os.path.abspath(__file__)))
# Execute permissions for subprocess.exe and cefclient.exe
subprocess_exe = os.path.join(package_dir, "subprocess")
cefclient_exe = os.path.join(package_dir, "cefclient")
print("[setup.py] chmod +x " + subprocess_exe)
subprocess.call("chmod +x "+subprocess_exe, shell=True)
print("[setup.py] chmod +x " + cefclient_exe)
subprocess.call("chmod +x "+cefclient_exe, shell=True)
# Write permissions for debug.log files
commands = [
"chmod 666 %s/debug.log" % package_dir,
"chmod 666 %s/examples/debug.log" % package_dir,
"chmod 666 %s/examples/wx/debug.log" % package_dir,
]
for command in commands:
print("[setup.py] %s" % command)
subprocess.call(command, shell=True)
class install(_install):
def run(self):
_install.run(self)
post_install()
class BinaryDistribution(Distribution):
def is_pure(self):
return False
setup(
distclass=BinaryDistribution,
cmdclass={'install': install},
name='cefpython3', # No spaces here, so that it works with deb packages.
version='%(APP_VERSION)s',
description='Python bindings for the Chromium Embedded Framework',
license='BSD 3-Clause',
author='Czarek Tomczak',
author_email='[email protected]',
url='http://code.google.com/p/cefpython/',
platforms=['%(PLATFORM)s'],
packages=['cefpython3', 'cefpython3.wx'],
package_data={'cefpython3': [
'examples/*.py',
'examples/*.html',
'examples/*.js',
'examples/*.css',
'examples/*.png',
'examples/*.txt',
'examples/kivy-select-boxes/*.html',
'examples/kivy-select-boxes/*.js',
'examples/kivy-select-boxes/*.css',
'examples/kivy-select-boxes/*.md',
'examples/wx/*.py',
'examples/wx/*.html',
'examples/wx/*.png',
'locales/*.pak',
'wx/*.txt',
'wx/images/*.png',
'*.txt',
'License',
'cefclient',
'subprocess',
'*.so',
'*.pak',
'*.bin',
'*.dat',
'debug.log',
'examples/debug.log',
'examples/wx/debug.log',
]}
)