mirror of
https://github.com/Eugeny/tabby-web.git
synced 2026-08-19 07:46:03 +01:00
lint
This commit is contained in:
@@ -11,52 +11,52 @@ from urllib.parse import urlparse
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Downloads a new app version'
|
||||
help = "Downloads a new app version"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('version', type=str)
|
||||
parser.add_argument("version", type=str)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
version = options['version']
|
||||
target = f'{settings.APP_DIST_STORAGE}/{version}'
|
||||
version = options["version"]
|
||||
target = f"{settings.APP_DIST_STORAGE}/{version}"
|
||||
|
||||
fs = fsspec.filesystem(urlparse(settings.APP_DIST_STORAGE).scheme)
|
||||
|
||||
plugin_list = [
|
||||
'tabby-web-container',
|
||||
'tabby-core',
|
||||
'tabby-settings',
|
||||
'tabby-terminal',
|
||||
'tabby-ssh',
|
||||
'tabby-community-color-schemes',
|
||||
'tabby-serial',
|
||||
'tabby-telnet',
|
||||
'tabby-web',
|
||||
'tabby-web-demo',
|
||||
"tabby-web-container",
|
||||
"tabby-core",
|
||||
"tabby-settings",
|
||||
"tabby-terminal",
|
||||
"tabby-ssh",
|
||||
"tabby-community-color-schemes",
|
||||
"tabby-serial",
|
||||
"tabby-telnet",
|
||||
"tabby-web",
|
||||
"tabby-web-demo",
|
||||
]
|
||||
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
tempdir = Path(tempdir)
|
||||
for plugin in plugin_list:
|
||||
logging.info(f'Resolving {plugin}@{version}')
|
||||
response = requests.get(f'{settings.NPM_REGISTRY}/{plugin}/{version}')
|
||||
logging.info(f"Resolving {plugin}@{version}")
|
||||
response = requests.get(f"{settings.NPM_REGISTRY}/{plugin}/{version}")
|
||||
response.raise_for_status()
|
||||
info = response.json()
|
||||
url = info['dist']['tarball']
|
||||
url = info["dist"]["tarball"]
|
||||
|
||||
logging.info(f'Downloading {plugin}@{version} from {url}')
|
||||
logging.info(f"Downloading {plugin}@{version} from {url}")
|
||||
response = requests.get(url)
|
||||
|
||||
with tempfile.NamedTemporaryFile('wb') as f:
|
||||
with tempfile.NamedTemporaryFile("wb") as f:
|
||||
f.write(response.content)
|
||||
plugin_final_target = Path(tempdir) / plugin
|
||||
|
||||
with tempfile.TemporaryDirectory() as extraction_tmp:
|
||||
subprocess.check_call(
|
||||
['tar', '-xzf', f.name, '-C', str(extraction_tmp)]
|
||||
["tar", "-xzf", f.name, "-C", str(extraction_tmp)]
|
||||
)
|
||||
shutil.move(
|
||||
Path(extraction_tmp) / 'package', plugin_final_target
|
||||
Path(extraction_tmp) / "package", plugin_final_target
|
||||
)
|
||||
|
||||
if fs.exists(target):
|
||||
|
||||
Reference in New Issue
Block a user