forked from wxWidgets/Phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-wxsvg.py
74 lines (65 loc) · 2.45 KB
/
setup-wxsvg.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
#----------------------------------------------------------------------
# Name: setup-wxsvg.py
# Purpose: Distutils build script for wxPython's wx.svg package
#
# Author: Robin Dunn
#
# Created: 25-July-2019
# Copyright: (c) 2019-2020 by Total Control Software
# License: wxWindows License
#----------------------------------------------------------------------
import sys
import os
import textwrap
from setuptools import setup, Extension
try:
from Cython.Build import cythonize
have_cython = True
except ImportError:
have_cython = False
# Create a buildtools.config.Configuration object, to get the VERSION
from buildtools.config import Config
cfg = Config(noWxConfig=True)
DESCRIPTION = 'Wrapper for nanosvg library, plus code for integrating with wxPython'
LONG_DESCRIPTION = ''
AUTHOR = 'Robin Dunn'
AUTHOR_EMAIL = '[email protected]'
URL = "http://wxPython.org/"
DOWNLOAD_URL = "https://pypi.org/project/wxPython"
LICENSE = "wxWindows Library License (https://opensource.org/licenses/wxwindows.php)"
PLATFORMS = "WIN32,WIN64,OSX,POSIX"
HERE = os.path.abspath(os.path.dirname(__file__))
PACKAGE = 'wx.svg'
PACKAGEDIR = 'wx/svg'
BUILD_OPTIONS = { 'build_base' : 'build/wxsvg' }
if have_cython:
SOURCE = os.path.join(PACKAGEDIR, '_nanosvg.pyx')
else:
SOURCE = os.path.join(PACKAGEDIR, '_nanosvg.c')
module = Extension(name='wx.svg._nanosvg',
sources=[SOURCE],
include_dirs=['ext/nanosvg/src'],
define_macros=[('NANOSVG_IMPLEMENTATION', '1'),
('NANOSVGRAST_IMPLEMENTATION', '1'),
('NANOSVG_ALL_COLOR_KEYWORDS', '1'),
])
if have_cython:
modules = cythonize([module],
compiler_directives={'embedsignature': True,
'language_level':2,
})
else:
modules = [module]
setup(name = 'wx.svg',
version = cfg.VERSION,
description = DESCRIPTION,
long_description = LONG_DESCRIPTION,
author = AUTHOR,
author_email = AUTHOR_EMAIL,
url = URL,
download_url = DOWNLOAD_URL,
license = LICENSE,
#packages = [PACKAGE],
ext_modules = modules,
options = { 'build' : BUILD_OPTIONS, },
)