-
Notifications
You must be signed in to change notification settings - Fork 15
/
setup.py
56 lines (47 loc) · 1.35 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
#!/bin/env python
import os
import subprocess
import shutil
from distutils.core import setup
from distutils.extension import Extension
from distutils.cmd import Command
if hasattr(os, 'uname'):
OSNAME = os.uname()[0]
else:
OSNAME = 'Windows'
if OSNAME == 'Linux':
def pkgconfig(flags):
return subprocess.check_output(
'pkg-config %s gtk+-3.0 webkit2gtk-4.0' % flags,
shell=True,
stderr=subprocess.STDOUT).decode('utf-8')
define_macros = [("WEBVIEW_GTK", '1')]
extra_cflags = pkgconfig("--cflags").split()
extra_ldflags = pkgconfig("--libs").split()
elif OSNAME == 'Darwin':
define_macros = [('WEBVIEW_COCOA', '1')]
extra_cflags = ""
extra_ldflags = ['-framework', 'CoreAudio']
elif OSNAME == 'Windows':
define_macros = [('WEBVIEW_WINAPI', '1')]
extra_cflags = ""
extra_ldflags = ['-framework', 'CoreAudio']
webview = Extension(
'webview',
sources=['webview/webview.c'],
define_macros=define_macros,
extra_compile_args=extra_cflags,
extra_link_args=extra_ldflags,
)
setup(
name='webview',
version='0.1.5',
description='Python WebView bindings',
author='Serge Zaitsev',
author_email='zaitsev.serge@gmail.com',
url='https://github.com/zserge/webview',
keywords=[],
license='MIT',
classifiers=[],
ext_modules=[webview],
)