Commit 2ab42982 authored by David Danier's avatar David Danier

Version specs added

parent b237da95
# DEV
* work in progress ;-)
* Support for specifying the necessary b5 version in config.yml
* More work on documentation
# 1.0.0
......
......@@ -8,6 +8,7 @@ pyyaml = ">=3.13"
termcolor = ">=1.1.0"
"jinja2" = ">=2.10"
markupsafe = ">=1.0"
packaging = ">=16.0"
[dev-packages]
"e1839a8" = {path = ".", editable = true}
......
{
"_meta": {
"hash": {
"sha256": "5eae6221d8052b230b60d361d19565cef6e191f74e37723d84217a016d076990"
"sha256": "4eddc3ff7eccb6a1baa1c3c640b4bded0b0c649a7579c6cfeb6c57bdaeca9408"
},
"pipfile-spec": 6,
"requires": {
......@@ -26,10 +26,52 @@
},
"markupsafe": {
"hashes": [
"sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
"sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432",
"sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b",
"sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9",
"sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af",
"sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834",
"sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd",
"sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d",
"sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7",
"sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b",
"sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3",
"sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c",
"sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2",
"sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7",
"sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36",
"sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1",
"sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e",
"sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1",
"sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c",
"sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856",
"sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550",
"sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492",
"sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672",
"sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401",
"sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6",
"sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6",
"sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c",
"sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd",
"sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1"
],
"index": "pypi",
"version": "==1.0"
"version": "==1.1.0"
},
"packaging": {
"hashes": [
"sha256:0886227f54515e592aaa2e5a553332c73962917f2831f1b0f9b9f4380a4b9807",
"sha256:f95a1e147590f204328170981833854229bb2912ac3d5f89e2a8ccd2834800c9"
],
"index": "pypi",
"version": "==18.0"
},
"pyparsing": {
"hashes": [
"sha256:40856e74d4987de5d01761a22d1621ae1c7f8774585acae358aa5c5936c6c90b",
"sha256:f353aab21fd474459d97b709e527b5571314ee5f067441dc9f88e33eecd96592"
],
"version": "==2.3.0"
},
"pyyaml": {
"hashes": [
......@@ -48,6 +90,13 @@
"index": "pypi",
"version": "==3.13"
},
"six": {
"hashes": [
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
"sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
],
"version": "==1.12.0"
},
"termcolor": {
"hashes": [
"sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"
......@@ -71,10 +120,52 @@
},
"markupsafe": {
"hashes": [
"sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
"sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432",
"sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b",
"sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9",
"sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af",
"sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834",
"sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd",
"sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d",
"sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7",
"sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b",
"sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3",
"sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c",
"sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2",
"sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7",
"sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36",
"sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1",
"sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e",
"sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1",
"sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c",
"sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856",
"sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550",
"sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492",
"sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672",
"sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401",
"sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6",
"sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6",
"sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c",
"sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd",
"sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1"
],
"index": "pypi",
"version": "==1.0"
"version": "==1.1.0"
},
"packaging": {
"hashes": [
"sha256:0886227f54515e592aaa2e5a553332c73962917f2831f1b0f9b9f4380a4b9807",
"sha256:f95a1e147590f204328170981833854229bb2912ac3d5f89e2a8ccd2834800c9"
],
"index": "pypi",
"version": "==18.0"
},
"pyparsing": {
"hashes": [
"sha256:40856e74d4987de5d01761a22d1621ae1c7f8774585acae358aa5c5936c6c90b",
"sha256:f353aab21fd474459d97b709e527b5571314ee5f067441dc9f88e33eecd96592"
],
"version": "==2.3.0"
},
"pyyaml": {
"hashes": [
......@@ -93,6 +184,13 @@
"index": "pypi",
"version": "==3.13"
},
"six": {
"hashes": [
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
"sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
],
"version": "==1.12.0"
},
"termcolor": {
"hashes": [
"sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"
......
import yaml
import os
from .version import ensure_config_version
from ..exceptions import B5ExecutionError
......@@ -35,10 +36,17 @@ def merge_config(cur_config, new_config):
elif value is None:
result_config[key] = value
else:
raise RuntimeError('Unknown type for config export %s' % type(value))
raise B5ExecutionError('Unknown type for config export %s' % type(value))
return result_config
def validate_config(config):
if 'version' in config:
ensure_config_version(config['version'])
return config
def load_config(state):
configfiles = state.configfiles
config = {}
......@@ -49,5 +57,5 @@ def load_config(state):
file_config = {}
config = merge_config(config, file_config)
validate_config(config)
return config
from packaging import version
from .. import VERSION
from ..exceptions import B5ExecutionError
B5_VERSION = version.parse(VERSION)
def ensure_config_version(config_version_str):
config_version = version.parse(config_version_str)
if config_version > B5_VERSION:
raise B5ExecutionError('config.yml requires more recent version of b5 (>=%s), aborting' % config_version_str)
......@@ -5,6 +5,7 @@ import sys
import termcolor
import jinja2
from .. import VERSION
from . import BaseModule
......@@ -78,6 +79,7 @@ class TemplateModule(BaseModule):
module=self,
# Add some meta information about template rendering
meta={
'version': VERSION,
'now': datetime.datetime.now().isoformat(),
'template_file': template_file,
'output_file': output_file if output_file else '-',
......
version: "1.0"
project:
name: b5
key: b5
......
......@@ -34,6 +34,7 @@ variables. In general all options are broken down to variables like this (prefix
Example config.xml:
```yaml
version: "1.0"
project:
name: Some project
key: example
......@@ -46,6 +47,7 @@ paths:
gets transformed into
```bash
CONFIG_version="1.0"
CONFIG_project_name="Some project"
CONFIG_project_key="example"
CONFIG_project_url="https://www.domain.com"
......@@ -63,6 +65,10 @@ CONFIG_paths_KEYS=("web" "docker_data")
# This is the central configuration for all tools we use/execute. It is available inside
# the Taskfile, too. See $CONFIG_project_name for example.
# b5 version number
# (b5 ensures to not run projects with higher version numbers)
version: "1.0"
# Generic project settings
project:
# Name of the project
......
......@@ -46,7 +46,8 @@ available as `env`. Template context might look like:
"stored_name": "/path/to/stored/state",
"taskfiles": [{"path": "/path/to/project/build/Taskfile",
"taskfile": "Taskfile"}]},
"meta": {"now": "CURRENT ISO TIME",
"meta": {"version": "CURRENT b5 VERSION STRING",
"now": "CURRENT ISO TIME",
"template_file": "/path/to/template/file.jinja2",
"output_file": "/path/to/output/file.ext"},
"env": {"...": "..."}}
......
......@@ -43,6 +43,7 @@ setup(
'termcolor >=1.1.0',
'Jinja2 >=2.10',
'MarkupSafe >=1.0',
'packaging >=16.0',
],
entry_points={
'console_scripts': [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment