mirror of
https://github.com/audacity/conan-recipes.git
synced 2025-12-12 19:49:52 -06:00
26 lines
759 B
Python
26 lines
759 B
Python
import subprocess
|
|
import json
|
|
from impl.utils import get_conan
|
|
|
|
def list_remotes() -> list[str]:
|
|
remotes = subprocess.check_output([get_conan(), 'remote', 'list', '--format', 'json']).decode('utf-8')
|
|
return json.loads(remotes)
|
|
|
|
def add_remote(name:str, url:str) -> None:
|
|
remotes = list_remotes()
|
|
for remote in remotes:
|
|
if remote['name'] != name:
|
|
continue
|
|
if remote['url'] != url:
|
|
subprocess.check_call([get_conan(), 'remote', 'update', '--url', name])
|
|
return False
|
|
|
|
subprocess.check_call([get_conan(), 'remote', 'add', name, url])
|
|
return True
|
|
|
|
def remove_remote(name:str) -> None:
|
|
try:
|
|
subprocess.check_call([get_conan(), 'remote', 'remove', name])
|
|
finally:
|
|
pass
|