summaryrefslogtreecommitdiff
path: root/Lib/packaging/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/packaging/config.py')
-rw-r--r--Lib/packaging/config.py25
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', []):