Compare commits
1 commit
868ee28677
...
d8d008a3a9
Author | SHA1 | Date | |
---|---|---|---|
d8d008a3a9 |
2 changed files with 6 additions and 9 deletions
|
@ -25,7 +25,7 @@ repos:
|
||||||
- id: black
|
- id: black
|
||||||
args: ['--target-version', 'py37', '--line-length', '100']
|
args: ['--target-version', 'py37', '--line-length', '100']
|
||||||
- repo: https://github.com/PyCQA/isort
|
- repo: https://github.com/PyCQA/isort
|
||||||
rev: 5.12.0
|
rev: 5.11.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
args: ['--profile', 'black', '--line-length', '100']
|
args: ['--profile', 'black', '--line-length', '100']
|
||||||
|
|
|
@ -42,10 +42,7 @@ parser.add_argument(
|
||||||
"--rc",
|
"--rc",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="include_rc",
|
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()
|
options = parser.parse_args()
|
||||||
|
@ -77,13 +74,13 @@ if not CURRENT:
|
||||||
print(EXCEPTION if EXCEPTION else "")
|
print(EXCEPTION if EXCEPTION else "")
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
CURRENT = CURRENT.replace("+", "-")
|
CURRENT = CURRENT.replace('+', '-')
|
||||||
logging.debug("Cleaned current version: %s", CURRENT)
|
logging.debug('Cleaned current version: %s', CURRENT)
|
||||||
|
|
||||||
LATEST = None
|
LATEST = None
|
||||||
try:
|
try:
|
||||||
logging.debug("Get releases RSS feed from %s...", options.url)
|
logging.debug("Get releases RSS feed from %s...", options.url)
|
||||||
r = requests.get(options.url, timeout=options.timeout)
|
r = requests.get(options.url)
|
||||||
logging.debug("Data retreive:\n%s", r.text)
|
logging.debug("Data retreive:\n%s", r.text)
|
||||||
data = xmltodict.parse(r.text)
|
data = xmltodict.parse(r.text)
|
||||||
for item in data["rss"]["channel"]["item"]:
|
for item in data["rss"]["channel"]["item"]:
|
||||||
|
@ -98,7 +95,7 @@ except Exception: # pylint: disable=broad-except
|
||||||
logging.debug("Latest version: %s", LATEST)
|
logging.debug("Latest version: %s", LATEST)
|
||||||
|
|
||||||
if not 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}")
|
print(f"Current version: {CURRENT}")
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue