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

Tag formatter documentation #212

Closed
tcezard opened this issue Feb 17, 2017 · 9 comments
Closed

Tag formatter documentation #212

tcezard opened this issue Feb 17, 2017 · 9 comments

Comments

@tcezard
Copy link
Contributor

tcezard commented Feb 17, 2017

Not sure if this is common knowledge or not but apparently config parser uses interpolation (issue28935 and issue20754) in python3.
That means the % signs are causing the loading to crash.
It can be fixed by using %% instead but it did not occur to me when writing the documentation.
Do you thing this should be highlighted ?

@reinout
Copy link
Collaborator

reinout commented Feb 20, 2017

Bah. Does that mean that, if we use %% in the setup.cfg, that zest.releaser should un-escape it?

@tcezard
Copy link
Contributor Author

tcezard commented Feb 20, 2017

Nop. It works as expected when you use %% which mean ConfigParser already removes it. I just though the documentation might want to explain it.

@reinout
Copy link
Collaborator

reinout commented Feb 20, 2017

Yes please :-)

@mauritsvanrees
Copy link
Member

From https://bugs.python.org/issue20754 it looks like it may help if we initialize ConfigParser with parameter interpolation=None. Maybe only on Python 3. Can you test if that works?

@pior
Copy link

pior commented Jul 23, 2017

This seems to work correctly with Python 3, but fails with for Python 2.7.13

https://travis-ci.org/ludia/pyramid_metrics/jobs/256667732

$ python setup.py --version
Traceback (most recent call last):
  File "setup.py", line 43, in <module>
    'de = devup.app:cli',
  File "/Users/piorbastida/.pyenv/versions/2.7.13/lib/python2.7/distutils/core.py", line 124, in setup
    dist.parse_config_files()
  File "/Users/piorbastida/.pyenv/versions/2.7.13/lib/python2.7/distutils/dist.py", line 397, in parse_config_files
    val = parser.get(section,opt)
  File "/Users/piorbastida/.pyenv/versions/2.7.13/lib/python2.7/ConfigParser.py", line 623, in get
    return self._interpolate(section, option, value, d)
  File "/Users/piorbastida/.pyenv/versions/2.7.13/lib/python2.7/ConfigParser.py", line 669, in _interpolate
    option, section, rawval, e.args[0])
ConfigParser.InterpolationMissingOptionError: Bad value substitution:
	section: [zest.releaser]
	option : tag-format
	key    : version
	rawval : v%%(version)s

@pior
Copy link

pior commented Jul 23, 2017

Fix in setuptools: pypa/setuptools#889

In Py3, setuptools read the config itself, while this doesn't seem to be the case in Py2...

@Niedes
Copy link

Niedes commented Jul 28, 2017

Same here, no matter if I use one or two % signs.
Updating setuptools is not an option, as setuptools greater than 33.1.1 breaks
the buildout of our plone packages.

$ python setup.py --version Traceback (most recent call last): File "setup.py", line 61, in <module> """, File "d:\Python27\lib\distutils\core.py", line 124, in setup dist.parse_config_files() File "d:\Python27\lib\site-packages\setuptools\dist.py", line 352, in parse_config_files _Distribution.parse_config_files(self, filenames=filenames) File "d:\Python27\lib\distutils\dist.py", line 397, in parse_config_files val = parser.get(section,opt) File "d:\Python27\lib\ConfigParser.py", line 623, in get return self._interpolate(section, option, value, d) File "d:\Python27\lib\ConfigParser.py", line 669, in _interpolate option, section, rawval, e.args[0]) ConfigParser.InterpolationMissingOptionError: Bad value substitution: section: [zest.releaser] option : tag-format key : version rawval : %%(version)s

$ python setup.py --version Traceback (most recent call last): File "setup.py", line 61, in <module> """, File "d:\Python27\lib\distutils\core.py", line 124, in setup dist.parse_config_files() File "d:\Python27\lib\site-packages\setuptools\dist.py", line 352, in parse_config_files _Distribution.parse_config_files(self, filenames=filenames) File "d:\Python27\lib\distutils\dist.py", line 397, in parse_config_files val = parser.get(section,opt) File "d:\Python27\lib\ConfigParser.py", line 623, in get return self._interpolate(section, option, value, d) File "d:\Python27\lib\ConfigParser.py", line 669, in _interpolate option, section, rawval, e.args[0]) ConfigParser.InterpolationMissingOptionError: Bad value substitution: section: [zest.releaser] option : tag-format key : version rawval : %(version)s

rbarrois added a commit to FactoryBoy/factory_boy that referenced this issue Jul 31, 2017
This reverts commit bb1de00.

See zestsoftware/zest.releaser#212 for
details: the setup.cfg file is interpolated by distutils, and this
fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants