[focal/core20][python3.7+] staging conflicts when multiple python parts have the same python dependencies
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Triaged
|
High
|
Sergio Schvezov | ||
pip |
Unknown
|
Unknown
|
|||
python-pip (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
TL;DR: as of python 3.7, .pyc files by default include a timestamp and a size of the source file which results in a change of a hash every time a .pyc file is generated for a given source file. This results in staging conflicts for python parts.
https:/
https:/
Even if this is set, there is still an issue https:/
Description/
When building a project with multiple identical python dependencies I consistently get an error like this:
Failed to stage: Parts 'openstack-
bin/activate
bin/
bin/
bin/python3
pyvenv.cfg
bin/python3
lib/
lib/
lib/
lib/
# many other .pyc files ...
While snapcraft suggests that I use something like `organize`, `filesets` and `stage`, the issue is that the source files for those dependencies are identical - there is no reason for any manual work here.
Source hashes are the same:
snapcraft-
6a30b3933165cb9
./parts/
snapcraft-
6a30b3933165cb9
.pyc files are different:
snapcraft-
398b47a5abfc87e
snapcraft-
d4642cfecd727d2
RECORD files include hashes as well, hence they are also different:
snapcraft-
1c1
< ../../.
---
> ../../.
Apparently, as of python 3.7, .pyc files include a timestamp and a size of the source by default (PycInvalidatio
https:/
py_compile.
invalidation_mode should be a member of the PycInvalidationMode enum and controls how the generated bytecode cache is invalidated at runtime. The default is PycInvalidation
https:/
TIMESTAMP
The .pyc file includes the timestamp and size of the source file, which Python will compare against the metadata of the source file at runtime to determine if the .pyc file needs to be regenerated.
https:/
CHECKED_HASH
The .pyc file includes a hash of the source file content, which Python will compare against the source at runtime to determine if the .pyc file needs to be regenerated.
Adding something like this seems to be needed:
build-
- SOURCE_DATE_EPOCH: '1591640328'
However, see https:/
summary: |
- focal/core20: staging conflicts when multiple python parts have the same - python dependencies (python 3.7+) + [focal/core20][python3.7+] staging conflicts when multiple python parts + have the same python dependencies |
description: | updated |
no longer affects: | python3.8 (Ubuntu) |
description: | updated |
Great, this shall be in 4.1 then