aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/egg_info.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-05-17 19:14:29 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-05-17 19:14:29 -0400
commitfaae7b49cab317203b07d4a418ee7b68c7afb48e (patch)
treed3d12f481ec58a5fdeb5f10c7f6cc3c1547b612e /setuptools/command/egg_info.py
parent380e609d0d788edbdc5808f6d58c6c730a78cb3a (diff)
downloadexternal_python_setuptools-faae7b49cab317203b07d4a418ee7b68c7afb48e.tar.gz
external_python_setuptools-faae7b49cab317203b07d4a418ee7b68c7afb48e.tar.bz2
external_python_setuptools-faae7b49cab317203b07d4a418ee7b68c7afb48e.zip
Use StringIO to write out requirements. Use more common convention of adding newline to each line of the file, not just intervening lines.
Diffstat (limited to 'setuptools/command/egg_info.py')
-rwxr-xr-xsetuptools/command/egg_info.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 38a01fbf..470ba466 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -5,6 +5,7 @@ Create a distribution's .egg-info directory and contents"""
import os
import re
import sys
+import io
from setuptools import Command
import distutils.errors
@@ -355,14 +356,21 @@ def warn_depends_obsolete(cmd, basename, filename):
)
+def _write_requirements(stream, reqs):
+ lines = yield_lines(reqs or ())
+ append_cr = lambda line: line + '\n'
+ lines = map(append_cr, lines)
+ stream.writelines(lines)
+
def write_requirements(cmd, basename, filename):
dist = cmd.distribution
- data = ['\n'.join(yield_lines(dist.install_requires or ()))]
+ data = io.StringIO()
+ _write_requirements(data, dist.install_requires)
extras_require = dist.extras_require or {}
for extra in sorted(extras_require):
- reqs = extras_require[extra]
- data.append('\n\n[%s]\n%s' % (extra, '\n'.join(yield_lines(reqs))))
- cmd.write_or_delete_file("requirements", filename, ''.join(data))
+ data.write('\n[{extra}]\n'.format(**vars()))
+ _write_requirements(data, extras_require[extra])
+ cmd.write_or_delete_file("requirements", filename, data.getvalue())
def write_toplevel_names(cmd, basename, filename):
pkgs = dict.fromkeys(