Skip to content

Commit

Permalink
fixes yoctopuce and snap7 lib installation in Linux builds
Browse files Browse the repository at this point in the history
  • Loading branch information
MAKOMO committed Oct 24, 2023
1 parent 5e01353 commit f345c5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 33 deletions.
3 changes: 0 additions & 3 deletions .ci/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ gem install fpm -v 1.12.0 # Linux build fails using 1.13.0
pip install --upgrade pip
pip install -r src/requirements.txt | sed '/^Ignoring/d'

# copy the snap7 binary installed by pip
sudo cp -f ${PYTHONSITEPKGS}/snap7/lib/libsnap7.so /usr/lib

.ci/install-libusb.sh

# show set of libraries are installed
Expand Down
33 changes: 11 additions & 22 deletions src/artisan-linux.spec
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# -*- mode: python -*-

import os
from PyInstaller.utils.hooks import get_package_paths

block_cipher = None

additionalLibs = []
#additionalLibs.append( ("libGL.so.1", "/usr/lib64/libGL.so.1", 'BINARY') )

import os
# add snap7 libs
BINARIES = [(os.path.join(get_package_paths('snap7')[1], 'lib/libsnap7.so'), 'snap7/lib' )]
# add yocto libs
yocto_lib_path = os.path.join(get_package_paths('yoctopuce')[1], 'cdll')
BINARIES.extend([(os.path.join(yocto_lib_path, fn),'yoctopuce/cdll') for fn in os.listdir(yocto_lib_path) if fn.endswith('.so')])

path=os.environ['HOME'] + '/artisan-master/src'
if not os.path.isdir(path):
Expand All @@ -16,43 +20,28 @@ if not os.path.isdir(path):

a = Analysis(['artisan.py'],
pathex=[path],
binaries=[],
binaries=BINARIES,
datas=[],
hiddenimports=['charset_normalizer.md__mypyc', # part of requests 2.28.2 # see https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/534
'scipy.spatial.transform._rotation_groups',
'scipy._lib.messagestream',
'scipy.special.cython_special',
'matplotlib.backends.backend_pdf',
'matplotlib.backends.backend_svg',
'pkg_resources.py2_warn'
],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)

# Remove pyi_rth_mplconfig.py useless because it makes our startup slow.
# This hook only applies to one-file distributions.
for s in a.scripts:
if s[0] == 'pyi_rth_mplconfig':
a.scripts.remove(s)
break

pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
exclude_binaries=True, # should be True for onedir
name='artisan',
debug=False,
strip=False,
upx=True,
console=True )

coll = COLLECT(exe,
a.binaries + additionalLibs,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
Expand Down
8 changes: 0 additions & 8 deletions src/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ mkdir dist/Icons
find includes/Icons -name '.*.aset' -exec rm -r {} \;
cp -R includes/Icons/* dist/Icons

mkdir dist/_internal/yoctopuce
mkdir dist/_internal/yoctopuce/cdll
cp ${PYTHONSITEPKGS}/yoctopuce/cdll/*64.so dist/_internal/yoctopuce/cdll

#cp /usr/lib/libsnap7.so dist
cp ${PYTHONSITEPKGS}/snap7/lib/libsnap7.so dist/_internal


# remove automatically collected PyQt6 libs that are not used to save space
# with pyinstaller 6.0 it seems not to needed any longer to remove unused Qt libs:
#keep_qt_modules="libQt6Core libQt6Gui libQt6Widgets libQt6Svg libQt6PrintSupport
Expand Down

0 comments on commit f345c5f

Please sign in to comment.