diff roundup/scripts/roundup_demo.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 01e8be352fb8
children 4cf48ff01e04
line wrap: on
line diff
--- a/roundup/scripts/roundup_demo.py	Thu Feb 21 19:36:49 2013 +0300
+++ b/roundup/scripts/roundup_demo.py	Thu Feb 21 20:49:45 2013 +0300
@@ -3,14 +3,28 @@
 # Copyright 2004 Richard Jones (richard@mechanicalcat.net)
 #
 
+DEFAULT_HOME = './demo'
+DEFAULT_TEMPLATE = 'classic'
+
+
 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)
+# --/
+
+
 from roundup import admin, configuration, demo, instance
 from roundup.i18n import _
 
-DEFAULT_HOME = './demo'
-DEFAULT_TEMPLATE = 'classic'
-
 def run():
     home = DEFAULT_HOME
     template = DEFAULT_TEMPLATE

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