[Python-checkins] distutils2: Stop converting package_data to extra_files in pysetup create (#13712).
eric.araujo
python-checkins at python.org
Sun Feb 5 12:23:57 CET 2012
http://hg.python.org/distutils2/rev/730c2e4aaf9c
changeset: 1273:730c2e4aaf9c
user: Éric Araujo <merwok at netwok.org>
date: Sun Feb 05 11:59:27 2012 +0100
summary:
Stop converting package_data to extra_files in pysetup create (#13712).
pysetup create used to convert package_data from an existing setup.py
into extra_files, but these files are only present in sdists, not
installed: they don’t have the same use case at all, so converting one
into the other did not work.
files:
CHANGES.txt | 2 +
distutils2/create.py | 36 ++++++++++++--------
distutils2/tests/test_create.py | 25 +++++++-------
3 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -162,6 +162,8 @@
- #12659: Add tests for tests.support [francisco]
- #13901: Prevent test failure on OS X for Python built in shared mode [ned]
- #11805: Add multiple value syntax for package_data in setup.cfg [éric]
+- #13712: Don't map package_data to extra_files when converting a setup.py
+ script with pysetup create [éric]
1.0a3 - 2010-10-08
diff --git a/distutils2/create.py b/distutils2/create.py
--- a/distutils2/create.py
+++ b/distutils2/create.py
@@ -298,6 +298,7 @@
# optional string entries
if 'keywords' in self.data and self.data['keywords']:
+ # XXX shoud use comma to separate, not space
fp.write(u'keywords = %s\n' % ' '.join(self.data['keywords']))
for name in ('home_page', 'author', 'author_email',
'maintainer', 'maintainer_email', 'description-file'):
@@ -318,17 +319,30 @@
fp.write(u'%s = ' % name)
fp.write(u''.join(' %s\n' % val
for val in self.data[name]).lstrip())
+
fp.write(u'\n[files]\n')
- for name in ('packages', 'modules', 'scripts',
- 'package_data', 'extra_files'):
+
+ for name in ('packages', 'modules', 'scripts', 'extra_files'):
if not(name in self.data and self.data[name]):
continue
fp.write(u'%s = %s\n'
% (name, u'\n '.join(self.data[name]).strip()))
- fp.write(u'\nresources =\n')
- for src, dest in self.data['resources']:
- fp.write(u' %s = %s\n' % (src, dest))
- fp.write(u'\n')
+
+ if self.data.get('package_data'):
+ fp.write(u'package_data =\n')
+ for pkg, spec in sorted(self.data['package_data'].items()):
+ # put one spec per line, indented under the package name
+ indent = u' ' * (len(pkg) + 7)
+ spec = (u'\n' + indent).join(spec)
+ fp.write(u' %s = %s\n' % (pkg, spec))
+ fp.write(u'\n')
+
+ if self.data.get('resources'):
+ fp.write(u'resources =\n')
+ for src, dest in self.data['resources']:
+ fp.write(u' %s = %s\n' % (src, dest))
+ fp.write(u'\n')
+
finally:
fp.close()
@@ -400,14 +414,8 @@
for src in srcs]
data['resources'].extend(files)
- # 2.2 package_data -> extra_files
- package_dirs = dist.package_dir or {}
- for package, extras in dist.package_data.items() or []:
- package_dir = package_dirs.get(package, package)
- for file_ in extras:
- if package_dir:
- file_ = package_dir + '/' + file_
- data['extra_files'].append(file_)
+ # 2.2 package_data
+ data['package_data'] = dist.package_data.copy()
# Use README file if its content is the desciption
if "description" in data:
diff --git a/distutils2/tests/test_create.py b/distutils2/tests/test_create.py
--- a/distutils2/tests/test_create.py
+++ b/distutils2/tests/test_create.py
@@ -118,7 +118,6 @@
package_data={
'babar': ['Pom', 'Flora', 'Alexander'],
'me': ['dady', 'mumy', 'sys', 'bro'],
- '': ['setup.py', 'README'],
'pyxfoil': ['fengine.so'],
},
scripts=['my_script', 'bin/run'],
@@ -155,16 +154,15 @@
mymodule
scripts = my_script
bin/run
- extra_files = Martinique/Lamentin/dady
- Martinique/Lamentin/mumy
- Martinique/Lamentin/sys
- Martinique/Lamentin/bro
- setup.py
- README
- Pom
- Flora
- Alexander
- pyxfoil/fengine.so
+ package_data =
+ babar = Pom
+ Flora
+ Alexander
+ me = dady
+ mumy
+ sys
+ bro
+ pyxfoil = fengine.so
resources =
README.rst = {doc}
@@ -228,8 +226,9 @@
[files]
packages = pyxfoil
- extra_files = pyxfoil/fengine.so
- pyxfoil/babar.so
+ package_data =
+ pyxfoil = fengine.so
+ babar.so
resources =
README.rst = {doc}
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list