Commits

anatoly techtonik committed a360e7e

initial commit - fetch Genshi dependency

  • Participants

Comments (0)

Files changed (1)

File bootstrap.py

+# The code to bootstrap Trac with environment created in .trac
+# subdir in current directory.
+# 
+# Placed into public domain by anatoly techtonik
+
+import os
+import sys
+import subprocess
+
+
+DEVPATH = os.path.dirname(os.path.abspath(__file__))
+ENVPATH = os.path.join(DEVPATH, '.trac')
+# path to download dependency modules
+LIBPATH = os.path.join(DEVPATH, '.pylibs')
+
+# module checkout URLs
+GENSHI = 'http://svn.edgewall.org/repos/genshi/branches/stable/0.6.x/genshi'
+
+
+print("Executing Trac from source checkout (using .trac/ environment)")
+
+sys.path.insert(0, LIBPATH)
+print("01. Patched sys.path with %s" % LIBPATH)
+sys.path.insert(0, DEVPATH)
+print("01. Patched sys.path with %s" % DEVPATH)
+
+def get_module(url, path):
+  print("... checking out module from SVN")
+  if not os.path.exists(path):
+    print "... creating %s" % path
+    os.makedirs(path)
+  cmd = "svn co %s %s" % (url, path)
+  print("... executing: %s" % cmd)
+  retcode = subprocess.call(cmd, shell=True)
+  if retcode != 0:
+    sys.exit("Error while executing SVN. Aborting")
+
+print("02. Check Genshi")
+try:
+  import imp
+  imp.find_module('genshi')
+except ImportError:
+  get_module(GENSHI, os.path.join(LIBPATH, 'genshi'))
+import genshi
+print("... imported Genshi %s" % genshi.__version__)
+
+if not os.path.exists(ENVPATH):
+  print("03. Creating .trac/ environment")
+  import trac.admin.console
+  trac.admin.console.run(args=[])  
+else:
+  print("03. .trac/ environment already exists - exiting")
+