mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
Switch to use importlib instead of deprecated pkg_resources (#678)
`pkg_resources` has been deprecated. This PR switches to use `importlib.resources`. --------- Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
This commit is contained in:
parent
747683a8a2
commit
9ec54dcbe7
5 changed files with 43 additions and 45 deletions
|
@ -4,13 +4,13 @@
|
|||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
import importlib.resources
|
||||
import logging
|
||||
from enum import Enum
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
|
||||
import pkg_resources
|
||||
from pydantic import BaseModel
|
||||
from termcolor import cprint
|
||||
|
||||
|
@ -111,8 +111,8 @@ def build_image(build_config: BuildConfig, build_file_path: Path):
|
|||
normal_deps += SERVER_DEPENDENCIES
|
||||
|
||||
if build_config.image_type == ImageType.docker.value:
|
||||
script = pkg_resources.resource_filename(
|
||||
"llama_stack", "distribution/build_container.sh"
|
||||
script = (
|
||||
importlib.resources.files("llama_stack") / "distribution/build_container.sh"
|
||||
)
|
||||
args = [
|
||||
script,
|
||||
|
@ -123,8 +123,8 @@ def build_image(build_config: BuildConfig, build_file_path: Path):
|
|||
" ".join(normal_deps),
|
||||
]
|
||||
elif build_config.image_type == ImageType.conda.value:
|
||||
script = pkg_resources.resource_filename(
|
||||
"llama_stack", "distribution/build_conda_env.sh"
|
||||
script = (
|
||||
importlib.resources.files("llama_stack") / "distribution/build_conda_env.sh"
|
||||
)
|
||||
args = [
|
||||
script,
|
||||
|
@ -133,9 +133,7 @@ def build_image(build_config: BuildConfig, build_file_path: Path):
|
|||
" ".join(normal_deps),
|
||||
]
|
||||
elif build_config.image_type == ImageType.venv.value:
|
||||
script = pkg_resources.resource_filename(
|
||||
"llama_stack", "distribution/build_venv.sh"
|
||||
)
|
||||
script = importlib.resources.files("llama_stack") / "distribution/build_venv.sh"
|
||||
args = [
|
||||
script,
|
||||
build_config.name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue