mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-15 14:15:55 -06:00
fix(version): do not lookup parent .git for git version detection
This commit is contained in:
parent
af416db5d1
commit
cd0eb7e476
3 changed files with 19 additions and 7 deletions
|
|
@ -12,7 +12,6 @@ insert_final_newline = true
|
|||
|
||||
[*.py]
|
||||
indent_size = 4
|
||||
src_paths=nvitop
|
||||
|
||||
[*.{yaml,yml,json,xml}]
|
||||
indent_size = 2
|
||||
|
|
|
|||
|
|
@ -28,11 +28,17 @@ if not __release__:
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
try:
|
||||
prefix, sep, suffix = (
|
||||
subprocess.check_output( # noqa: S603
|
||||
['git', 'describe', '--abbrev=7'], # noqa: S607
|
||||
cwd=os.path.dirname(os.path.abspath(__file__)),
|
||||
[ # noqa: S607
|
||||
'git',
|
||||
f'--git-dir={os.path.join(root_dir, ".git")}',
|
||||
'describe',
|
||||
'--abbrev=7',
|
||||
],
|
||||
cwd=root_dir,
|
||||
stderr=subprocess.DEVNULL,
|
||||
text=True,
|
||||
)
|
||||
|
|
@ -53,4 +59,4 @@ if not __release__:
|
|||
except (OSError, subprocess.CalledProcessError):
|
||||
pass
|
||||
|
||||
del os, subprocess
|
||||
del os, subprocess, root_dir
|
||||
|
|
|
|||
|
|
@ -28,11 +28,17 @@ if not __release__:
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
try:
|
||||
prefix, sep, suffix = (
|
||||
subprocess.check_output( # noqa: S603
|
||||
['git', 'describe', '--abbrev=7'], # noqa: S607
|
||||
cwd=os.path.dirname(os.path.abspath(__file__)),
|
||||
[ # noqa: S607
|
||||
'git',
|
||||
f'--git-dir={os.path.join(root_dir, ".git")}',
|
||||
'describe',
|
||||
'--abbrev=7',
|
||||
],
|
||||
cwd=root_dir,
|
||||
stderr=subprocess.DEVNULL,
|
||||
text=True,
|
||||
)
|
||||
|
|
@ -53,7 +59,8 @@ if not __release__:
|
|||
except (OSError, subprocess.CalledProcessError):
|
||||
pass
|
||||
|
||||
del os, subprocess
|
||||
del os, subprocess, root_dir
|
||||
|
||||
|
||||
# The package `nvidia-ml-py` is not backward compatible over releases. This may
|
||||
# cause problems with Old versions of NVIDIA drivers.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue