use the same line terminator everywhere

This commit is contained in:
Tarek Ziade 2011-05-21 19:45:48 +02:00
parent fb2473fc8b
commit be20be1345
3 changed files with 11 additions and 6 deletions

View File

@ -110,7 +110,7 @@ class install_distinfo(Command):
logger.info('creating %s', resources_path) logger.info('creating %s', resources_path)
with open(resources_path, 'wb') as f: with open(resources_path, 'wb') as f:
writer = csv.writer(f, delimiter=',', writer = csv.writer(f, delimiter=',',
lineterminator=os.linesep, lineterminator='\n',
quotechar='"') quotechar='"')
for tuple in install_data.get_resources_out(): for tuple in install_data.get_resources_out():
writer.writerow(tuple) writer.writerow(tuple)
@ -122,7 +122,7 @@ class install_distinfo(Command):
logger.info('creating %s', record_path) logger.info('creating %s', record_path)
with open(record_path, 'w', encoding='utf-8') as f: with open(record_path, 'w', encoding='utf-8') as f:
writer = csv.writer(f, delimiter=',', writer = csv.writer(f, delimiter=',',
lineterminator=os.linesep, lineterminator='\n',
quotechar='"') quotechar='"')
install = self.get_finalized_command('install_dist') install = self.get_finalized_command('install_dist')

View File

@ -159,7 +159,8 @@ class Distribution:
def _get_records(self, local=False): def _get_records(self, local=False):
with self.get_distinfo_file('RECORD') as record: 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 # XXX needs an explaining comment
for row in record_reader: for row in record_reader:
path, checksum, size = (row[:] + path, checksum, size = (row[:] +
@ -171,7 +172,8 @@ class Distribution:
def get_resource_path(self, relative_path): def get_resource_path(self, relative_path):
with self.get_distinfo_file('RESOURCES') as resources_file: 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: for relative, destination in resources_reader:
if relative == relative_path: if relative == relative_path:
return destination return destination

View File

@ -111,7 +111,8 @@ class TestDistribution(CommonDistributionTests, unittest.TestCase):
record_file = os.path.join(distinfo_dir, 'RECORD') record_file = os.path.join(distinfo_dir, 'RECORD')
with open(record_file, 'w') as file: with open(record_file, 'w') as file:
record_writer = csv.writer( 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', '') dist_location = distinfo_dir.replace('.dist-info', '')
@ -125,9 +126,11 @@ class TestDistribution(CommonDistributionTests, unittest.TestCase):
record_writer.writerow([relpath(record_file, sys.prefix)]) record_writer.writerow([relpath(record_file, sys.prefix)])
with open(record_file) as file: with open(record_file) as file:
record_reader = csv.reader(file) record_reader = csv.reader(file, lineterminator='\n')
record_data = {} record_data = {}
for row in record_reader: for row in record_reader:
if row == []:
continue
path, md5_, size = (row[:] + path, md5_, size = (row[:] +
[None for i in range(len(row), 3)]) [None for i in range(len(row), 3)])
record_data[path] = md5_, size record_data[path] = md5_, size