--- a/sipbuild/builder.py 2025-04-21 12:19:34 +++ b/sipbuild/builder.py 2025-04-21 12:27:09 @@ -177,16 +177,23 @@ saved_cwd = os.getcwd() os.chdir(wheel_build_dir) - from zipfile import ZipFile, ZIP_DEFLATED + from zipfile import ZipFile, ZipInfo, ZIP_DEFLATED + import time + epoch = int(os.environ.get('SOURCE_DATE_EPOCH', '946684800')) + zip_timestamp = time.gmtime(epoch)[:6] + with ZipFile(wheel_path, 'w', compression=ZIP_DEFLATED) as zf: for dirpath, _, filenames in os.walk('.'): for filename in filenames: # This will result in a name with no leading '.'. name = os.path.relpath(os.path.join(dirpath, filename)) - zf.write(name) + zi = ZipInfo(name, zip_timestamp) + with open(name, 'rb') as f: + zf.writestr(zi, f.read()) + os.chdir(saved_cwd) return wheel_file