diff roundup/scripts/roundup_xmlrpc_server.py @ 4766:86ef4ab17dc5

Run scripts (roundup_admin.py, ...) directly from checkout. Convenient when you don't want to install Roundup, but want to run latest version.
author anatoly techtonik <techtonik@gmail.com>
date Thu, 21 Feb 2013 20:49:45 +0300
parents a728d421a65a
children 198b6e810c67
line wrap: on
line diff
--- a/roundup/scripts/roundup_xmlrpc_server.py	Thu Feb 21 19:36:49 2013 +0300
+++ b/roundup/scripts/roundup_xmlrpc_server.py	Thu Feb 21 20:49:45 2013 +0300
@@ -5,6 +5,20 @@
 # For license terms see the file COPYING.txt.
 #
 
+
+# --- patch sys.path to make sure 'import roundup' finds correct version
+import sys
+import os.path as osp
+
+thisdir = osp.dirname(osp.abspath(__file__))
+rootdir = osp.dirname(osp.dirname(thisdir))
+if (osp.exists(thisdir + '/__init__.py') and
+        osp.exists(rootdir + '/roundup/__init__.py')):
+    # the script is located inside roundup source code
+    sys.path.insert(0, rootdir)
+# --/
+
+
 import base64, getopt, os, sys, socket, urllib
 from roundup.xmlrpc import translate
 from roundup.xmlrpc import RoundupInstance

Roundup Issue Tracker: http://roundup-tracker.org/