Skip to content

logging-format interpolation in setup.cfg interferes with distutils #733

@alunduil

Description

@alunduil

I'm not completely convinced that this is a nose bug but decided to ask here just in case.

When using a setup.cfg with the following contents (including minor variations):

[nosetests]
logging-format = %(lineno)d: %(process)d: %(message)s

With any setup.py file the following error is raised when trying to run setup.py (python2.7 used for example, error also occurs in 3.3):

alunduil@elijah margarine % python2.7 setup.py nosetests
Traceback (most recent call last):
  File "setup.py", line 108, in <module>
    setup(**PARAMS)
  File "/usr/lib64/python2.7/distutils/core.py", line 125, in setup
    dist.parse_config_files()
  File "/usr/lib64/python2.7/distutils/dist.py", line 397, in parse_config_files
    val = parser.get(section,opt)
  File "/usr/lib64/python2.7/ConfigParser.py", line 623, in get
    return self._interpolate(section, option, value, d)
  File "/usr/lib64/python2.7/ConfigParser.py", line 669, in _interpolate
    option, section, rawval, e.args[0])
ConfigParser.InterpolationMissingOptionError: Bad value substitution:
        section: [nosetests]
        option : logging-format
        key    : pathname
        rawval : %(pathname)s:%(lineno)d: %(process)d: %(message)s

It looks to me like distutils should ignore this section or this interpolation but I can't think of a clean way around this without a special case in distutils. Which begs the question should the format string for logging be escaped in any particular way? I'm not seeing any current handling of escapes in the code but could be missing something.

Any guidance is appreciated as I'd love to be able to set this option in setup.cfg without interfering with distutils.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions