Skip to content

Commit 5362e70

Browse files
Update package.sh
1 parent 60c97cc commit 5362e70

File tree

1 file changed

+249
-7
lines changed

1 file changed

+249
-7
lines changed

package.sh

Lines changed: 249 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,270 @@
1-
#!/bin/bash -e
1+
#!/bin/bash
22

3+
#-e
4+
set -x # echo commands too
35

6+
echo ""
7+
echo ""
8+
echo "package.sh: PLATFORM:"
9+
uname -a
10+
#lsb_release -a
11+
#ldd --version
12+
#echo "python before:"
13+
#python3 --version
14+
#pip3 --version
15+
echo ""
16+
echo ""
417
version=$(grep '"version"' manifest.json | cut -d: -f2 | cut -d\" -f2)
518

19+
echo "."
20+
echo ".."
21+
echo "RUN"
22+
#uname -a
23+
echo
24+
pwd
25+
echo
26+
ls
27+
echo
28+
ls /
29+
30+
export DEBIAN_FRONTEND=noninteractive
31+
32+
apt update
33+
apt install software-properties-common -y
34+
add-apt-repository universe -y
35+
add-apt-repository 'ppa:deadsnakes/ppa' -y
36+
apt update
37+
echo ""
38+
39+
apt install -y -v \
40+
python3.11 \
41+
python3-pip \
42+
python3-dbus \
43+
python3-wheel \
44+
python3.11-dev \
45+
libpython3.11-dev
46+
47+
echo "Python3 version after install:"
48+
python3 --version
49+
ls /usr/bin/python*
50+
51+
update-alternatives --install /usr/bin/python python /usr/bin/python3.11 2
52+
53+
54+
apt install -y python3-distutils-extra
55+
apt-get update -q
56+
apt install -y gcc-aarch64-linux-gnu libgirepository1.0-dev
57+
echo "."
58+
echo ".."
59+
echo "..."
60+
echo "Installing lots of stuff"
61+
62+
63+
apt install -y \
64+
wget \
65+
autoconf \
66+
automake \
67+
build-essential \
68+
ca-certificates \
69+
curl \
70+
git \
71+
libbz2-dev \
72+
libc6-dev \
73+
libffi-dev \
74+
libgdbm-dev \
75+
libjpeg-dev \
76+
libgirepository1.0-dev \
77+
libglib2.0-dev \
78+
libjpeg-dev \
79+
liblzma-dev \
80+
libncurses5-dev \
81+
libncursesw5-dev \
82+
libreadline-dev \
83+
libsqlite3-dev \
84+
libssl-dev \
85+
libudev-dev \
86+
pkg-config \
87+
zlib1g-dev \
88+
libjpeg-dev \
89+
libpango1.0-dev \
90+
libgif-dev \
91+
software-properties-common \
92+
sudo \
93+
openssl
94+
95+
96+
echo ""
97+
echo "."
98+
99+
echo "Attempting Phthon 3.11 dev modules"
100+
apt install -y pkg-config python3.11-dev libpython3.11-dev
101+
102+
#echo "Attempting libcairo install"
103+
#apt install -y libcairo2-dev
104+
105+
106+
107+
108+
#set -x
109+
6110
# Setup environment for building inside Dockerized toolchain
7111
[ $(id -u) = 0 ] && umask 0
8112

113+
#apt install libcairo2-dev pkg-config python3-dev
114+
9115
# Clean up from previous releases
10-
echo "removing old files"
116+
echo "package.sh: removing old files"
11117
rm -rf *.tgz *.sha256sum package SHA256SUMS lib
12118

13119
if [ -z "${ADDON_ARCH}" ]; then
14120
TARFILE_SUFFIX=
15121
else
16-
PYTHON_VERSION="$(python3 --version 2>&1 | cut -d' ' -f2 | cut -d. -f 1-2)"
122+
#PYTHON_VERSION="$(python3 --version 2>&1 | cut -d' ' -f2 | cut -d. -f 1-2)"
123+
PYTHON_VERSION="3.11"
17124
TARFILE_SUFFIX="-${ADDON_ARCH}-v${PYTHON_VERSION}"
18125
fi
19126

127+
echo ""
128+
echo "TARFILE_SUFFIX: $TARFILE_SUFFIX"
129+
echo ""
130+
131+
132+
#echo ""
133+
#echo "GLIBC VERSION AFTER UPDATE:"
134+
#ldd --version
135+
136+
#apt install build-essential libpython3-dev libdbus-1-dev
137+
20138

139+
# g++ -
140+
#sudo apt-get install cairo pkgconf gobject-introspection gtk3 \
141+
#libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++ \
142+
#libgirepository1.0-dev -y
143+
# Not sure is libjpeg-dev is the correct one
144+
145+
#echo "installing rust compiler"
146+
#curl https://sh.rustup.rs -sSf | sh -s -- -y
147+
148+
#exit 0
149+
#echo "I SHOULD NOT BE SEEN"
21150

22151
# Prep new package
23-
echo "creating package"
152+
echo "package.sh: creating package"
24153
mkdir -p lib package
25154

155+
#PY11="no"
156+
#python3.11 --version && PY11="yes"
157+
158+
#PIPPY="pip3"
159+
#python3.11 --version && PIPPY="python3.11 -m pip"
160+
#echo "PIP STRING: $PIPPY"
161+
162+
# Is upgrading pip needed?
163+
# "$PIPPY" install --upgrade pip
164+
26165
# Pull down Python dependencies
27-
pip3 install -r requirements.txt -t lib --no-binary :all: --prefix ""
166+
167+
168+
#wget https://github.com/home-assistant-libs/chip-wheels/releases/download/2022.12.0/home_assistant_chip_core-2022.12.0-cp37-abi3-manylinux_2_31_aarch64.whl
169+
#pip3 install home_assistant_chip_core-2022.12.0-cp37-abi3-manylinux_2_31_aarch64.whl -t lib --prefix ""
170+
171+
#wget https://github.com/home-assistant-libs/chip-wheels/releases/download/2022.12.0/home_assistant_chip_repl-2022.12.0-py3-none-any.whl
172+
#pip3 install home_assistant_chip_repl-2022.12.0-py3-none-any.whl -t lib --prefix ""
173+
174+
#wget https://github.com/home-assistant-libs/chip-wheels/releases/download/2022.12.0/home_assistant_chip_clusters-2022.12.0-py3-none-any.whl
175+
#pip3 install home_assistant_chip_clusters-2022.12.0-py3-none-any.whl -t lib --prefix ""
176+
177+
178+
#pip3 install aiohttp -t lib --no-binary :all: --prefix ""
179+
#pip3 install aiorun -t lib --no-binary :all: --prefix ""
180+
#pip3 install python-matter-server[server] -t lib --prefix ""
181+
182+
#wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl -O home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl
183+
184+
185+
#wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_repl-2023.1.0-py3-none-any.whl -O home_assistant_chip_repl-2023.1.0-py3-none-any.whl
186+
#wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_clusters-2023.1.0-py3-none-any.whl -O home_assistant_chip_clusters-2023.1.0-py3-none-any.whl
187+
188+
# doesn't seem to work
189+
# $PIPPY install -r requirements.txt -t lib --no-cache-dir --no-binary :all: --prefix ""
190+
191+
#if [ "$PY11" = "yes" ]; then
192+
# python3.11 -m pip install home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl -t lib --prefix ""
193+
# python3.11 -m pip install home_assistant_chip_repl-2023.1.0-py3-none-any.whl -t lib --prefix ""
194+
# python3.11 -m pip install home_assistant_chip_clusters-2023.1.0-py3-none-any.whl -t lib --prefix ""
195+
#
196+
# python3.11 -m pip install python-matter-server[server] -t lib --prefix ""
197+
# python3.11 -m pip install aiorun -t lib --prefix ""
198+
#else
199+
# pip3 install home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl -t lib --prefix ""
200+
# pip3 install home_assistant_chip_repl-2023.1.0-py3-none-any.whl -t lib --prefix ""
201+
# pip3 install home_assistant_chip_clusters-2023.1.0-py3-none-any.whl -t lib --prefix ""
202+
203+
# pip3 install python-matter-server[server] -t lib --prefix ""
204+
# pip3 install aiorun -t lib --prefix ""
205+
#fi
206+
207+
set -e
208+
#echo ""
209+
#echo "downloading CHIP"
210+
#wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_clusters-2023.1.0-py3-none-any.whl -O home_assistant_chip_clusters-2023.1.0-py3-none-any.whl
211+
##wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl -O home_assistant_chip_core-2023.1.0-py3-none-any.whl # home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl
212+
##wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl -O home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_28_aarch64.whl
213+
#wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl -O home_assistant_chip_core-2023.1.0-cp37-abi3-manylinux_2_31_aarch64.whl
214+
#wget -c https://github.com/home-assistant-libs/chip-wheels/releases/download/2023.1.0/home_assistant_chip_repl-2023.1.0-py3-none-any.whl -O home_assistant_chip_repl-2023.1.0-py3-none-any.whl
215+
216+
echo ""
217+
echo "files:"
218+
ls
219+
220+
# Upgrade pip
221+
222+
223+
224+
echo ""
225+
echo "package.sh: PIP OPTIONS BEFORE:"
226+
#python3 -m ensurepip --upgrade
227+
#python3.11 -m ensurepip --upgrade
228+
#python3.11 -m pip debug --verbose
229+
echo ""
230+
231+
#echo "UPGRADING PIP"
232+
#python3 -m pip install --upgrade pip
233+
#python3 -m pip install --upgrade setuptools wheel
234+
235+
#python3.11 -m pip install --upgrade pip
236+
#python3.11 -m pip install --upgrade setuptools wheel
237+
238+
apt install -y python3.11-distutils
239+
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
240+
python3.11 -m pip install --upgrade setuptools==70.0.0 wheel
241+
242+
243+
echo ""
244+
echo ""
245+
echo ""
246+
echo ""
247+
echo "LS lib after first round of pip:"
248+
echo ""
249+
ls lib
250+
echo ""
251+
echo ""
252+
echo ""
253+
254+
255+
echo
256+
echo "PACKAGE.SH ALMOST THERE FOR PYTHON LIBS"
257+
258+
259+
260+
echo "LS lib after second round of pip:"
261+
ls lib
262+
263+
python3.11 -m pip install -r requirements.txt -t lib --no-cache-dir --no-binary :all: --prefix ""
264+
28265

29266
# Put package together
30-
cp -r lib pkg LICENSE manifest.json *.py README.md css js views images package/
267+
cp -r lib pkg LICENSE manifest.json *.py README.md css images js views package/
31268
find package -type f -name '*.pyc' -delete
32269
find package -type f -name '._*' -delete
33270
find package -type d -empty -delete
@@ -42,11 +279,16 @@ cd -
42279
# Make the tarball
43280
echo "creating archive"
44281
TARFILE="buttoninput-${version}${TARFILE_SUFFIX}.tgz"
45-
echo "TARFILE: $TARFILE"
46282
tar czf ${TARFILE} package
47283

48284
echo "creating shasums"
49285
shasum --algorithm 256 ${TARFILE} > ${TARFILE}.sha256sum
50286
cat ${TARFILE}.sha256sum
51287
#sha256sum ${TARFILE}
52288
#rm -rf SHA256SUMS package
289+
290+
echo ""
291+
echo "DONE! files:"
292+
ls -lh
293+
294+

0 commit comments

Comments
 (0)