[CalendarServer-changes] [3286] CalendarServer/trunk/bin/caldav_export
source_changes at macosforge.org
source_changes at macosforge.org
Thu Oct 30 15:37:46 PDT 2008
Revision: 3286
http://trac.macosforge.org/projects/calendarserver/changeset/3286
Author: wsanchez at apple.com
Date: 2008-10-30 15:37:46 -0700 (Thu, 30 Oct 2008)
Log Message:
-----------
If PYTHONPATH isn't set in the global scope, this isn't installed yet; determine PATH from project's run script.
Modified Paths:
--------------
CalendarServer/trunk/bin/caldav_export
Modified: CalendarServer/trunk/bin/caldav_export
===================================================================
--- CalendarServer/trunk/bin/caldav_export 2008-10-30 22:35:44 UTC (rev 3285)
+++ CalendarServer/trunk/bin/caldav_export 2008-10-30 22:37:46 UTC (rev 3286)
@@ -19,9 +19,21 @@
#PYTHONPATH
-if __name__ == '__main__':
- if 'PYTHONPATH' in globals():
+if __name__ == "__main__":
+ if "PYTHONPATH" in globals():
sys.path.insert(0, PYTHONPATH)
+ else:
+ from os.path import dirname, abspath, join
+ from subprocess import Popen, PIPE
- from calendarserver.tools.export import main
- main()
+ home = dirname(dirname(abspath(__file__)))
+ run = join(home, "run")
+
+ child = Popen((run, "-p"), stdout=PIPE)
+ path, stderr = child.communicate()
+
+ if child.wait() == 0:
+ sys.path[0:0] = path.split(":")
+
+ from calendarserver.tools.export import main
+ main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081030/8363944c/attachment-0001.html>
More information about the calendarserver-changes
mailing list