Creating python package, scripts/entry_points does not exist or is not executable


#1

I am trying to create a python package following the guide my setup.py file looks like this

#!/usr/bin/env python

from distutils.core import setup

setup(name='TermCheat',
      version='0.1.4',
      description='Collect and find termial commands.',
      author='@select@github.com',
      author_email='falko@webpgr.com',
      url='https://github.com/select/term-cheat',
      packages=['termcheat', 'bin'],
      package_data={'termcheat': ['*.yaml']},
      entry_points={
          'console_scripts': ['term-cheat-app1=termcheat:run']
      },
      scripts=["bin/term-cheat-app"],
      install_requires=['urwid', 'fuzzywuzzy', 'pyyaml', 'appdirs', 'python-Levenshtein']
      )

and my snapcraft.yaml looks like this

name: term-cheat
version: git
summary: Collect and find termial commands.
description: |
  TermCheat is a searchable library of commands that you can copy remix and extend.
grade: devel
confinement: classic
base: core18
parts:
  term-cheat:
    plugin: python
    python-version: python3
    source: .
    source-type: git
apps:
  term-cheat:
    command: bin/term-cheat-app

I have tried all combinations of using either script or entry_points but nothing works I always get

Failed to generate snap metadata: The specified command ‘bin/term-cheat-app’ defined in the app {‘command’: ‘bin/term-cheat-app’} does not exist or is not executable.
Ensure that ‘bin/term-cheat-app’ is relative to the prime directory.

If it helps the whole project can be fund at https://github.com/select/term-cheat

In addition when I try the example https://snapcraft.io/first-snap/python/linux/build I get the following error

The linker version ‘2.23’ used by the base ‘core’ is incompatible with files in this snap:
/home/select/Dev/offlineimap/prime/lib/x86_64-linux-gnu/libexpat.so.1.6.8 (2.25)
/home/select/Dev/offlineimap/prime/usr/bin/python2.7 (2.28)
/home/select/Dev/offlineimap/prime/usr/lib/python2.7/lib-dynload/ossaudiodev.x86_64-linux-gnu.so (2.28)
/home/select/Dev/offlineimap/prime/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (2.25)
/home/select/Dev/offlineimap/prime/usr/lib/x86_64-linux-gnu/libexpatw.so.1.6.8 (2.25)

I also tried snapcraft clear but the error above presits.


#2

I made it work by adding a start script to my application (./bin/term-cheat-app) and then copying it with the snapcraft dump plugin

parts:
  term-cheat:
    plugin: python
    ...
  python-wrapper:
    plugin: dump
    source: bin
    stage:
      - term-cheat-app
    prime:
      - term-cheat-app 

The entry_points and scripts entry in the setup.py were ignored, or I have no idea where the resulting scripts would be found