Check for an updated version of scancode-toolkit. Return a message to display if outdated or None. Limit the frequency of checks to once per week. State is stored in the scancode_cache_dir. If `force` is True, redo a PyPI remote check.
(
installed_version=scancode_version,
release_date=scancode_release_date,
new_version_url='https://pypi.org/pypi/scancode-toolkit/json',
force=False,
)
| 131 | |
| 132 | |
| 133 | def check_scancode_version( |
| 134 | installed_version=scancode_version, |
| 135 | release_date=scancode_release_date, |
| 136 | new_version_url='https://pypi.org/pypi/scancode-toolkit/json', |
| 137 | force=False, |
| 138 | ): |
| 139 | """ |
| 140 | Check for an updated version of scancode-toolkit. Return a message to |
| 141 | display if outdated or None. Limit the frequency of checks to once per week. |
| 142 | State is stored in the scancode_cache_dir. If `force` is True, redo a PyPI |
| 143 | remote check. |
| 144 | """ |
| 145 | newer_version = fetch_newer_version( |
| 146 | installed_version=installed_version, |
| 147 | new_version_url=new_version_url, |
| 148 | force=force, |
| 149 | ) |
| 150 | if newer_version: |
| 151 | return build_outdated_message( |
| 152 | installed_version=installed_version, |
| 153 | release_date=release_date, |
| 154 | newer_version=newer_version, |
| 155 | ) |
| 156 | |
| 157 | |
| 158 | def fetch_newer_version( |
no test coverage detected