snapcraft update
This commit is contained in:
8
main.py
8
main.py
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
import click
|
||||
import qrcode
|
||||
from PIL import Image
|
||||
@@ -13,7 +15,7 @@ from qrcode.image.styles.moduledrawers.pil import RoundedModuleDrawer
|
||||
help='Output file path (defaults to "./qrcode.png")',
|
||||
)
|
||||
@click.argument("url")
|
||||
def generate(output_file, url):
|
||||
def create(output_file, url):
|
||||
qr = qrcode.QRCode(
|
||||
version=1,
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_H,
|
||||
@@ -29,11 +31,11 @@ def generate(output_file, url):
|
||||
back_color=(255, 255, 255), front_color=(233, 84, 32)
|
||||
),
|
||||
module_drawer=RoundedModuleDrawer(),
|
||||
embeded_image_path="assets/canonical.png",
|
||||
embeded_image_path=f"{os.environ.get("SNAP")}/assets/canonical.png",
|
||||
)
|
||||
|
||||
qri.save(output_file)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate()
|
||||
create()
|
||||
|
||||
27
snap/snapcraft.yaml
Normal file
27
snap/snapcraft.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
name: cqrcode # you probably want to 'snapcraft register <name>'
|
||||
base: core24 # the base snap is the execution environment for this snap
|
||||
version: '1.0' # just for humans, typically '1.2+git' or '1.3.2'
|
||||
summary: Create QR codes flying Canonical colors. # 79 char long summary
|
||||
description: |
|
||||
TODO
|
||||
|
||||
grade: stable # must be 'stable' to release into candidate/stable channels
|
||||
confinement: strict # use 'strict' once you have the right plugs and slots
|
||||
|
||||
parts:
|
||||
venv:
|
||||
# See 'snapcraft plugins'
|
||||
plugin: python
|
||||
source-type: local
|
||||
source: .
|
||||
python-requirements:
|
||||
- requirements.txt
|
||||
source:
|
||||
plugin: dump
|
||||
source: .
|
||||
|
||||
apps:
|
||||
create:
|
||||
command: bin/python $SNAP/main.py
|
||||
plugs:
|
||||
- home
|
||||
Reference in New Issue
Block a user