Skip to content

Commit

Permalink
Fix handling of special characters in filenames in RECORD file
Browse files Browse the repository at this point in the history
  • Loading branch information
adang1345 committed Sep 5, 2023
1 parent 006ed6e commit abd2eb6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions delvewheel/_wheel_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ast
import base64
import csv
import hashlib
import os
import pathlib
Expand Down Expand Up @@ -950,14 +951,12 @@ def repair(self, target: str, no_mangles: set, no_mangle_all: bool, strip: bool,
for root, _, files in os.walk(self._extract_dir):
for file in files:
filepath_list.append(os.path.join(root, file))
with open(record_filepath, 'w', newline='\n') as record_file:
with open(record_filepath, 'w', newline='\n') as record_file, csv.writer(record_file, lineterminator='\n') as writer:
for file_path in filepath_list:
if file_path == record_filepath:
record_file.write(os.path.relpath(record_filepath, self._extract_dir).replace('\\', '/'))
record_file.write(',,\n')
writer.writerow((os.path.relpath(record_filepath, self._extract_dir).replace('\\', '/'), '', ''))
else:
record_line = '{},sha256={},{}\n'.format(os.path.relpath(file_path, self._extract_dir).replace('\\', '/'), *self._rehash(file_path))
record_file.write(record_line)
writer.writerow((os.path.relpath(file_path, self._extract_dir).replace('\\', '/'), *self._rehash(file_path)))

# repackage wheel
print('repackaging wheel')
Expand Down

0 comments on commit abd2eb6

Please sign in to comment.