diff options
author | Tarek Ziade <tarek@ziade.org> | 2011-05-21 17:45:48 (GMT) |
---|---|---|
committer | Tarek Ziade <tarek@ziade.org> | 2011-05-21 17:45:48 (GMT) |
commit | be20be134555c3a424edbcd1903e6683f0a6ee61 (patch) | |
tree | f0a1531afdc208f6728cfa5789845013a1567925 | |
parent | fb2473fc8b892291f23152adfa5dcf83cdf7f972 (diff) | |
download | cpython-be20be134555c3a424edbcd1903e6683f0a6ee61.zip cpython-be20be134555c3a424edbcd1903e6683f0a6ee61.tar.gz cpython-be20be134555c3a424edbcd1903e6683f0a6ee61.tar.bz2 |
use the same line terminator everywhere
-rw-r--r-- | Lib/packaging/command/install_distinfo.py | 4 | ||||
-rw-r--r-- | Lib/packaging/database.py | 6 | ||||
-rw-r--r-- | Lib/packaging/tests/test_database.py | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/Lib/packaging/command/install_distinfo.py b/Lib/packaging/command/install_distinfo.py index db49236..3390a1f 100644 --- a/Lib/packaging/command/install_distinfo.py +++ b/Lib/packaging/command/install_distinfo.py @@ -110,7 +110,7 @@ class install_distinfo(Command): logger.info('creating %s', resources_path) with open(resources_path, 'wb') as f: writer = csv.writer(f, delimiter=',', - lineterminator=os.linesep, + lineterminator='\n', quotechar='"') for tuple in install_data.get_resources_out(): writer.writerow(tuple) @@ -122,7 +122,7 @@ class install_distinfo(Command): logger.info('creating %s', record_path) with open(record_path, 'w', encoding='utf-8') as f: writer = csv.writer(f, delimiter=',', - lineterminator=os.linesep, + lineterminator='\n', quotechar='"') install = self.get_finalized_command('install_dist') diff --git a/Lib/packaging/database.py b/Lib/packaging/database.py index 087a6ec..b107148 100644 --- a/Lib/packaging/database.py +++ b/Lib/packaging/database.py @@ -159,7 +159,8 @@ class Distribution: def _get_records(self, local=False): with self.get_distinfo_file('RECORD') as record: - record_reader = csv.reader(record, delimiter=',') + record_reader = csv.reader(record, delimiter=',', + lineterminator='\n') # XXX needs an explaining comment for row in record_reader: path, checksum, size = (row[:] + @@ -171,7 +172,8 @@ class Distribution: def get_resource_path(self, relative_path): with self.get_distinfo_file('RESOURCES') as resources_file: - resources_reader = csv.reader(resources_file, delimiter=',') + resources_reader = csv.reader(resources_file, delimiter=',', + lineterminator='\n') for relative, destination in resources_reader: if relative == relative_path: return destination diff --git a/Lib/packaging/tests/test_database.py b/Lib/packaging/tests/test_database.py index c8d6385..ea63d3e 100644 --- a/Lib/packaging/tests/test_database.py +++ b/Lib/packaging/tests/test_database.py @@ -111,7 +111,8 @@ class TestDistribution(CommonDistributionTests, unittest.TestCase): record_file = os.path.join(distinfo_dir, 'RECORD') with open(record_file, 'w') as file: record_writer = csv.writer( - file, delimiter=',', quoting=csv.QUOTE_NONE) + file, delimiter=',', quoting=csv.QUOTE_NONE, + lineterminator='\n') dist_location = distinfo_dir.replace('.dist-info', '') @@ -125,9 +126,11 @@ class TestDistribution(CommonDistributionTests, unittest.TestCase): record_writer.writerow([relpath(record_file, sys.prefix)]) with open(record_file) as file: - record_reader = csv.reader(file) + record_reader = csv.reader(file, lineterminator='\n') record_data = {} for row in record_reader: + if row == []: + continue path, md5_, size = (row[:] + [None for i in range(len(row), 3)]) record_data[path] = md5_, size |