diff options
author | Éric Araujo <merwok@netwok.org> | 2012-02-05 10:48:52 +0100 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2012-02-05 10:48:52 +0100 |
commit | 04410c05c18a5c6af5f62a50f72488baf5312c8e (patch) | |
tree | ce5106268591a5dbb081ff9b782da50aa6782c37 /Lib/packaging/config.py | |
parent | 2cf04487acda2dcdc3837fab5498c66921c514bd (diff) | |
parent | dcfcb6458206a7cf6e61e8f91f756e62137125fe (diff) | |
download | cpython-git-04410c05c18a5c6af5f62a50f72488baf5312c8e.tar.gz |
Branch merge
Diffstat (limited to 'Lib/packaging/config.py')
-rw-r--r-- | Lib/packaging/config.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Lib/packaging/config.py b/Lib/packaging/config.py index 366faea4ed..ab026a83b6 100644 --- a/Lib/packaging/config.py +++ b/Lib/packaging/config.py @@ -20,7 +20,6 @@ def _check_name(name, packages): if '.' not in name: return parts = name.split('.') - modname = parts[-1] parent = '.'.join(parts[:-1]) if parent not in packages: # we could log a warning instead of raising, but what's the use @@ -227,13 +226,25 @@ class Config: 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', []): |