sc-jsonnet

Build your snapcraft.yaml with jsonnet!

Description

Use jsonnet syntax to build your snapcraft.yaml.

For information about jsonnet see https://jsonnet.org/

Howto

First you need to get sc-jsonnet from the snap store. Either run:

sudo snap install sc-jsonnet

Or click the following button to go to the store where you can install it using the GUI:

Get it from the Snap Store

Now you have the program you need to make a file called snapcraft.jsonnet in your snapcraft project at ./snap/local/snapcraft.jsonnet. Add the following to begin with:

local snapcraft = import 'snapcraft.libsonnet';

snapcraft {
    name: "my-jsonnet-snap-name",
    version: "0.1",
    summary: "Single-line elevator pitch for your amazing snap",
    description: "This is my-snap's description. You have a paragraph or two to tell the most important story about your snap. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the snap store.",
    grade: "devel",
    confinement: "devmode",

    parts: {
        "my-part": {
            plugin: "nil",
        },
    },
}

Finally we need to run the translation step to convert the jsonnet into yaml for snapcraft to use. First, we run sc-jsonnet without any parameters to see the yaml that will be produced:

sc-jsonnet

Now we have verified that everything works, we can run with -o snap/snapcraft.yaml to save into your project snapcraft.yaml for the snapcraft tool to use:

sc-jsonnet -o snap/snapcraft.yaml

Note

This project has been set up using PyScaffold 3.2.1. For details and usage information on PyScaffold see https://pyscaffold.org/.

Contents

Available libraries

Here we list the known libraries that have been written for sc-jsonnet. If you write a library that you would like to see featured here, please either open an issue or fork the repository and create a pull-request.

License

The MIT License (MIT)

Copyright (c) 2019 Daniel Llewellyn

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributors

Changelog

Version 0.3

  • Drop version field from default values

Version 0.2

  • Upgrade jsonnet to upstream version 0.15.0
  • Enable test suite

Version 0.1

  • Initial release

sc_jsonnet

sc_jsonnet package

Submodules
sc_jsonnet.cli module

This is the main sc-jsonnet file.

sc_jsonnet.cli.find_snapcraft_file(dir)[source]
sc_jsonnet.cli.import_callback(dir, rel)[source]
sc_jsonnet.cli.main(args)[source]

Main entry point allowing external calls

Parameters:args ([str]) – command line parameter list
sc_jsonnet.cli.parse_args(args)[source]

Parse command line parameters

Parameters:args ([str]) – command line parameters as list of strings
Returns:command line parameters namespace
Return type:argparse.Namespace
sc_jsonnet.cli.parse_snapcraft_file(path)[source]
sc_jsonnet.cli.run()[source]

Entry point for console_scripts

sc_jsonnet.cli.setup_logging(loglevel)[source]

Setup basic logging

Parameters:loglevel (int) – minimum loglevel for emitting messages
sc_jsonnet.cli.try_path(dir, rel)[source]
Module contents

Indices and tables