diff options
| author | ?ric Araujo <merwok@netwok.org> | 2012-02-05 11:52:01 +0100 |
|---|---|---|
| committer | ?ric Araujo <merwok@netwok.org> | 2012-02-05 11:52:01 +0100 |
| commit | 5fdd763dde6f8e93038be86edd59631a78de4734 (patch) | |
| tree | 45b9bd7dd7e0efaba9653bece101585398228327 /distutils2/config.py | |
| parent | b6364865ba6d3036bad4cc2c2348436dd6654219 (diff) | |
| download | disutils2-5fdd763dde6f8e93038be86edd59631a78de4734.tar.gz | |
Allow multiple values for package_data in setup.cfg (#11805).
Even though the resources system obsoletes data_files and package_data
(see bug discussion), package_data still exists to allow compatibility
with distutils and thus an easier transition. In setup.py, the values
are lists of glob patterns, so the setup.cfg syntax needed a way to
express multiple values too.
Reported by Erik Bray.
Diffstat (limited to 'distutils2/config.py')
| -rw-r--r-- | distutils2/config.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/distutils2/config.py b/distutils2/config.py index 5c3eaf1..cdd67bb 100644 --- a/distutils2/config.py +++ b/distutils2/config.py @@ -232,13 +232,25 @@ class Config(object): self.dist.scripts = [self.dist.scripts] self.dist.package_data = {} + # bookkeeping for the loop below + firstline = True + prev = None + for line in files.get('package_data', []): - data = line.split('=') - if len(data) != 2: - raise ValueError('invalid line for package_data: %s ' - '(misses "=")' % line) - key, value = data - self.dist.package_data[key.strip()] = value.strip() + if '=' in line: + # package name -- file globs or specs + key, value = line.split('=') + prev = self.dist.package_data[key.strip()] = value.split() + elif firstline: + # invalid continuation on the first line + raise PackagingOptionError( + 'malformed package_data first line: %r (misses "=")' % + line) + else: + # continuation, add to last seen package name + prev.extend(line.split()) + + firstline = False self.dist.data_files = [] for data in files.get('data_files', []): |
