[CalendarServer-changes] [7780] CalendarServer/trunk/bin
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 12 14:47:09 PDT 2011
Revision: 7780
http://trac.macosforge.org/projects/calendarserver/changeset/7780
Author: glyph at apple.com
Date: 2011-07-12 14:47:08 -0700 (Tue, 12 Jul 2011)
Log Message:
-----------
fix all tools to use a common preamble, and detect whether the run script is actually there before running it
Modified Paths:
--------------
CalendarServer/trunk/bin/calendarserver_bootstrap_database
CalendarServer/trunk/bin/calendarserver_calverify
CalendarServer/trunk/bin/calendarserver_command_gateway
CalendarServer/trunk/bin/calendarserver_config
CalendarServer/trunk/bin/calendarserver_dbinspect
CalendarServer/trunk/bin/calendarserver_export
CalendarServer/trunk/bin/calendarserver_load_augmentdb
CalendarServer/trunk/bin/calendarserver_make_partition
CalendarServer/trunk/bin/calendarserver_manage_augments
CalendarServer/trunk/bin/calendarserver_manage_postgres
CalendarServer/trunk/bin/calendarserver_manage_principals
CalendarServer/trunk/bin/calendarserver_manage_timezones
CalendarServer/trunk/bin/calendarserver_migrate_resources
CalendarServer/trunk/bin/calendarserver_monitor_notifications
CalendarServer/trunk/bin/calendarserver_purge_attachments
CalendarServer/trunk/bin/calendarserver_purge_events
CalendarServer/trunk/bin/calendarserver_purge_principals
CalendarServer/trunk/bin/calendarserver_shell
CalendarServer/trunk/bin/calendarserver_warmup
CalendarServer/trunk/bin/icalendar_split
CalendarServer/trunk/bin/proxyclean
Added Paths:
-----------
CalendarServer/trunk/bin/_calendarserver_preamble.py
Added: CalendarServer/trunk/bin/_calendarserver_preamble.py
===================================================================
--- CalendarServer/trunk/bin/_calendarserver_preamble.py (rev 0)
+++ CalendarServer/trunk/bin/_calendarserver_preamble.py 2011-07-12 21:47:08 UTC (rev 7780)
@@ -0,0 +1,65 @@
+##
+# Copyright (c) 2011 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+This module is the shared preamble for all calendarserver shell commands to set
+up their environment properly. It's explicitly not installed along with the
+code, and is used only to initialize the environment for a development checkout
+of the code.
+"""
+
+import sys
+from os.path import dirname, abspath, join, split, exists
+from subprocess import Popen, PIPE
+
+def bootstrapFromRun():
+ """
+ If this is a development checkout, run the 'run' script to discover the
+ correct value for sys.path.
+ """
+
+ home = dirname(dirname(abspath(__file__)))
+ run = join(home, "run")
+
+ if not exists(run) or not exists(join(home, "setup.py")):
+ # This doesn't look enough like a development checkout; let's not
+ # attempt to run the run script.
+ return
+
+ child = Popen((run, "-p"), stdout=PIPE)
+ path, stderr = child.communicate()
+
+ path = path.rstrip("\n")
+
+ if child.wait() == 0:
+ sys.path[0:0] = path.split(":")
+
+ noConfigOption = [
+ "calendarserver_bootstrap_database",
+ "calendarserver_load_augmentdb",
+ "calendarserver_make_partition",
+ "calendarserver_manage_augments",
+ "calendarserver_manage_postgres",
+ "calendarserver_manage_timezones",
+ "icalendar_split",
+ ]
+
+ if split(sys.argv[0])[-1] not in noConfigOption:
+ sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
+
+
+bootstrapFromRun()
+
Modified: CalendarServer/trunk/bin/calendarserver_bootstrap_database
===================================================================
--- CalendarServer/trunk/bin/calendarserver_bootstrap_database 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_bootstrap_database 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,19 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
from calendarserver.tools.bootstrapdatabase import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_calverify
===================================================================
--- CalendarServer/trunk/bin/calendarserver_calverify 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_calverify 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.calverify import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_command_gateway
===================================================================
--- CalendarServer/trunk/bin/calendarserver_command_gateway 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_command_gateway 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.gateway import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_config
===================================================================
--- CalendarServer/trunk/bin/calendarserver_config 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_config 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.config import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_dbinspect
===================================================================
--- CalendarServer/trunk/bin/calendarserver_dbinspect 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_dbinspect 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.dbinspect import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_export
===================================================================
--- CalendarServer/trunk/bin/calendarserver_export 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_export 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.export import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_load_augmentdb
===================================================================
--- CalendarServer/trunk/bin/calendarserver_load_augmentdb 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_load_augmentdb 2011-07-12 21:47:08 UTC (rev 7780)
@@ -23,19 +23,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
from calendarserver.tools.loadaugmentdb import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_make_partition
===================================================================
--- CalendarServer/trunk/bin/calendarserver_make_partition 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_make_partition 2011-07-12 21:47:08 UTC (rev 7780)
@@ -23,19 +23,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
from calendarserver.tools.makepartition import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_manage_augments
===================================================================
--- CalendarServer/trunk/bin/calendarserver_manage_augments 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_manage_augments 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,19 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, _ignore_stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
from calendarserver.tools.manageaugments import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_manage_postgres
===================================================================
--- CalendarServer/trunk/bin/calendarserver_manage_postgres 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_manage_postgres 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,19 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, _ignore_stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
from calendarserver.tools.managepostgres import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_manage_principals
===================================================================
--- CalendarServer/trunk/bin/calendarserver_manage_principals 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_manage_principals 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,9 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
-
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
from calendarserver.tools.principals import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_manage_timezones
===================================================================
--- CalendarServer/trunk/bin/calendarserver_manage_timezones 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_manage_timezones 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,19 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, _ignore_stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
from calendarserver.tools.managetimezones import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_migrate_resources
===================================================================
--- CalendarServer/trunk/bin/calendarserver_migrate_resources 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_migrate_resources 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.resources import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_monitor_notifications
===================================================================
--- CalendarServer/trunk/bin/calendarserver_monitor_notifications 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_monitor_notifications 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.notifications import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_purge_attachments
===================================================================
--- CalendarServer/trunk/bin/calendarserver_purge_attachments 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_purge_attachments 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.purge import main_purge_orphaned_attachments
main_purge_orphaned_attachments()
Modified: CalendarServer/trunk/bin/calendarserver_purge_events
===================================================================
--- CalendarServer/trunk/bin/calendarserver_purge_events 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_purge_events 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.purge import main_purge_events
main_purge_events()
Modified: CalendarServer/trunk/bin/calendarserver_purge_principals
===================================================================
--- CalendarServer/trunk/bin/calendarserver_purge_principals 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_purge_principals 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.purge import main_purge_principals
main_purge_principals()
Modified: CalendarServer/trunk/bin/calendarserver_shell
===================================================================
--- CalendarServer/trunk/bin/calendarserver_shell 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_shell 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.shell import main
main()
Modified: CalendarServer/trunk/bin/calendarserver_warmup
===================================================================
--- CalendarServer/trunk/bin/calendarserver_warmup 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/calendarserver_warmup 2011-07-12 21:47:08 UTC (rev 7780)
@@ -24,21 +24,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
- sys.argv[1:1] = ["-f", join(home, "conf", "caldavd-dev.plist")]
-
from calendarserver.tools.warmup import main
main()
Modified: CalendarServer/trunk/bin/icalendar_split
===================================================================
--- CalendarServer/trunk/bin/icalendar_split 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/icalendar_split 2011-07-12 21:47:08 UTC (rev 7780)
@@ -23,19 +23,10 @@
if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
else:
- from os.path import dirname, abspath, join
- from subprocess import Popen, PIPE
+ try:
+ import _calendarserver_preamble
+ except ImportError:
+ sys.exc_clear()
- home = dirname(dirname(abspath(__file__)))
- run = join(home, "run")
-
- child = Popen((run, "-p"), stdout=PIPE)
- path, stderr = child.communicate()
-
- path = path.rstrip("\n")
-
- if child.wait() == 0:
- sys.path[0:0] = path.split(":")
-
from calendarserver.tools.icalsplit import main
main()
Modified: CalendarServer/trunk/bin/proxyclean
===================================================================
--- CalendarServer/trunk/bin/proxyclean 2011-07-12 20:54:58 UTC (rev 7779)
+++ CalendarServer/trunk/bin/proxyclean 2011-07-12 21:47:08 UTC (rev 7780)
@@ -16,11 +16,16 @@
# limitations under the License.
##
+import sys
import commands
import getopt
import os
-import sys
+try:
+ import _calendarserver_preamble
+except ImportError:
+ sys.exc_clear()
+
from twext.python.plistlib import readPlist
try:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110712/bcf207df/attachment-0001.html>
More information about the calendarserver-changes
mailing list