[Zope-Checkins] SVN: Zope/trunk/src/Zope2/utilities/mkzopeinstance.py Make 'mkzopeinstance' work from a SVN checkout.

Tres Seaver tseaver at palladion.com
Wed Mar 4 12:57:23 EST 2009


Log message for revision 97478:
  Make 'mkzopeinstance' work from a SVN checkout.

Changed:
  U   Zope/trunk/src/Zope2/utilities/mkzopeinstance.py

-=-
Modified: Zope/trunk/src/Zope2/utilities/mkzopeinstance.py
===================================================================
--- Zope/trunk/src/Zope2/utilities/mkzopeinstance.py	2009-03-04 17:20:59 UTC (rev 97477)
+++ Zope/trunk/src/Zope2/utilities/mkzopeinstance.py	2009-03-04 17:57:23 UTC (rev 97478)
@@ -50,6 +50,9 @@
     skelsrc = None
     python = None
 
+    if check_buildout():
+        python = os.path.abspath('bin/zopepy')
+
     for opt, arg in opts:
         if opt in ("-d", "--dir"):
             skeltarget = os.path.abspath(os.path.expanduser(arg))
@@ -186,5 +189,14 @@
     fp.close()
     os.chmod(fn, 0644)
 
+def check_buildout():
+    """ Are we running from within a buildout which supplies 'zopepy'?
+    """
+    if os.path.exists('buildout.cfg'):
+        from ConfigParser import RawConfigParser
+        parser = RawConfigParser()
+        parser.read('buildout.cfg')
+        return 'zopepy' in parser.sections()
+
 if __name__ == "__main__":
     main()



More information about the Zope-Checkins mailing list