Commits

anatoly techtonik committed c8150f4

manually import all Trac internal modules as a workaround
for setuptools dependency

Comments (0)

Files changed (1)

     sys.exit("Error while executing SVN. Aborting")
 
 print("02. Check Genshi")
+
 try:
   import imp
   imp.find_module('genshi')
 import genshi
 print("... imported Genshi %s" % genshi.__version__)
 
+print("03. Importing Core Trac Modules")
+# even core Trac modules are imported through setuptools, and
+# here is a workaround to get rid of the dependency
+imports = open(os.path.join(DEVPATH, 'setup.py')).readlines()
+key = [x for x,y in enumerate(imports) if '[trac.plugins]' in y][0]
+imports = imports[key+1:]
+key = [x for x,y in enumerate(imports) if '"""' in y][0]
+imports = imports[:key]
+for line in imports:
+  # line format is "trac.db.sqlite = trac.db.sqlite_backend"
+  # or trac.mimeview.rst = trac.mimeview.rst[reST]
+  name = line.split('=',1)[1].strip()
+  if '[' in name:
+    name = name[:name.index('[')]
+  try:
+    __import__(name)
+  except ImportError, err:
+    print '... %s failed to load: %s' % (name, err)
+
+
 if not os.path.exists(ENVPATH):
-  print("03. Creating .trac/ environment in %s" % ENVPATH)
+  print("04. Creating .trac/ environment in %s" % ENVPATH)
   import trac.admin.console
   trac.admin.console.run(args=[ENVPATH, 'initenv',
     'Default "Trac Environment" for Development',
     'sqlite:db/trac.db'])
 else:
-  print("03. .trac/ environment already exists - exiting")
-
+  print("04. .trac/ environment already exists - exiting")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.