4
# Copyright (c) 2006-2010 Apple Inc. All rights reserved.
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
22
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "support"))
24
from version import version
31
for root, dirs, files in os.walk("."):
39
excludes.append("data")
41
for exclude in excludes:
45
if "__init__.py" in files:
46
modules.append(".".join(root.split(os.path.sep)[1:]))
54
description = "CalDAV/CardDAV protocol extensions to twext.web2.dav",
55
long_description = """
56
Extends twisted.web2.dav to implement CalDAV/CardDAV-aware resources and methods.
65
version_string = "%s (%s)" % version()
66
version_file = file(os.path.join("calendarserver", "version.py"), "w")
67
version_file.write('version = "%s"\n' % version_string)
71
# Set up Extension modules that need to be built
74
from distutils.core import Extension
77
Extension("twext.python.sendmsg",
78
sources=["twext/python/sendmsg.c"])
81
if sys.platform == "darwin":
84
"calendarserver.platform.darwin._sacl",
85
extra_link_args = ["-framework", "Security"],
86
sources = ["calendarserver/platform/darwin/_sacl.c"]
95
from distutils.core import setup
98
name = "Calendar and Contacts Server",
99
version = version_string,
100
description = description,
101
long_description = long_description,
103
classifiers = classifiers,
104
author = "Apple Inc.",
108
packages = find_modules(),
114
"zoneinfo/*/*/*.ics",
117
"calendarserver.webadmin": [
120
"twistedcaldav.directory": [
123
"txdav.common.datastore": [
125
"sql_schema/*/*.sql",
126
"sql_schema/*/*/*.sql",
131
"bin/calendarserver_export",
132
#"bin/calendarserver_load_augmentdb",
133
#"bin/calendarserver_make_partition",
134
#"bin/calendarserver_manage_augments",
135
"bin/calendarserver_manage_principals",
136
"bin/calendarserver_command_gateway",
137
"bin/calendarserver_purge_events",
138
"bin/calendarserver_purge_attachments",
139
"bin/calendarserver_purge_principals",
140
"bin/calendarserver_migrate_resources",
141
"bin/calendarserver_monitor_notifications",
142
"bin/calendarserver_bootstrap_database",
144
data_files = [ ("/etc/caldavd", ["conf/caldavd.plist", "conf/sudoers.plist",
145
"conf/auth/accounts.xml", "conf/auth/accounts.dtd",
146
"conf/servertoserver.xml", "conf/servertoserver.dtd",
147
"conf/resources.xml"]) ],
148
ext_modules = extensions,
152
if "install" in dist.commands:
153
install_obj = dist.command_obj["install"]
154
if install_obj.root is None:
156
install_scripts = os.path.normpath(install_obj.install_scripts)
157
install_lib = os.path.normpath(install_obj.install_lib)
158
root = os.path.normpath(install_obj.root)
159
base = os.path.normpath(install_obj.install_base)
162
install_lib = install_lib[len(root):]
164
for script in dist.scripts:
165
scriptPath = os.path.join(install_scripts, os.path.basename(script))
167
print "rewriting %s" % (scriptPath,)
173
for line in file(scriptPath, "r"):
175
if line.startswith("#!"):
176
if "python" in line.lower():
178
elif "sh" in line.lower():
181
line = line.rstrip("\n")
183
if line == "#PYTHONPATH":
184
script.append('PYTHONPATH="%s:$PYTHONPATH"' % (install_lib,))
185
elif line == "#PATH":
186
script.append('PATH="%s:$PATH"' % (os.path.join(base, "bin"),))
190
elif fileType == "python":
191
if line == "#PYTHONPATH":
192
script.append('PYTHONPATH="%s"' % (install_lib,))
193
elif line == "#PATH":
194
script.append('PATH="%s"' % (os.path.join(base, "bin"),))
201
newScript = open(scriptPath, "w")
202
newScript.write("\n".join(script))
207
if __name__ == "__main__":