Compare commits
4 commits
d8d008a3a9
...
868ee28677
Author | SHA1 | Date | |
---|---|---|---|
868ee28677 | |||
30f392c18c | |||
268c522c65 | |||
71ecb70e9a |
2 changed files with 9 additions and 6 deletions
|
@ -25,7 +25,7 @@ repos:
|
|||
- id: black
|
||||
args: ['--target-version', 'py37', '--line-length', '100']
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.11.4
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ['--profile', 'black', '--line-length', '100']
|
||||
|
|
|
@ -42,7 +42,10 @@ parser.add_argument(
|
|||
"--rc",
|
||||
action="store_true",
|
||||
dest="include_rc",
|
||||
help=("Allow release candidate (default: only stable release are " "considered)"),
|
||||
help="Allow release candidate (default: only stable release are considered)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-t", "--timeout", type=int, help="Specify timeout for HTTP requests (default: 20)", default=20
|
||||
)
|
||||
|
||||
options = parser.parse_args()
|
||||
|
@ -74,13 +77,13 @@ if not CURRENT:
|
|||
print(EXCEPTION if EXCEPTION else "")
|
||||
sys.exit(3)
|
||||
|
||||
CURRENT = CURRENT.replace('+', '-')
|
||||
logging.debug('Cleaned current version: %s', CURRENT)
|
||||
CURRENT = CURRENT.replace("+", "-")
|
||||
logging.debug("Cleaned current version: %s", CURRENT)
|
||||
|
||||
LATEST = None
|
||||
try:
|
||||
logging.debug("Get releases RSS feed from %s...", options.url)
|
||||
r = requests.get(options.url)
|
||||
r = requests.get(options.url, timeout=options.timeout)
|
||||
logging.debug("Data retreive:\n%s", r.text)
|
||||
data = xmltodict.parse(r.text)
|
||||
for item in data["rss"]["channel"]["item"]:
|
||||
|
@ -95,7 +98,7 @@ except Exception: # pylint: disable=broad-except
|
|||
logging.debug("Latest version: %s", LATEST)
|
||||
|
||||
if not LATEST:
|
||||
print("UNKNOWN - Fail to retreive latest Forgejo release from the project " "RSS feed")
|
||||
print("UNKNOWN - Fail to retreive latest Forgejo release from the project RSS feed")
|
||||
print(f"Current version: {CURRENT}")
|
||||
sys.exit(3)
|
||||
|
||||
|
|
Loading…
Reference in a new issue