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

Fallback to use the Python API to compress/decompress when the CLI dependency is not installed #3755

Closed
suhaibmujahid opened this issue Oct 25, 2023 · 1 comment · Fixed by #3756
Labels
good-first-bug Good for newcomers

Comments

@suhaibmujahid
Copy link
Member

We use the zstd binary in some places instead of zstandard for some performance gains. However, this becomes an issue when the zstd package is not installed, or the binary location is not listed in PATH.

Example of using the zstd binary through CLI:

bugbug/bugbug/utils.py

Lines 244 to 248 in b6291dc

def zstd_compress(path: str) -> None:
if not os.path.exists(path):
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path)
subprocess.run(["zstdmt", "-f", path], check=True)

In this case, we should fallback to using zstandard API if we fail to compress using zstdmt because zstd is not installed.

This will solve the following:

@suhaibmujahid suhaibmujahid added the good-first-bug Good for newcomers label Oct 25, 2023
@marco-c
Copy link
Collaborator

marco-c commented Oct 25, 2023

The old code, which was not using zstd, to decompress can be seen in this commit: c079f0f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-bug Good for newcomers
Projects
None yet
2 participants