forked from ffledgling/dtella
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
126 lines (101 loc) · 3.41 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
"""
Dtella - py2exe setup script
Copyright (C) 2007-2008 Dtella Labs (http://dtella.org/)
Copyright (C) 2007-2008 Paul Marks (http://pmarks.net/)
Copyright (C) 2007-2008 Jacob Feisley (http://feisley.com/)
$Id$
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
from distutils.core import setup
import sys
import dtella.local_config as local
class Error(Exception):
pass
def get_excludes():
ex = []
# Ignore XML and SSL, unless the puller needs them.
def check_attr(o, a):
try:
return getattr(o, a)
except AttributeError:
return False
if not check_attr(local.dconfig_puller, 'needs_xml'):
ex.append("xml")
if not check_attr(local.dconfig_puller, 'needs_ssl'):
ex.append("_ssl")
# No client should need this
ex.append("OpenSSL")
# Skip over any bridge components.
ex.append("dtella.bridge_config")
ex.append("dtella.bridge")
return ex
def patch_nsi_template():
# Generate NSI file from template, replacing name and version
# with data from local_config.
dt_name = local.hub_name
dt_version = local.version
dt_simplename = local.build_prefix + local.version
wfile = file("installer_win/dtella.nsi", "w")
for line in file("installer_win/dtella.template.nsi"):
if "PATCH_ME" in line:
if "PRODUCT_NAME" in line:
line = line.replace("PATCH_ME", dt_name)
elif "PRODUCT_VERSION" in line:
line = line.replace("PATCH_ME", dt_version)
elif "PRODUCT_SIMPLENAME" in line:
line = line.replace("PATCH_ME", dt_simplename)
else:
raise Error("Unpatchable NSI line: %s" % line)
wfile.write(line)
wfile.close()
if sys.platform == 'darwin':
import py2app
elif sys.platform == 'win32':
import py2exe
patch_nsi_template()
else:
print "Unknown platform: %s" % sys.platform
sys.exit(-1)
excludes = get_excludes()
includes = ["encodings",
"encodings.*",]
setup(
name = 'Dtella',
version = local.version,
description = 'Dtella Client',
author = 'Dtella Labs',
url = 'http://dtella.org',
options = {
"py2exe": {
"optimize": 2,
"bundle_files": 1,
"ascii": True,
"dll_excludes": ["libeay32.dll"],
"excludes": excludes,
"includes": includes,
},
"py2app": {
"optimize": 2,
"argv_emulation": True,
"iconfile": "icons/dtella.icns",
"plist": {'LSBackgroundOnly':True},
"excludes": excludes,
}
},
app = ["dtella.py"],
zipfile = None,
windows = [{
"script": "dtella.py",
"icon_resources": [(1, "icons/dtella.ico"), (10, "icons/kill.ico")],
}]
)