Skip to content

Help needed for manual build of new plugin #822

@thesefer

Description

@thesefer

hi there

i am trying to build a new notification script based on and reusing your quality examples and libraries. Unfortunately it seems I am still missing something because I cannot properly execute the binaries if the shared object is not in the same folder as the compiled binary. I oriented myself using the workflow action and build folder. I never packaged with pyinstaller / nuitka before to be honest.

I cannot find information about build instructions (even within the existing *.py's here) for the "_internal" directory nor instructions for nuitka in this regards.

Your help would be very much appreciated!

./notify-service-sms  
Traceback (most recent call last):
  File "/data/home/admin/git/services/python-teltonika-sms/build_20.04/notify-service-sms", line 12, in <module>
  File "/data/home/admin/git/services/python-teltonika-sms/build_20.04/lib/url.py", line 19, in <module lib.url>
  File "/data/home/admin/git/services/python-teltonika-sms/build_20.04/ssl.py", line 98, in <module>
ImportError: /data/home/admin/git/services/python-teltonika-sms/build_20.04/_ssl.so: cannot open shared object file: No such file or directory

command: docker run --name python-nuitka --rm -it -v $PWD:/python-teltonika-sms -w /python-teltonika-sms python-nuitka:20.04 /bin/bash -x /python-teltonika-sms/build.sh

filelist:

_bz2.so
_codecs_cn.so
_codecs_hk.so
_codecs_iso2022.so
_codecs_jp.so
_codecs_kr.so
_codecs_tw.so
_hashlib.so
libbz2.so.1.0
libcrypto.so.1.1
libexpat.so.1
liblzma.so.5
libssl.so.1.1
_lzma.so
_multibytecodec.so
_ssl.so
termios.so

build.sh (not optimized)

#!/usr/bin/env bash

set -e

source /opt/venv/bin/activate
python3 --version

BUILD_FOLDER="build_$(. /etc/os-release ; echo $VERSION_ID)"
mkdir -p $BUILD_FOLDER/_internal
cd python

python3 -m nuitka \
    --assume-yes-for-downloads \
    --output-dir=/tmp/nuitka/onedir \
    --remove-output \
    --standalone \
    notify-host-sms
mv /tmp/nuitka/onedir/notify-host-sms.dist/notify-host-sms.bin ../$BUILD_FOLDER/notify-host-sms

python3 -m nuitka \
    --assume-yes-for-downloads \
    --output-dir=/tmp/nuitka/onedir \
    --remove-output \
    --standalone \
    notify-service-sms
mv /tmp/nuitka/onedir/notify-service-sms.dist/notify-service-sms.bin ../$BUILD_FOLDER/notify-service-sms

\cp --archive --no-clobber /tmp/nuitka/onedir/*.dist/* ../$BUILD_FOLDER/_internal

Since I do not want to package it, I am using a trimmed down Dockerfile

FROM docker/ubuntu:20.04

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y git python3-venv python3-pip patchelf ccache && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN python3 -m venv --system-site-packages /opt/venv && \
    /opt/venv/bin/python -m pip install pip==25.0 wheel==0.45.1 setuptools==50.3.2 && \
    /opt/venv/bin/python -m pip install nuitka==2.6

# Verify Python installation
RUN python3 --version && \
    /opt/venv/bin/python -m pip list

Imports of notify-*-sms

import argparse                        # pylint: disable=C0413
import sys                             # pylint: disable=C0413
import textwrap                        # pylint: disable=C0413

import lib.args                       # pylint: disable=C0413
import lib.base                       # pylint: disable=C0413
import lib.url                        # pylint: disable=C0413
from lib.globals import STATE_UNKNOWN # pylint: disable=C0413

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions