File: setup.py

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (49 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (2)
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
#----------------------------------------------------------------------
# Name:        setup.py
# Purpose:     Distutils build script for wxPython (phoenix)
#
# Author:      Robin Dunn
#
# Created:     27-Mar-2013
# Copyright:   (c) 2013-2016 by Total Control Software
# License:     wxWindows License
#----------------------------------------------------------------------
#---------------------------------------------------------------------------
# This setup file is placed in the root folder of the source dist tarball,
# and will be used to help do automated builds from tools like easy_install
# or pip.  These tools expect to find at least the setup.py in the root
# folder, so let's accommodate them...
#---------------------------------------------------------------------------

import sys, os, glob

# Restructure the content of the tarball so things like pip or easy_install
# know how to build stuff. To be compatible with those tools the main source
# dir needs to be the root, so move all of Phoenix/* here.
SRC = 'Phoenix'
if os.path.exists(SRC) and os.path.isdir(SRC):
    items = os.listdir(SRC)
    for item in items:
        os.rename(os.path.join(SRC, item), item)
    os.rmdir(SRC)

# Somewhere along the way (probably when pip untars the source tar file) any
# executable permissions set on files in the tarball gets lost. Some of them
# will break our build if they are not executable, so turn them back on.
for wc in ['wxWidgets/configure',
           'wxWidgets/src/stc/gen_iface.py',
           'bin/waf-*', ]:
    for item in glob.glob(wc):
        os.chmod(item, 0o755)


# Now execute the real setup.py that was copied here in order to do whatever
# command was trying to be done before.
if sys.version_info < (3,):
    execfile('setup.py')
else:
    f = open('setup.py', 'r')
    source = f.read()
    f.close()
    exec(source)