diff roundup/scripts/roundup_admin.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 6e3e4f24c753
children 1045b8eb0a3b
line wrap: on
line diff
--- a/roundup/scripts/roundup_admin.py	Thu Feb 21 19:36:49 2013 +0300
+++ b/roundup/scripts/roundup_admin.py	Thu Feb 21 20:49:45 2013 +0300
@@ -18,6 +18,21 @@
 """
 __docformat__ = 'restructuredtext'
 
+import sys
+
+
+# --- patch sys.path to make sure 'import roundup' finds correct version
+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)
+# --/
+
+
 # python version check
 from roundup import version_check
 
@@ -25,8 +40,6 @@
 from roundup.admin import AdminTool
 from roundup.i18n import _
 
-import sys
-
 def run():
     # time out after a minute if we can
     import socket

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