(base_dir, dist_info_dir)
| 271 | |
| 272 | |
| 273 | def _create_record_file(base_dir, dist_info_dir): |
| 274 | entries = [] |
| 275 | for base, dirs, files in os.walk(base_dir): |
| 276 | dirs.sort() |
| 277 | for filename in sorted(files): |
| 278 | # Record file has its own special entry at the end |
| 279 | if filename == "RECORD": |
| 280 | continue |
| 281 | target = os.path.join(base, filename) |
| 282 | # Path entries in record file are unix style |
| 283 | path = os.path.relpath(target, base_dir).replace(os.sep, "/") |
| 284 | digest = _get_b64_sha256(target) |
| 285 | size = os.path.getsize(target) |
| 286 | record_entry = f"{path},sha256={digest},{size}" |
| 287 | entries.append(record_entry) |
| 288 | entries.append(f"{dist_info_dir}/RECORD,,") |
| 289 | record_path = os.path.join(base_dir, dist_info_dir, "RECORD") |
| 290 | with open(record_path, "w") as f: |
| 291 | f.write("\n".join(entries) + "\n") |
| 292 | |
| 293 | |
| 294 | def _get_b64_sha256(path): |
no test coverage detected