Commit 74afc688 authored by Satoru SATOH's avatar Satoru SATOH Committed by Paul Ganssle

Add data_files support in setup.cfg with test case

In the test case, dist.data_files needs to be sorted because the
current implementation loads the configuration files as a dictionary
with arbitrary order on Python < 3.6.
parent 5b90a0d9
......@@ -598,3 +598,11 @@ class ConfigOptionsHandler(ConfigHandler):
parse_list = partial(self._parse_list, separator=';')
self['extras_require'] = self._parse_section_to_dict(
section_options, parse_list)
def parse_section_data_files(self, section_options):
"""Parses `data_files` configuration file section.
:param dict section_options:
"""
parsed = self._parse_section_to_dict(section_options, self._parse_list)
self['data_files'] = [(k, v) for k, v in parsed.items()]
......@@ -703,6 +703,23 @@ class TestOptions:
with get_dist(tmpdir) as dist:
assert dist.entry_points == expected
def test_data_files(self, tmpdir):
fake_env(
tmpdir,
'[options.data_files]\n'
'cfg =\n'
' a/b.conf\n'
' c/d.conf\n'
'data = e/f.dat, g/h.dat\n'
)
with get_dist(tmpdir) as dist:
expected = [
('cfg', ['a/b.conf', 'c/d.conf']),
('data', ['e/f.dat', 'g/h.dat']),
]
assert sorted(dist.data_files) == sorted(expected)
saved_dist_init = _Distribution.__init__
class TestExternalSetters:
# During creation of the setuptools Distribution() object, we call
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment