-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: get tool versions without VersionInfo model (#7418)
* feat: get tool versions without VersionInfo model * chore: remove update_external_command_info call * feat: get tool version without VersionInfo * chore: Remove VersionInfo model * chore: Migration to remove VersionInfo * fix: handle errors better; ignore stderr * fix: type annotation
- Loading branch information
1 parent
48e0aa2
commit a4e0354
Showing
12 changed files
with
66 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
# Copyright The IETF Trust 2007, All Rights Reserved | ||
# Copyright The IETF Trust 2007-2024, All Rights Reserved | ||
import subprocess | ||
|
||
|
||
class _ToolVersionManager: | ||
_known = [ | ||
"pyang", | ||
"xml2rfc", | ||
"xym", | ||
"yanglint", | ||
] | ||
_versions: dict[str, str] = dict() | ||
|
||
def __getitem__(self, item): | ||
if item not in self._known: | ||
return "Unknown" | ||
elif item not in self._versions: | ||
try: | ||
self._versions[item] = subprocess.run( | ||
[item, "--version"], | ||
capture_output=True, | ||
check=True, | ||
).stdout.decode().strip() | ||
except subprocess.CalledProcessError: | ||
return "Unknown" | ||
return self._versions[item] | ||
|
||
|
||
tool_version = _ToolVersionManager() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
ietf/utils/management/commands/update_external_command_info.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Generated by Django 4.2.11 on 2024-05-03 21:03 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("utils", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.DeleteModel( | ||
name="VersionInfo", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters