Skip to content

Commit

Permalink
Merge branch 'master' into update-traversal-and-acquisition
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake authored Apr 9, 2019
2 parents 24a3218 + eed8f0c commit 8cd6162
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Fixes
- make the ZMI `Find` tab work for searching HTML tags
by adding support for `Tainted` strings in ``ZopeFind``

- prevent ``mkwsgiinstance`` from blowing up parsing ``buildout.cfg``

Features
++++++++

Expand Down
16 changes: 13 additions & 3 deletions src/Zope2/utilities/mkwsgiinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import sys

from six.moves import input
from six.moves.configparser import ParsingError
from six.moves.configparser import RawConfigParser

from . import copyzopeskel
Expand Down Expand Up @@ -200,9 +201,18 @@ def check_buildout(script_path):
buildout_cfg = os.path.join(os.path.dirname(script_path), 'buildout.cfg')
if os.path.exists(buildout_cfg):
parser = RawConfigParser()
parser.read(buildout_cfg)
return 'zopepy' in parser.sections()

try:
parser.read(buildout_cfg)
return 'zopepy' in parser.sections()
except ParsingError:
# zc.buildout uses its own parser and it allows syntax that
# ConfigParser does not like. Here's one really stupid workaround.
# The alternative is using the zc.buildout parser, which would
# introduce a hard dependency.
zope_py = os.path.join(os.path.dirname(script_path),
'bin', 'zopepy')
if os.path.isfile(zope_py) and os.access(zope_py, os.X_OK):
return True

def get_zope2path(python):
""" Get Zope2 path from selected Python interpreter.
Expand Down

0 comments on commit 8cd6162

Please sign in to comment.