Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-91279: ZipFile.writestr now respect SOURCE_DATE_EPOCH#124435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jaraco merged 3 commits intopython:mainfromWulian233:SOURCE_DATE_EPOCH
Jan 20, 2025

Conversation

Wulian233
Copy link
Contributor

@Wulian233Wulian233 commentedSep 24, 2024
edited
Loading

NoSOURCE_DATE_EPOCH environment variable makes pip installing a package generate non-reproducible build artifacts.

SOURCE_DATE_EPOCH is astandardised environment variable that distributions can set centrally and have build tools consume this in order to produce reproducible output. In practice, specifies the last modification of something, usually the source code, measured in the number seconds since the Unix epoch, ie. .SOURCE_DATE_EPOCHJanuary 1st 1970, 00:00:00 UTC

Seehttps://reproducible-builds.org/docs/source-date-epoch/
details in issue:#91279

@ghost
Copy link

ghost commentedSep 24, 2024
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@ZeroIntensity
Copy link
Member

Could you add a test for this?

@Wulian233
Copy link
ContributorAuthor

Could you add a test for this?

Yes, this change should also be synchronized in the tests.

Note:zipfile.writestr is not a function, it is thezipfile.ZipFile.writestr method

https://github.com/python/cpython/blob/main/Lib/test/test_zipfile/_path/test_path.py#L668-L668

@ZeroIntensity
Copy link
Member

Oh! TIL

@Wulian233Wulian233 marked this pull request as draftSeptember 25, 2024 13:40
@Wulian233Wulian233 marked this pull request as ready for reviewSeptember 27, 2024 12:56
Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM.

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@Wulian233Wulian233 reopened thisDec 30, 2024
@Wulian233
Copy link
ContributorAuthor

Wulian233 commentedDec 30, 2024
edited
Loading

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

@jaraco: please review the changes made to this pull request.

# gh-91279: Set the SOURCE_DATE_EPOCH to a specific timestamp
epoch = os.environ.get('SOURCE_DATE_EPOCH')
get_time = int(epoch) if epoch else time.time()
self.date_time = time.gmtime(get_time)[:6]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm a little uneasy thattime.localtime() is now replaced bytime.gmtime(). That means that the value will change depending on the local time zone of the machine running the code, which may not be adequately exercised in the code. Are there existing tests that validate thatgmtime is the correct usage here?

Copy link
ContributorAuthor

@Wulian233Wulian233Jan 1, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I checked the documentation. Shouldtime.gmtime return UTC time and not change with time zones?time.localtime says "Like gmtime() but converts to local time"

https://docs.python.org/3.14/library/time.html#time.gmtime

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What I mean is that this change alters the behavior for all cases. The issue doesn't make mention of gmtime and only mentions localtime in relation to the current implementation. What's the motivation for changing it?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sorry, I see that I was mistaken. To implement this PR I originally thought it was necessary to change it to gmtime, but in fact, this modification should not have been made😥

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@Wulian233
Copy link
ContributorAuthor

I have made the requested changes; please review again

Sorry again for the inconvenience

@bedevere-app
Copy link

Thanks for making the requested changes!

@jaraco: please review the changes made to this pull request.

@bedevere-appbedevere-appbot requested a review fromjaracoJanuary 1, 2025 07:26
@jaracojaraco merged commit5d57959 intopython:mainJan 20, 2025
43 of 46 checks passed
@Wulian233Wulian233 deleted the SOURCE_DATE_EPOCH branchJanuary 20, 2025 21:09
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull requestJan 21, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jaracojaracojaraco approved these changes

@ZeroIntensityZeroIntensityZeroIntensity approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Wulian233@ZeroIntensity@jaraco

[8]ページ先頭

©2009-2025 Movatter.jp