-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
executable file
·140 lines (123 loc) · 3.9 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#-------------------------------------------------------------------------
#
# PyGUI - Distutils Setup Script
#
#-------------------------------------------------------------------------
import os, sys
from glob import glob
from distutils.core import setup
#from distutils.extension import Extension
from distutils.sysconfig import get_python_lib
from distutils_extensions import pygui_build_py
#
# PyPI Classifiers
#
CLASSIFIERS = """\
Development Status :: 3 - Alpha
Environment :: MacOS X :: Cocoa
Environment :: Win32 (MS Windows)
Environment :: X11 Applications :: GTK
Intended Audience :: Developers
Operating System :: MacOS :: MacOS X
Operating System :: POSIX :: Linux
Operating System :: Microsoft :: Windows
Programming Language :: Python
Topic :: Software Development :: User Interfaces
""" #Programming Language :: Python :: 3
#
# Python 3 Conversion
#
if sys.version_info >= (3,0): #automatically convert to Python 3 syntax while installing
# #build_py_2to3 now imported in distutils_extensions
# try:
# from distutils.command.build_py import build_py_2to3 as build_py
# except ImportError:
# raise ImportError("build_py_2to3 not found in distutils - it is required for Python 3.x")
## # exclude fixers that break already compatible code
## from lib2to3.refactor import get_fixers_from_package
## fixers = get_fixers_from_package('lib2to3.fixes')
## for skip_fixer in ['import']:
## fixers.remove('lib2to3.fixes.fix_' + skip_fixer)
## build_py.fixer_names = fixers
print('Installing for Python3')
# else: # install Python 2.x version
# from distutils.command.build_py import build_py
#
# Installation parameters
#
cmd_class = {'build_py': pygui_build_py}
ext_modules = []
version = '<version not found>'
version_file = os.path.join("GUI", "Version.py")
# get accurate version sring by running Version.py
exec(compile(open(version_file,'r').read(), version_file, 'exec'))
#
# Find which implementation to install
#
plat = sys.platform
if plat.startswith("darwin"):
platdir = "Cocoa"
elif plat.startswith("linux"):
try:
import gtk
platdir = "Gtk"
except:
try:
import gi.repository.Gtk
platdir = "GtkGI"
except:
sys.stderr.write(
"Don't know which backend to install for platform '%s', no gtk or gi found.\n"
% plat)
sys.exit(1)
elif plat.startswith("win"):
platdir = "Win32"
else:
sys.stderr.write(
"Don't know which backend to install for platform '%s'.\n"
% plat)
sys.exit(1)
sys.stdout.write("Installing backend %s\n" % platdir)
#
# Pyrex
#
#have_pyrex = 0
#try:
# import Pyrex.Distutils
# print "Pyrex available"
# have_pyrex = 1
# cmdclass = {'build_ext': Pyrex.Distutils.build_ext}
#except ImportError:
# pass
#if sys.platform == "darwin":
# if have_pyrex:
# agl_source = "GUI/Mac/AGL.pyx"
# else:
# agl_source = "GUI/Mac/AGL.c"
# agl_module = Extension("GUI.Mac.AGL", [agl_source],
# include_dirs = ["/System/Library/Frameworks/AGL.framework/Headers"],
# extra_link_args = ["-Wl,-w", "-framework", "AGL", "-framework", "Carbon"])
# ext_modules.append(agl_module)
#
# Setup
#
setup(
cmdclass = cmd_class,
name = "PyGUI",
version = version,
description = "Pythonic Cross-Platform GUI Framework",
author = "Gregory Ewing",
author_email = "[email protected]",
url = "http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui",
#download_url=DOWNLOAD_URL,
long_description = open('README.txt').read(),
platforms = ["Linux", "MacOS X", "Windows"],
packages = ["GUI"],
package_subdirs = {"GUI": ["Generic", platdir]},
package_data = {"GUI": [os.path.join("Resources", "*", "*")]},
ext_modules = ext_modules,
#maintainer=MAINTAINER,
#maintainer_email=MAINTAINER_EMAIL,
keywords = 'GUI Cross-Platform',
license = 'This is free software. You are welcome to use it however you want.'
)