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

feature: replace unzip usage with Python's zipfile #324

Merged
merged 2 commits into from
Aug 28, 2021

Conversation

mayeut
Copy link
Member

@mayeut mayeut commented Aug 22, 2021

This removes the need to have unzip installed.

fixes #258
closes #312

@mayeut
Copy link
Member Author

mayeut commented Aug 22, 2021

tests/unit/test-permissions.zip.xz created with:

mkdir test-permissions
pushd test-permissions 
for i in 0 1 2 3 4 5 6 7; do
	for j in 0 1 2 3 4 5 6 7; do
		for k in 0 1 2 3 4 5 6 7; do
			perm=${i}${j}${k}
			mkdir ${perm}.d
			touch ${perm}.d/f
			chmod ${perm} ${perm}.d
			touch ${perm}.f
			chmod ${perm} ${perm}.f
		done
	done
done
sudo zip -r -0 ../test-permissions.zip .
popd
sudo rm -rf test-permissions
xz -z -e -f test-permissions.zip

@codecov
Copy link

codecov bot commented Aug 22, 2021

Codecov Report

Merging #324 (66d02ac) into master (24fddf5) will increase coverage by 0.28%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #324      +/-   ##
==========================================
+ Coverage   89.07%   89.35%   +0.28%     
==========================================
  Files          23       23              
  Lines        1199     1203       +4     
  Branches      250      254       +4     
==========================================
+ Hits         1068     1075       +7     
+ Misses         82       78       -4     
- Partials       49       50       +1     
Impacted Files Coverage Δ
auditwheel/tools.py 92.59% <93.75%> (+6.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24fddf5...66d02ac. Read the comment docs.

@mayeut mayeut requested a review from lkollar August 22, 2021 18:45
Copy link
Contributor

@lkollar lkollar left a comment

Choose a reason for hiding this comment

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

Looks good to me. A question on the tests though: why not create the test zip fie in the test suite itself instead of checking the file in? That would make it clearer how the file is created and easier to maintain in case we have to change the input in the future.



def _write_test_permissions_zip(path):
source_zip_xz = Path(__file__).parent / "test-permissions.zip.xz"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this file compressed twice?

Copy link
Member Author

Choose a reason for hiding this comment

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

the zip is 215kB, with xz compression, goes down to 8kB

@mayeut
Copy link
Member Author

mayeut commented Aug 24, 2021

A question on the tests though: why not create the test zip fie in the test suite itself instead of checking the file in?

I wanted a single source for that file without wondering if there was an implementation detail in python x.y that would make things flaky.
I can still try to implement this in python & add some kind of check to make sure everything is as expected in the zip file.

@lkollar
Copy link
Contributor

lkollar commented Aug 26, 2021

I can still try to implement this in python & add some kind of check to make sure everything is as expected in the zip file.

I've approved the PR. If you still want to give this a go, we could handle it in a separate PR.

@auvipy auvipy merged commit 613db39 into pypa:master Aug 28, 2021
@mayeut mayeut deleted the zipfile branch August 28, 2021 08:42
@mayeut mayeut mentioned this pull request Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace unzip usage with Python's zipfile
3 participants