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 c9aeebf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 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 @@ -951,13 +952,13 @@ def repair(self, target: str, no_mangles: set, no_mangle_all: bool, strip: bool,
for file in files:
filepath_list.append(os.path.join(root, file))
with open(record_filepath, 'w', newline='\n') as record_file:
writer = csv.writer(record_file, lineterminator='\n')
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)
hash, size = self._rehash(file_path)
writer.writerow((os.path.relpath(file_path, self._extract_dir).replace('\\', '/'), f'sha256={hash}', size))

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

0 comments on commit c9aeebf

Please sign in to comment.