bpo-29708: allow to force hash-based pycs by bmwiedemann · Pull Request #5200 · python/cpython (original) (raw)

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 our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation8 Commits4 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

bmwiedemann

brettcannon

Choose a reason for hiding this comment

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

Just a request to expand the documentation and tweak the test to follow what is already there for hash-based .pyc files.

@@ -71,6 +71,8 @@ byte-code cache files in the directory containing the source code.
.. versionchanged:: 3.7
The *invalidation_mode* parameter was added as specified in :pep:`552`.
If the :envvar:`SOURCE_DATE_EPOCH` environment variable is set, this will
be forced to CHECKED_HASH.

Choose a reason for hiding this comment

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

This should also be mentioned in the main documentation. In other words, if the "version changed" note went away the docs should still cover what they need to cover. So this should say something like "Detecting the :envvar:SOURCE_DATE_EPOCH environment variable to force CHECKED_HASH was added."

py_compile.compile(self.source_path, self.pyc_path)
self.assertTrue(os.path.exists(self.pyc_path))
self.assertFalse(os.path.exists(self.cache_path))
with open(self.pyc_path, "rb") as f:

Choose a reason for hiding this comment

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

I would look at

def test_invalidation_mode(self):

as an example on how to make this test a little bit more robust in the face of .pyc files changing.

@bedevere-bot

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 phrase I 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.

@bmwiedemann

I have made the requested changes; please review again.

@bedevere-bot

Thanks for making the requested changes!

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

brettcannon

Choose a reason for hiding this comment

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

Just waiting until Friday to merge to give people enough time to comment on the proposed solution. Otherwise the PR LGTM!

@bmwiedemann

using the well-established SOURCE_DATE_EPOCH environment variable to allow for reproducible builds of python packages.

See https://reproducible-builds.org/ for why this is good.

@brettcannon

@SKalt SKalt mentioned this pull request

Nov 21, 2019