diff --git a/main.py b/main.py index 291265c..cb6e471 100644 --- a/main.py +++ b/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() diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000..7890dad --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,27 @@ +name: cqrcode # you probably want to 'snapcraft register ' +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