Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
python3.35805
0001-allow-for-reproducible-builds-of-python-pa...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-allow-for-reproducible-builds-of-python-packages.patch of Package python3.35805
From 4bdc2c7155d37243514d61622f1c05771b009c31 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" <bmwiedemann@suse.de> Date: Sat, 25 Feb 2017 06:42:28 +0100 Subject: [PATCH] allow for reproducible builds of python packages See https://reproducible-builds.org/ for why this is good idea and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. Background: In some distributions like openSUSE, binary rpms contain precompiled .pyc files. And packages like amqp or twisted dynamically generate .py files at build time so those have the current time and that timestamp gets embedded into the .pyc file header. When we then adapt file timestamps in rpms to be constant, the timestamp in the .pyc header will no more match the .py timestamp in the filesystem. The software will still work, but it will not use the .pyc file as it should. Original version which doesn't force hashed *.pyc files Code is originally from gh#296 (never released in this form). Patch: 0001-allow-for-reproducible-builds-of-python-packages.patch --- Lib/py_compile.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/py_compile.py b/Lib/py_compile.py index 11c5b505cc6..2043291079f 100644 --- a/Lib/py_compile.py +++ b/Lib/py_compile.py @@ -137,6 +137,13 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1): except FileExistsError: pass source_stats = loader.path_stats(file) + sde = os.environ.get('SOURCE_DATE_EPOCH') + if sde and source_stats['mtime'] > int(sde): + source_stats['mtime'] = int(sde) + try: + os.utime(file, (source_stats['mtime'], source_stats['mtime'])) + except PermissionError: + pass bytecode = importlib._bootstrap_external._code_to_bytecode( code, source_stats['mtime'], source_stats['size']) mode = importlib._bootstrap_external._calc_mode(file) -- 2.45.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor