Skip to content

Commit

Permalink
Merge pull request #43 from project-81/dev/pi5
Browse files Browse the repository at this point in the history
Fix some Python handling
  • Loading branch information
vkottler authored May 15, 2024
2 parents b4ab892 + 69d2902 commit e50c54a
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion config
16 changes: 10 additions & 6 deletions scripts/sh/install_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
sudo apt-get update && sudo apt-get upgrade -y

# micropython circuitpython
TASKS+=(git python rcmpy pkgconf lua neovim zsh ninja-src tio clang)
TASKS+=(locale git python rcmpy pkgconf lua neovim zsh ninja-src tio)

TASKS+=(picotool go fzf-src rust locale)
TASKS+=(picotool go fzf-src rust)

if is_rpi; then
run_install raspberrypi
fi

# build tools
PACKAGES+=(cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential)
PACKAGES+=(libstdc++-arm-none-eabi-newlib mold gcc-13 g++-13)
PACKAGES+=(libstdc++-arm-none-eabi-newlib mold)
if ! is_rpi; then
PACKAGES+=(gcc-13 g++-13)
fi

PACKAGES+=(emscripten)

# gnu
Expand All @@ -28,14 +32,14 @@ PACKAGES+=(gdb-multiarch lcov)
# utilities
PACKAGES+=(tmux ack htop mtools shellcheck tree xdg-utils)

# needed by tio
PACKAGES+=(libglib2.0-dev)

if is_wsl; then
PACKAGES+=(wslu)
fi

if ! is_rpi; then
# ubuntu seems to be required
TASKS+=(clang)

if ! is_wsl; then
# stuff for kicad
PACKAGES+=(libglu1-mesa-dev libgl1-mesa-dev libglew-dev)
Expand Down
13 changes: 11 additions & 2 deletions scripts/sh/install_locale.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[ "$LANG" ] || export LANG=en_US.UTF-8
export LANGUAGE=en_US
export LC_ALL=$LANGUAGE.UTF-8
export LANG=$LANGUAGE.UTF-8

# https://www.jaredwolff.com/raspberry-pi-setting-your-locale/
if is_rpi; then
sudo_cmd perl -pi -e \
's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
fi

sudo_cmd locale-gen "$LANG"
sudo update-locale
sudo_cmd update-locale
8 changes: 5 additions & 3 deletions scripts/sh/install_lua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ LUA_SLUG=$LUA_VER.$LUA_RELEASE
# export LUA_CPATH="?.so;$LUA_DIR/?.so"
# export LUA_PATH="?.$PROJECT;$LUA_DIR/?.$PROJECT"

if ! is_cmd $PROJECT; then
PKG_CONF_DIR=/usr/local/lib/pkgconfig

if [ ! -f $PKG_CONF_DIR/$LUA_VER.pc ]; then
safe_pushd "$THIRD_PARTY"

if [ ! -d $LUA_SLUG ]; then
Expand All @@ -32,6 +34,6 @@ if ! is_cmd $PROJECT; then
safe_popd

# Copy custom pkgconf file.
sudo_cmd mkdir -p /usr/local/lib/pkgconfig
sudo_cmd cp "$REPO/data/$LUA_VER.pc" /usr/local/lib/pkgconfig
sudo_cmd mkdir -p $PKG_CONF_DIR
sudo_cmd cp "$REPO/data/$LUA_VER.pc" $PKG_CONF_DIR
fi
7 changes: 6 additions & 1 deletion scripts/sh/install_pkgconf.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/bin/bash

PROJECT=pkgconf
VERSION=2.2.0

if is_ubuntu || is_rpi; then
sudo_cmd apt-get remove -y pkgconf pkg-config
fi

if ! is_cmd $PROJECT; then
clone_third_party_github $PROJECT $PROJECT

safe_pushd "$THIRD_PARTY/$PROJECT"

git checkout $PROJECT-2.2.0
git checkout $PROJECT-$VERSION

if [ ! -f configure ]; then
./autogen.sh
Expand Down
5 changes: 3 additions & 2 deletions scripts/sh/install_python-src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ elif is_debian || is_ubuntu; then
fi

# This is used for downloading pre-built releases.
[ "$PYTHON_FULL_VERSION" ] || export PYTHON_FULL_VERSION="$PYTHON_VERSION.4"
PYTHON_RELEASE=3
[ "$PYTHON_FULL_VERSION" ] || export PYTHON_FULL_VERSION="$PYTHON_VERSION.$PYTHON_RELEASE"

PYTHON_SRC_ARCHIVE="v$PYTHON_FULL_VERSION.tar.gz"
PYTHON_SRC="cpython-$PYTHON_FULL_VERSION"
Expand Down Expand Up @@ -75,7 +76,7 @@ sudo_cmd make altinstall
sudo_cmd ldconfig

# lists modules / prints missing
./python ./setup.py build -n
./python ./setup.py build -n || true

safe_popd

Expand Down
15 changes: 11 additions & 4 deletions scripts/sh/install_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ if ! is_cmd pip; then
fi
fi

if is_debian || is_ubuntu; then
install_package python3-venv "python$PYTHON_VERSION" "python$PYTHON_VERSION-venv"
else
# If we can't directly install Python, fallback on source building.
source_install_python() {
run_install_if_not "python$PYTHON_VERSION" python-src
}

if is_rpi; then
source_install_python
elif is_debian || is_ubuntu; then
install_package python3-venv \
"python$PYTHON_VERSION" \
"python$PYTHON_VERSION-venv"
else
source_install_python
fi

# Create a virtual environment.
Expand Down
3 changes: 3 additions & 0 deletions scripts/sh/install_tio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ meson --version
clone_third_party_github $PROJECT $PROJECT
safe_pushd "$THIRD_PARTY/$PROJECT"

install_package libglib2.0-dev
sudo_cmd ldconfig

meson setup --prefix "$INSTALL_PREFIX" build
meson compile -C build
meson install -C build
Expand Down

0 comments on commit e50c54a

Please sign in to comment.