[CalendarServer-changes] [12080] twext/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:25:18 PDT 2014


Revision: 12080
          http://trac.calendarserver.org//changeset/12080
Author:   wsanchez at apple.com
Date:     2013-12-12 19:03:13 -0800 (Thu, 12 Dec 2013)
Log Message:
-----------
Add preamble for scripts.

Added Paths:
-----------
    twext/trunk/bin/
    twext/trunk/bin/_twext_preamble.py
    twext/trunk/bin/trial
    twext/trunk/bin/twistd

Added: twext/trunk/bin/_twext_preamble.py
===================================================================
--- twext/trunk/bin/_twext_preamble.py	                        (rev 0)
+++ twext/trunk/bin/_twext_preamble.py	2013-12-13 03:03:13 UTC (rev 12080)
@@ -0,0 +1,22 @@
+##
+# Copyright (c) 2011-2013 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.
+"""

Copied: twext/trunk/bin/trial (from rev 12070, CalendarServer/trunk/bin/trial)
===================================================================
--- twext/trunk/bin/trial	                        (rev 0)
+++ twext/trunk/bin/trial	2013-12-13 03:03:13 UTC (rev 12080)
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+##
+# Copyright (c) 2006-2013 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.
+##
+
+from __future__ import print_function
+
+import sys
+import os
+
+#PYTHONPATH
+
+if __name__ == "__main__":
+    if "PYTHONPATH" in globals():
+        sys.path.insert(0, PYTHONPATH)
+    else:
+        try:
+            import _twext_preamble
+        except ImportError:
+            sys.exc_clear()
+
+    for name, value in os.environ.items():
+        print("{0}={1}".format(name, value))
+
+    from twisted.scripts.trial import run
+    run()

Copied: twext/trunk/bin/twistd (from rev 12070, CalendarServer/trunk/bin/twistd)
===================================================================
--- twext/trunk/bin/twistd	                        (rev 0)
+++ twext/trunk/bin/twistd	2013-12-13 03:03:13 UTC (rev 12080)
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+##
+# Copyright (c) 2006-2013 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.
+##
+
+import sys
+
+#PYTHONPATH
+
+if __name__ == "__main__":
+    if "PYTHONPATH" in globals():
+        sys.path.insert(0, PYTHONPATH)
+    else:
+        try:
+            import _twext_preamble
+        except ImportError:
+            sys.exc_clear()
+
+    from twisted.scripts.twistd import run
+    run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/f18280c2/attachment.html>


More information about the calendarserver-changes mailing list