kopia lustrzana https://github.com/OpenDroneMap/ODM
refactor: update install scripts to use uv
rodzic
d9e6e26c1d
commit
a1c461c8d0
13
configure.py
13
configure.py
|
|
@ -14,8 +14,6 @@ import urllib.request
|
|||
import shutil
|
||||
import zipfile
|
||||
|
||||
from venv import EnvBuilder
|
||||
|
||||
parser = argparse.ArgumentParser(description='ODM Windows Configure Script')
|
||||
parser.add_argument('action',
|
||||
type=str,
|
||||
|
|
@ -62,15 +60,8 @@ def vcpkg_requirements():
|
|||
return pckgs
|
||||
|
||||
def build():
|
||||
# Create python virtual env
|
||||
if not os.path.isdir("venv"):
|
||||
print("Creating virtual env --> venv/")
|
||||
ebuilder = EnvBuilder(with_pip=True)
|
||||
ebuilder.create("venv")
|
||||
run("uv sync")
|
||||
|
||||
run("pip install setuptools")
|
||||
run("venv\\Scripts\\pip install --ignore-installed -r requirements.txt")
|
||||
|
||||
# Download / build VCPKG environment
|
||||
if not os.path.isdir("vcpkg"):
|
||||
if args.build_vcpkg:
|
||||
|
|
@ -129,7 +120,7 @@ def safe_remove(path):
|
|||
def clean():
|
||||
safe_remove("vcpkg-download.zip")
|
||||
safe_remove("vcpkg")
|
||||
safe_remove("venv")
|
||||
safe_remove(".venv")
|
||||
safe_remove(os.path.join("SuperBuild", "build"))
|
||||
safe_remove(os.path.join("SuperBuild", "download"))
|
||||
safe_remove(os.path.join("SuperBuild", "src"))
|
||||
|
|
|
|||
44
configure.sh
44
configure.sh
|
|
@ -51,6 +51,11 @@ ensure_prereqs() {
|
|||
sudo $APT_GET install -y -qq --no-install-recommends pkg-config
|
||||
fi
|
||||
|
||||
if ! command -v curl &> /dev/null; then
|
||||
echo "Installing curl"
|
||||
sudo $APT_GET install -y -qq --no-install-recommends curl
|
||||
fi
|
||||
|
||||
echo "Installing tzdata"
|
||||
sudo $APT_GET install -y -qq tzdata
|
||||
|
||||
|
|
@ -62,14 +67,11 @@ ensure_prereqs() {
|
|||
sudo $APT_GET update
|
||||
fi
|
||||
|
||||
echo "Installing Python PIP"
|
||||
sudo $APT_GET install -y -qq --no-install-recommends \
|
||||
python3-pip \
|
||||
python3-setuptools \
|
||||
python3-venv
|
||||
python3 -m venv venv --system-site-packages
|
||||
venv/bin/pip3 install -U pip
|
||||
venv/bin/pip3 install -U shyaml
|
||||
echo "Installing Python UV"
|
||||
curl -LsSf https://astral.sh/uv/0.9.5/install.sh | sh
|
||||
|
||||
echo "Syncing Python dependencies"
|
||||
uv sync
|
||||
}
|
||||
|
||||
# Save all dependencies in snapcraft.yaml to maintain a single source of truth.
|
||||
|
|
@ -82,17 +84,18 @@ installdepsfromsnapcraft() {
|
|||
*) key=build-packages; ;; # shouldn't be needed, but it's here just in case
|
||||
esac
|
||||
|
||||
UBUNTU_VERSION=$(lsb_release -r)
|
||||
SNAPCRAFT_FILE="snapcraft.yaml"
|
||||
if [[ "$UBUNTU_VERSION" == *"21.04"* ]]; then
|
||||
SNAPCRAFT_FILE="snapcraft21.yaml"
|
||||
elif [[ "$UBUNTU_VERSION" == *"24.04"* ]]; then
|
||||
SNAPCRAFT_FILE="snapcraft24.yaml"
|
||||
fi
|
||||
echo "Installing dependencies from snap/$SNAPCRAFT_FILE ($section.$key)"
|
||||
|
||||
cat snap/$SNAPCRAFT_FILE | \
|
||||
venv/bin/shyaml get-values-0 parts.$section.$key | \
|
||||
xargs -0 sudo $APT_GET install -y -qq --no-install-recommends
|
||||
uv run python - "$section" "$key" "snap/$SNAPCRAFT_FILE" <<'PYCODE' | \
|
||||
xargs sudo $APT_GET install -y -qq --no-install-recommends
|
||||
import sys, yaml
|
||||
|
||||
section, key, snapfile = sys.argv[1:]
|
||||
with open(snapfile, 'r') as f:
|
||||
data = yaml.safe_load(f)
|
||||
for pkg in data.get('parts', {}).get(section, {}).get(key, []):
|
||||
print(pkg)
|
||||
PYCODE
|
||||
}
|
||||
|
||||
installruntimedepsonly() {
|
||||
|
|
@ -133,10 +136,7 @@ installreqs() {
|
|||
set -e
|
||||
|
||||
# edt requires numpy to build
|
||||
venv/bin/pip install numpy==2.3.2
|
||||
venv/bin/pip install -r requirements.txt --ignore-installed
|
||||
#if [ ! -z "$GPU_INSTALL" ]; then
|
||||
#fi
|
||||
uv pip install numpy==2.3.2
|
||||
set +e
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,17 +34,10 @@ ensure_prereqs() {
|
|||
installreqs() {
|
||||
ensure_prereqs
|
||||
|
||||
brew install cmake gcc@12 python@3.12 tbb@2020 eigen gdal boost cgal libomp
|
||||
brew install cmake gcc@12 python@3.12 tbb@2020 eigen gdal boost cgal libomp uv
|
||||
brew link tbb@2020
|
||||
|
||||
python3.12 -m pip install virtualenv
|
||||
|
||||
if [ ! -e ${RUNPATH}/venv ]; then
|
||||
python3.12 -m virtualenv venv
|
||||
fi
|
||||
|
||||
source venv/bin/activate
|
||||
pip install --ignore-installed -r requirements.txt
|
||||
uv sync
|
||||
}
|
||||
|
||||
install() {
|
||||
|
|
@ -55,18 +48,19 @@ install() {
|
|||
mkdir -p build && cd build
|
||||
cmake .. && make -j$processes
|
||||
|
||||
cd /tmp
|
||||
pip download GDAL==3.11.1
|
||||
tar -xpzf GDAL-3.11.1.tar.gz
|
||||
cd GDAL-3.11.1
|
||||
if [ -e /opt/homebrew/bin/gdal-config ]; then
|
||||
python setup.py build_ext --gdal-config /opt/homebrew/bin/gdal-config
|
||||
else
|
||||
python setup.py build_ext --gdal-config /usr/local/bin/gdal-config
|
||||
fi
|
||||
python setup.py build
|
||||
python setup.py install
|
||||
rm -fr /tmp/GDAL-3.11.1 /tmp/GDAL-3.11.1.tar.gz
|
||||
# TODO check if we actually need this, when using uv / Mac?
|
||||
# cd /tmp
|
||||
# pip download GDAL==3.11.1
|
||||
# tar -xpzf GDAL-3.11.1.tar.gz
|
||||
# cd GDAL-3.11.1
|
||||
# if [ -e /opt/homebrew/bin/gdal-config ]; then
|
||||
# python setup.py build_ext --gdal-config /opt/homebrew/bin/gdal-config
|
||||
# else
|
||||
# python setup.py build_ext --gdal-config /usr/local/bin/gdal-config
|
||||
# fi
|
||||
# python setup.py build
|
||||
# python setup.py install
|
||||
# rm -fr /tmp/GDAL-3.11.1 /tmp/GDAL-3.11.1.tar.gz
|
||||
|
||||
cd ${RUNPATH}
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue