Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove __pycache__ folders from packages #1909

Merged
merged 1 commit into from Mar 14, 2024
Merged

Remove __pycache__ folders from packages #1909

merged 1 commit into from Mar 14, 2024

Conversation

legoktm
Copy link
Member

@legoktm legoktm commented Mar 13, 2024

Status

Ready for review

Description

We already delete the individual .pyc files because they're not reproducible, but leave behind empty __pycache__ folders. This can be annoying if people are doing builds out of a development checkout that has these folders that won't be present on a pristine build.

So remove the empty folders right after deleting the .pyc files.

Fixes #1907.

Test Plan

  • On main, run FAST=1 make build-debs
  • Run dpkg -c build/securedrop-client_0.9.0+bullseye_all.deb | grep pycache, observe that you see a number of folders in the package, especially under /opt/venvs
  • Check out this patch, run FAST=1 make build-debs again
  • Re-run dpkg -c build/securedrop-client_0.9.0+bullseye_all.deb | grep pycache, you should get nothing. Yay!

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:

  • I have updated the AppArmor profile
  • No update to the AppArmor profile is required for these changes
  • I don't know and would appreciate guidance

If these changes modify the database schema, you should include a database migration. Please check as applicable:

  • I have written a migration and upgraded a test database based on main and confirmed that the migration is self-contained and applies cleanly
  • I have written a migration but have not upgraded a test database based on main and would like the reviewer to do so
  • I need help writing a database migration
  • No database schema changes are needed

We already delete the individual .pyc files because they're not
reproducible, but leave behind empty `__pycache__` folders. This can be
annoying if people are doing builds out of a development checkout that
has these folders that won't be present on a pristine build.

So remove the empty folders right after deleting the .pyc files.

Fixes #1907.
@legoktm legoktm requested a review from a team as a code owner March 13, 2024 18:22
@rocodes rocodes self-assigned this Mar 14, 2024
Copy link
Contributor

@rocodes rocodes left a comment

Choose a reason for hiding this comment

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

Test Plan

  • On main, run FAST=1 make build-debs
  • Run dpkg -c build/securedrop-client_0.9.0+bullseye_all.deb | grep pycache, observe that you see a number of folders in the package, especially under /opt/venvs
  • Check out this patch, run FAST=1 make build-debs again
  • Re-run dpkg -c build/securedrop-client_0.9.0+bullseye_all.deb | grep pycache, you should get nothing. Yay!
  • Yay!

thanks @legoktm for casually making our lives better at random opportunities :)

@rocodes rocodes merged commit 435362b into main Mar 14, 2024
92 checks passed
@rocodes rocodes deleted the no-pycache branch March 14, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Purge __pycache__ from packages
2 participants