Find the tool's url in the package metadata.
This commit is contained in:
parent
1028f74de9
commit
d2dcb4cf85
3 changed files with 19 additions and 6 deletions
|
|
@ -27,7 +27,7 @@ e.g. After cloning do:
|
|||
|
||||
Extensions | Tools
|
||||
---------- | -----
|
||||
.py | python_syntax • python_unittests • pydoc • mypy • python_coverage • python_profile • pycodestyle • pyflakes • pylint • python_gut • python_modulefinder • python_mccabe • [bandit](http://wiki.openstack.org/wiki/Security/Project/Bandit)
|
||||
.py | python_syntax • python_unittests • pydoc • mypy • python_coverage • python_profile • pycodestyle • pyflakes • pylint • python_gut • python_modulefinder • python_mccabe • [bandit](https://wiki.openstack.org/wiki/Security/Projects/Bandit)
|
||||
.pyc | disassemble_pyc
|
||||
.pl .pm .t | perl_syntax • perldoc • perltidy
|
||||
.pod .pod6 | perldoc
|
||||
|
|
|
|||
|
|
@ -9,10 +9,9 @@ import tools
|
|||
|
||||
|
||||
def tool_markup(tool):
|
||||
try:
|
||||
return "[%s](%s)" % (tool.__name__, tool.url)
|
||||
except AttributeError:
|
||||
return tool.__name__
|
||||
url = tools.url_of_tool(tool)
|
||||
return (tool.__name__ if url is None else
|
||||
"[%s](%s)" % (tool.__name__, url))
|
||||
|
||||
|
||||
print("""\
|
||||
|
|
|
|||
16
tools.py
16
tools.py
|
|
@ -460,7 +460,7 @@ def bandit(path):
|
|||
text_without_timestamp = "".join(text.splitlines(keepends=True)[2:])
|
||||
return status, fill3.Text(text_without_timestamp)
|
||||
bandit.dependencies = {"python-bandit", "python3-bandit"}
|
||||
bandit.url = "http://wiki.openstack.org/wiki/Security/Project/Bandit"
|
||||
bandit.url = "python3-bandit"
|
||||
|
||||
|
||||
def _perl_version(path):
|
||||
|
|
@ -819,3 +819,17 @@ def tool_name_colored(tool, path):
|
|||
char_style = (termstr.CharStyle(is_bold=True) if tool in _generic_tools()
|
||||
else _charstyle_of_path(path))
|
||||
return termstr.TermStr(tool.__name__, char_style)
|
||||
|
||||
|
||||
@functools.lru_cache()
|
||||
def get_homepage_of_package(package):
|
||||
line = subprocess.getoutput("dpkg-query --status %s | grep Homepage" % package)
|
||||
return line.split()[1]
|
||||
|
||||
|
||||
def url_of_tool(tool):
|
||||
try:
|
||||
url = tool.url
|
||||
return url if url.startswith("http") else get_homepage_of_package(url)
|
||||
except AttributeError:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue