mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
Add a script for install a pip wheel from a presigned url
This commit is contained in:
parent
9777639a1c
commit
c1a82ea8cd
5 changed files with 68 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
include requirements.txt
|
include requirements.txt
|
||||||
include llama_toolchain/data/*.yaml
|
include llama_toolchain/data/*.yaml
|
||||||
include llama_toolchain/distribution/*.sh
|
include llama_toolchain/distribution/*.sh
|
||||||
|
include llama_toolchain/cli/scripts/*.sh
|
||||||
|
|
5
llama_toolchain/cli/scripts/__init__.py
Normal file
5
llama_toolchain/cli/scripts/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
|
# the root directory of this source tree.
|
38
llama_toolchain/cli/scripts/install-wheel-from-presigned.sh
Executable file
38
llama_toolchain/cli/scripts/install-wheel-from-presigned.sh
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Please provide a URL as an argument."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
URL=$1
|
||||||
|
|
||||||
|
HEADERS_FILE=$(mktemp)
|
||||||
|
curl -s -I "$URL" >"$HEADERS_FILE"
|
||||||
|
FILENAME=$(grep -i "x-manifold-obj-canonicalpath:" "$HEADERS_FILE" | sed -E 's/.*nodes\/[^\/]+\/(.+)/\1/' | tr -d "\r\n")
|
||||||
|
|
||||||
|
if [ -z "$FILENAME" ]; then
|
||||||
|
echo "Could not find the x-manifold-obj-canonicalpath header."
|
||||||
|
echo "HEADERS_FILE contents: "
|
||||||
|
cat "$HEADERS_FILE"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Downloading $FILENAME..."
|
||||||
|
|
||||||
|
curl -s -L -o "$FILENAME" "$URL"
|
||||||
|
|
||||||
|
echo "Installing $FILENAME..."
|
||||||
|
pip install "$FILENAME"
|
||||||
|
echo "Successfully installed $FILENAME"
|
||||||
|
|
||||||
|
rm -f "$FILENAME"
|
18
llama_toolchain/cli/scripts/run.py
Normal file
18
llama_toolchain/cli/scripts/run.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def install_wheel_from_presigned():
|
||||||
|
file = "install-wheel-from-presigned.sh"
|
||||||
|
script_path = os.path.join(os.path.dirname(__file__), file)
|
||||||
|
try:
|
||||||
|
subprocess.run(["sh", script_path] + sys.argv[1:], check=True)
|
||||||
|
except Exception:
|
||||||
|
sys.exit(1)
|
7
setup.py
7
setup.py
|
@ -20,7 +20,12 @@ setup(
|
||||||
author="Meta Llama",
|
author="Meta Llama",
|
||||||
author_email="llama-oss@meta.com",
|
author_email="llama-oss@meta.com",
|
||||||
description="Llama toolchain",
|
description="Llama toolchain",
|
||||||
entry_points={"console_scripts": ["llama = llama_toolchain.cli.llama:main"]},
|
entry_points={
|
||||||
|
"console_scripts": [
|
||||||
|
"llama = llama_toolchain.cli.llama:main",
|
||||||
|
"install-wheel-from-presigned = llama_toolchain.cli.scripts.run:install_wheel_from_presigned",
|
||||||
|
]
|
||||||
|
},
|
||||||
long_description=open("README.md").read(),
|
long_description=open("README.md").read(),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
url="https://github.com/meta-llama/llama-toolchain",
|
url="https://github.com/meta-llama/llama-toolchain",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue