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
|
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
|
.pyc | disassemble_pyc
|
||||||
.pl .pm .t | perl_syntax • perldoc • perltidy
|
.pl .pm .t | perl_syntax • perldoc • perltidy
|
||||||
.pod .pod6 | perldoc
|
.pod .pod6 | perldoc
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,9 @@ import tools
|
||||||
|
|
||||||
|
|
||||||
def tool_markup(tool):
|
def tool_markup(tool):
|
||||||
try:
|
url = tools.url_of_tool(tool)
|
||||||
return "[%s](%s)" % (tool.__name__, tool.url)
|
return (tool.__name__ if url is None else
|
||||||
except AttributeError:
|
"[%s](%s)" % (tool.__name__, url))
|
||||||
return tool.__name__
|
|
||||||
|
|
||||||
|
|
||||||
print("""\
|
print("""\
|
||||||
|
|
|
||||||
16
tools.py
16
tools.py
|
|
@ -460,7 +460,7 @@ def bandit(path):
|
||||||
text_without_timestamp = "".join(text.splitlines(keepends=True)[2:])
|
text_without_timestamp = "".join(text.splitlines(keepends=True)[2:])
|
||||||
return status, fill3.Text(text_without_timestamp)
|
return status, fill3.Text(text_without_timestamp)
|
||||||
bandit.dependencies = {"python-bandit", "python3-bandit"}
|
bandit.dependencies = {"python-bandit", "python3-bandit"}
|
||||||
bandit.url = "http://wiki.openstack.org/wiki/Security/Project/Bandit"
|
bandit.url = "python3-bandit"
|
||||||
|
|
||||||
|
|
||||||
def _perl_version(path):
|
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()
|
char_style = (termstr.CharStyle(is_bold=True) if tool in _generic_tools()
|
||||||
else _charstyle_of_path(path))
|
else _charstyle_of_path(path))
|
||||||
return termstr.TermStr(tool.__name__, char_style)
|
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