Skip to content

Commit 40c4318

Browse files
committed
linux: Switch from pyinstaller root image to one built off manylinux
Can't use the vanilla manylinux images because CPython isn't built as shared. koordinates2/manylinux2014-pyshared images are a minor tweak. See pypa/manylinux#1185 for details. After that just install PyInstaller into the image before running. Manylinux2014-derived libraries use libxcrypt to provide libcrypt.so.2, but that doesn't seem to end up bundled. Do it manually. Probably goes away with a newer PyInstaller.
1 parent a676470 commit 40c4318

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

kart.spec

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ pyi_analysis = Analysis(
118118
noarchive=False,
119119
)
120120

121-
# Git
122121
if is_win:
123122
pyi_analysis.datas += Tree('vendor/dist/git', prefix='git')
124123
# GDAL/osgeo hook doesn't include Proj
@@ -131,6 +130,9 @@ else:
131130
libexec_root = 'vendor/dist/env/libexec'
132131
pyi_analysis.datas += Tree('vendor/dist/env/share', prefix='share')
133132

133+
if is_linux:
134+
pyi_analysis.binaries += [('libcrypt.so.2', '/usr/local/lib/libcrypt.so.2', 'BINARY')]
135+
134136
pyi_pyz = PYZ(pyi_analysis.pure, pyi_analysis.zipped_data, cipher=None)
135137

136138
if is_win:

platforms/Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ pyapp-Linux: $(SRC)/vendor/dist/vendor-Linux.tar.gz
5757
-v "$(SRC):/src" \
5858
-w /src \
5959
-v "$(abspath linux/.cache):/root/.cache" \
60-
--entrypoint "/bin/bash" \
61-
cdrx/pyinstaller-linux \
62-
-i -c '/src/platforms/linux/pyinstaller.sh $(if $(MANYLINUX_DEBUG),|| bash)'
60+
koordinates2/manylinux2014-pyshared:x86_64 \
61+
bash -c '/src/platforms/linux/pyinstaller.sh $(if $(MANYLINUX_DEBUG),|| bash)'
6362

6463
$(pyapp-Darwin):
6564
$(MAKE) pyapp-Darwin

platforms/linux/pyinstaller.sh

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
#!/bin/bash
2-
set -ex
2+
set -e
33

44
source /root/.bashrc
55

6-
PYENV_PREFIX=$(pyenv prefix)
6+
set -xu
7+
8+
export PATH=/opt/python/cp37-cp37m-shared/bin:${PATH}
9+
10+
python3 --version
11+
python3 -m venv /venv
12+
13+
export PATH=/venv/bin:${PATH}
714

815
{ echo ">> Configuring vendor dependencies..."; } 2> /dev/null
916
tar xvzf vendor/dist/vendor-Linux.tar.gz -C /tmp wheelhouse
1017
rm -rf vendor/dist/env/
1118
tar xzf vendor/dist/vendor-Linux.tar.gz -C vendor/dist/ env
12-
tar xzf vendor/dist/vendor-Linux.tar.gz -C "$PYENV_PREFIX" --strip-components=1 env/lib/
19+
tar xzf vendor/dist/vendor-Linux.tar.gz -C /venv --strip-components=1 env/lib/
1320

1421
# get the Rtree installer working successfully
15-
export SPATIALINDEX_C_LIBRARY="$PYENV_PREFIX/lib/libspatialindex_c.so"
22+
export SPATIALINDEX_C_LIBRARY="/venv/lib/libspatialindex_c.so"
1623

1724
pip install --no-deps --ignore-installed -r requirements.txt
1825
pip install --no-deps \
@@ -21,10 +28,10 @@ pip install --no-deps \
2128
{ echo ">> Downgrading PyInstaller (https://github.com/pyinstaller/pyinstaller/issues/4674) ..."; } 2> /dev/null
2229
pip install "pyinstaller==3.5.*"
2330

24-
python setup.py install
31+
python3 setup.py install
2532

2633
{ echo ">> Pre-bundle Smoke Test ..."; } 2> /dev/null
27-
pyenv exec kart --version
34+
kart --version
2835

2936
{ echo ">> Running PyInstaller ..."; } 2> /dev/null
3037
pyinstaller \

0 commit comments

Comments
 (0)