I have the following snapcraft.yaml
file:
name: my-script
base: core18
version: '1.2.3'
summary: Summary
description: |
Description
grade: devel
confinement: devmode
parts:
my-script:
plugin: python
source: .
source-type: local
apps:
my-script:
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8
command: my-script
and it creates a snap
file without issues.
When I change core18
to core20
and build the snap again (after cleaning, etc.) I get an error regarding missing wheel
: error: invalid command 'bdist_wheel'
Building wheel for myscript (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /root/parts/my-script/install/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-d7198e7i/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-d7198e7i/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-xkthfry_
cwd: /tmp/pip-req-build-d7198e7i/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for myscript
Running setup.py clean for myscript
Building wheel for PyYAML (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /root/parts/my-script/install/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xe3r4j94/PyYAML/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xe3r4j94/PyYAML/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-5j1iig_x
cwd: /tmp/pip-install-xe3r4j94/PyYAML/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for PyYAML
Running setup.py clean for PyYAML
Failed to build myscript PyYAML
After changing the parts
in my snapcraft.yaml
file to:
parts:
my-script:
plugin: python
python-packages:
- pip
- setuptools
- wheel
source: .
source-type: local
the whole process runs OK, until the last step, where I get an error:
Staging my-script
Priming my-script
Failed to generate snap metadata: The specified command 'my-script' defined in the app 'my-script' is not executable.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
Hereβs my setup.py
file:
#!/usr/bin/env python
from setuptools import find_packages, setup
setup(
name='My Script',
version='1.2.3',
packages=find_packages('src'),
package_dir={'': 'src'},
entry_points={"console_scripts": [
"my-script = my_script.my_script:main"
]},
author='Me',
author_email='some@email.com',
description='Desc',
url='https://example.org',
project_urls={
"Source Code": 'https://example.org',
},
install_requires=[
'PyYAML==5.3.1',
'pyxdg==0.26'
]
)
I have the following directory structure:
.
βββ README.md
βββ requirements-dev.txt
βββ requirements.txt
βββ setup.py
βββ snap
β βββ snapcraft.yaml
βββ src
βββ my_script
βββ my_script.py
βββ __init__.py
βββ __version__.py
What should I change for snapping to work on core20
? It works fine on core18
.
Tested on:
$ which snapcraft
/snap/bin/snapcraft
$ which multipass
/snap/bin/multipass
$ snapcraft --version
snapcraft, version 4.0.2+git12.g389c180e
$ multipass --version
multipass 1.3.0-dev.55+gb82d487
multipassd 1.3.0-dev.55+gb82d487