As of HEAD, when using --cache-all, cppman first downloads the source page and then checks if it was already in the filesystem (or if update was forced). This makes no sense, since the purpose of a cache is to prevent useless downloads.
This PR move the cache check just a few lines up, so it does not download if there no need to. AFAIK this is the right behavior, please tell me if I got something wrong.
I also moved gzip open/write/close to a with statement, that are cleaner and more pythonic.
The reverse or condition is just to prevent a useless linear in-search if forced is true. Yes, this is a pretty desperate optimization but hey. :smile:
As of HEAD, when using
--cache-all
, cppman first downloads the source page and then checks if it was already in the filesystem (or if update was forced). This makes no sense, since the purpose of a cache is to prevent useless downloads.This PR move the cache check just a few lines up, so it does not download if there no need to. AFAIK this is the right behavior, please tell me if I got something wrong.
I also moved gzip open/write/close to a
with
statement, that are cleaner and more pythonic.The reverse
or
condition is just to prevent a useless linear in-search ifforced
is true. Yes, this is a pretty desperate optimization but hey. :smile: