Compare commits
No commits in common. "487d38eafeb30db49148011d894a6d086211f603" and "868ee28677daadb5964a54a2b3c454b7070f859d" have entirely different histories.
487d38eafe
...
868ee28677
2 changed files with 33 additions and 51 deletions
|
@ -1,36 +1,31 @@
|
||||||
# Pre-commit hooks to run tests and ensure code is cleaned.
|
# Pre-commit hooks to run tests and ensure code is cleaned.
|
||||||
# See https://pre-commit.com for more information
|
# See https://pre-commit.com for more information
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: local
|
||||||
rev: v3.15.0
|
hooks:
|
||||||
hooks:
|
- id: pylint
|
||||||
- id: pyupgrade
|
name: pylint
|
||||||
args: ['--keep-percent-format', '--py37-plus']
|
entry: pylint
|
||||||
- repo: https://github.com/psf/black
|
language: system
|
||||||
rev: 23.11.0
|
types: [python]
|
||||||
hooks:
|
require_serial: true
|
||||||
- id: black
|
- repo: https://github.com/PyCQA/flake8
|
||||||
args: ['--target-version', 'py37', '--line-length', '100']
|
rev: 6.0.0
|
||||||
- repo: https://github.com/PyCQA/isort
|
hooks:
|
||||||
rev: 5.12.0
|
- id: flake8
|
||||||
hooks:
|
args: ['--max-line-length=100']
|
||||||
- id: isort
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
args: ['--profile', 'black', '--line-length', '100']
|
rev: v3.3.1
|
||||||
- repo: https://github.com/PyCQA/flake8
|
hooks:
|
||||||
rev: 6.1.0
|
- id: pyupgrade
|
||||||
hooks:
|
args: ['--keep-percent-format', '--py37-plus']
|
||||||
- id: flake8
|
- repo: https://github.com/psf/black
|
||||||
args: ['--max-line-length=100']
|
rev: 22.12.0
|
||||||
- repo: local
|
hooks:
|
||||||
hooks:
|
- id: black
|
||||||
- id: pylint
|
args: ['--target-version', 'py37', '--line-length', '100']
|
||||||
name: pylint
|
- repo: https://github.com/PyCQA/isort
|
||||||
entry: pylint
|
rev: 5.12.0
|
||||||
language: system
|
hooks:
|
||||||
types: [python]
|
- id: isort
|
||||||
require_serial: true
|
args: ['--profile', 'black', '--line-length', '100']
|
||||||
- repo: https://github.com/PyCQA/bandit
|
|
||||||
rev: 1.7.5
|
|
||||||
hooks:
|
|
||||||
- id: bandit
|
|
||||||
args: [--skip, "B101", --recursive, "mylib"]
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import subprocess # nosec
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
@ -59,7 +59,7 @@ logging.debug("Command use to retreive current version of Forgejo: %s", " ".join
|
||||||
OUTPUT = None
|
OUTPUT = None
|
||||||
EXCEPTION = None
|
EXCEPTION = None
|
||||||
try:
|
try:
|
||||||
OUTPUT = subprocess.check_output(cmd) # nosec
|
OUTPUT = subprocess.check_output(cmd)
|
||||||
logging.debug("Output:\n%s", OUTPUT)
|
logging.debug("Output:\n%s", OUTPUT)
|
||||||
m = re.search("version ([^ ]+) built", OUTPUT.decode("utf8", errors="ignore"))
|
m = re.search("version ([^ ]+) built", OUTPUT.decode("utf8", errors="ignore"))
|
||||||
if m:
|
if m:
|
||||||
|
@ -81,32 +81,19 @@ CURRENT = CURRENT.replace("+", "-")
|
||||||
logging.debug("Cleaned current version: %s", CURRENT)
|
logging.debug("Cleaned current version: %s", CURRENT)
|
||||||
|
|
||||||
LATEST = None
|
LATEST = None
|
||||||
LATEST_INT = 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, timeout=options.timeout)
|
||||||
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)
|
||||||
versions = {}
|
|
||||||
for item in data["rss"]["channel"]["item"]:
|
for item in data["rss"]["channel"]["item"]:
|
||||||
version = re.sub("^v", "", item["title"])
|
version = re.sub("^v", "", item["title"])
|
||||||
if not options.include_rc and "-rc" in version:
|
if not options.include_rc and "-rc" in version:
|
||||||
logging.debug("Ignore release candidate %s", version)
|
logging.debug("Ignore release candidate %s", version)
|
||||||
continue
|
continue
|
||||||
version_int = int(re.sub(r"[\.-]", "000", version))
|
LATEST = version
|
||||||
logging.debug("Found version %s (%s)", version, version_int)
|
break
|
||||||
if not LATEST_INT or LATEST_INT < version_int:
|
except Exception: # pylint: disable=broad-except
|
||||||
if LATEST:
|
|
||||||
logging.debug(
|
|
||||||
"Version %s considered as newer than %s, override latest version",
|
|
||||||
version,
|
|
||||||
LATEST,
|
|
||||||
)
|
|
||||||
LATEST = version
|
|
||||||
LATEST_INT = version_int
|
|
||||||
else:
|
|
||||||
logging.debug("Version %s considered as oldest than %s", version, LATEST)
|
|
||||||
except Exception: # pylint: disable=broad-except # nosec
|
|
||||||
pass
|
pass
|
||||||
logging.debug("Latest version: %s", LATEST)
|
logging.debug("Latest version: %s", LATEST)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue