From 5ed38800c99b90446db312c80f7f9a0efdd5e29e Mon Sep 17 00:00:00 2001 From: panwentao Date: Wed, 3 Apr 2024 16:02:04 +0800 Subject: [PATCH] Adapter: Adapt to Python version 3.8 * Adapt to Python version 3.8 Signed-off-by: panwentao --- src/oebuild/bblayers.py | 4 ++-- src/oebuild/docker_proxy.py | 5 +++-- src/oebuild/parse_compile.py | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/oebuild/bblayers.py b/src/oebuild/bblayers.py index cb4ca73..021f7cc 100644 --- a/src/oebuild/bblayers.py +++ b/src/oebuild/bblayers.py @@ -40,7 +40,7 @@ class BBLayers: ''' return self._bblayers_dir - def add_layer(self, pre_dir: str, layers: str | list): + def add_layer(self, pre_dir: str, layers): ''' Add a layer layer to bblayers.conf, but our layer layer verification is done on the host, @@ -64,7 +64,7 @@ class BBLayers: bb_utils.edit_bblayers_conf(self.bblayers_dir, add=bblayers, remove=None) - def check_layer_exist(self, layers: str | list): + def check_layer_exist(self, layers): ''' To check if it is legitimate to add a layer, the main thing is to verify the existence of layer.conf diff --git a/src/oebuild/docker_proxy.py b/src/oebuild/docker_proxy.py index ddd7f1e..175f8a5 100644 --- a/src/oebuild/docker_proxy.py +++ b/src/oebuild/docker_proxy.py @@ -15,6 +15,7 @@ from io import BytesIO import tarfile import subprocess import sys +from typing import List import docker from docker.errors import ImageNotFound, NotFound @@ -184,7 +185,7 @@ class DockerProxy: return res is None def container_exec_command(self, container: Container, - command: str | list, + command, user: str = '', params=None): ''' @@ -209,7 +210,7 @@ class DockerProxy: def create_container(self, image: str, parameters: str, - volumes: list[str], + volumes: List[str], command: str) -> Container: ''' create a new container diff --git a/src/oebuild/parse_compile.py b/src/oebuild/parse_compile.py index ede03d2..44f7cd5 100644 --- a/src/oebuild/parse_compile.py +++ b/src/oebuild/parse_compile.py @@ -13,7 +13,7 @@ See the Mulan PSL v2 for more details. import os from dataclasses import dataclass import pathlib -from typing import Optional +from typing import Optional, List import sys import oebuild.util as oebuild_util @@ -33,7 +33,7 @@ class DockerParam: # point out the parameter for create container parameters: str # point out the volumns for create container - volumns: list[str] + volumns: List[str] # point out the command for create container command: str -- Gitee