Docker-python fix for `get_ubuntu_version()` (#4430)

single_channel
Glenn Jocher 1 year ago committed by GitHub
parent 9d27e7ada4
commit 162e4035eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -85,7 +85,7 @@ jobs:
docker push ultralytics/ultralytics:${{ matrix.tags }} docker push ultralytics/ultralytics:${{ matrix.tags }}
- name: Notify on failure - name: Notify on failure
if: github.event_name == 'push' && (cancelled() || failure()) if: github.event_name == 'push' && failure() # do not notify on cancelled() as cancelling is performed by hand
uses: slackapi/slack-github-action@v1.24.0 uses: slackapi/slack-github-action@v1.24.0
with: with:
payload: | payload: |

@ -295,10 +295,8 @@ def test_events():
def test_utils_init(): def test_utils_init():
from ultralytics.utils import (get_git_branch, get_git_origin_url, get_ubuntu_version, is_github_actions_ci, from ultralytics.utils import get_git_branch, get_git_origin_url, get_ubuntu_version, is_github_actions_ci
is_ubuntu)
is_ubuntu()
get_ubuntu_version() get_ubuntu_version()
is_github_actions_ci() is_github_actions_ci()
get_git_origin_url() get_git_origin_url()

@ -424,7 +424,9 @@ class Exporter:
'https://github.com/pnnx/pnnx/.\nNote PNNX Binary file must be placed in current working directory ' 'https://github.com/pnnx/pnnx/.\nNote PNNX Binary file must be placed in current working directory '
f'or in {ROOT}. See PNNX repo for full installation instructions.') f'or in {ROOT}. See PNNX repo for full installation instructions.')
_, assets = get_github_assets(repo='pnnx/pnnx', retry=True) _, assets = get_github_assets(repo='pnnx/pnnx', retry=True)
asset = [x for x in assets if ('macos' if MACOS else 'ubuntu' if LINUX else 'windows') in x][0] system = 'macos' if MACOS else 'ubuntu' if LINUX else 'windows' # operating system
asset = [x for x in assets if system in x][0] if assets else \
f'https://github.com/pnnx/pnnx/releases/download/20230816/pnnx-20230816-{system}.zip' # fallback
attempt_download_asset(asset, repo='pnnx/pnnx', release='latest') attempt_download_asset(asset, repo='pnnx/pnnx', release='latest')
unzip_dir = Path(asset).with_suffix('') unzip_dir = Path(asset).with_suffix('')
pnnx = ROOT / pnnx_filename # new location pnnx = ROOT / pnnx_filename # new location

@ -571,6 +571,7 @@ def get_ubuntu_version():
Returns: Returns:
(str): Ubuntu version or None if not an Ubuntu OS. (str): Ubuntu version or None if not an Ubuntu OS.
""" """
if is_ubuntu():
with contextlib.suppress(FileNotFoundError, AttributeError): with contextlib.suppress(FileNotFoundError, AttributeError):
with open('/etc/os-release') as f: with open('/etc/os-release') as f:
return re.search(r'VERSION_ID="(\d+\.\d+)"', f.read())[1] return re.search(r'VERSION_ID="(\d+\.\d+)"', f.read())[1]

Loading…
Cancel
Save