Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 4.4.0 yields an "Invalid zcml" ValueError on '#' "packages" #46

Open
tobiasherp opened this issue May 29, 2018 · 1 comment
Open

Comments

@tobiasherp
Copy link
Contributor

When building my instance (roughly Plone 4.3.3, I admit, but that's another story), I got a "ValueError: ('Invalid zcml', '#')"; apparently there was something wrong with one of my packages, but the exception doesn't give a hint about neither the zcml file (if any) nor the package which contains the error.

Generated interpreter '/opt/zope/instances/my-instance/parts/instance/bin/interpreter'.
While:
  Installing instance.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/opt/zope/instances/my-instance/lib/python2.7/site-packages/zc/buildout/buildout.py", line 2127, in main
getattr(buildout, command)(args)
  File "/opt/zope/instances/my-instance/lib/python2.7/site-packages/zc/buildout/buildout.py", line 797, in install
installed_files = self[part]._call(recipe.install)
  File "/opt/zope/instances/my-instance/lib/python2.7/site-packages/zc/buildout/buildout.py", line 1557, in _call
return f()
  File "/opt/zope/common/eggs/plone.recipe.zope2instance-4.4.0-py2.7.egg/plone/recipe/zope2instance/__init__.py", line 142, in install
self.build_package_includes()
  File "/opt/zope/common/eggs/plone.recipe.zope2instance-4.4.0-py2.7.egg/plone/recipe/zope2instance/__init__.py", line 780, in build_package_includes
raise ValueError('Invalid zcml', orig)
ValueError: ('Invalid zcml', '#')

(I'm afraid I'm not able to provide a simple example which reproduces the problem; but see below.)

I found the package loop var (loop in line 760 of plone/recipe/zope2instance/init.py) to contain a simple '#'; thus, some tool of some version which is supposed to generate package names does inbetween yield a '#' when it runs into a line comment.

My suggestion would be to simply continue for now when that hash "package" is found; this would improve the situation quite a lot. It can't do any harm, right?
With this little change I was able to build my instance.
Of course, someone with some insight might be able to improve the error exception a lot, including useful information about the source of the problem.

@tobiasherp
Copy link
Contributor Author

Ok, I can reproduce the problem. It occurs when there is a (wrong) line comment (with leading space before the #) in the zcml assignment. The words following the hash sign are considered "packages" as well; thus, we'll need to raise an error (with an improved message) indeed, rather than just continue.
I reproduced this with zc.buildout 2.10.0 and 2.11.4.
When the hash sign is not followed by whitespace, the adjacent "word" is part of that "package" name as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant