[Zope-dev] Zope2 trunk: getting 'mkzopeinstance' / 'mkzeoinstance' working

Tres Seaver tseaver at palladion.com
Wed Mar 4 12:18:32 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tres Seaver wrote:
> Hanno Schlichting wrote:
>> Tres Seaver wrote:
>>> Hanno Schlichting wrote:
>>>> I looked at this, but guessing or reliably getting to the zopepy script
>>>> wasn't possible. So I added an explicit option to the script instead and
>>>> documented it. You can now use:
>>>> bin/mkzopeinstance --python=bin/zopepy
>>>> on the SVN trunk. You can omit this option and it will use
>>>> sys.executable as before.
>>> Maybe we can detect buildout vs. tarball (e.g., the presence of
>>> 'buildout.cfg' vs. 'makefile'?)
>> What you have available inside the mkzopeinstance script is:
> 
>> sys.executable which is just your regular Python interpreter and then
>> sys.argv which is ./bin/mkzopeinstance.
> 
>> As the 'zopepy' script can be called anything, I don't see how you can
>> be smarter here.
> 
> I'm not worried about generalities:  I think that 'mkzopeinstance'
> should work from inside a SVN checkout of the Zope2 trunk, where the
> script is going to have a known hame.  Something like this::
> 
> --- src/Zope2/utilities/mkzopeinstance.py	(revision 97232)
> +++ src/Zope2/utilities/mkzopeinstance.py	(working copy)
> @@ -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()


Any objections if I check this in?


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJrrfo+gerLs4ltQ4RAg9nAKCMz3Vv9FJTD83E5g4EPE3OrWlIYwCgqkHF
++1Zv8K5hM/H3KH0jE0ZfUw=
=dn0X
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list