Skip to content

Commit 3236f82

Browse files
committed
0.8.8 - merge variant data
1 parent 5df6d84 commit 3236f82

File tree

8 files changed

+22
-15
lines changed

8 files changed

+22
-15
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
7979
- run: |
8080
mk python-release owner=libre-embedded \
81-
repo=svgen version=0.8.7
81+
repo=svgen version=0.8.8
8282
if: |
8383
matrix.python-version == '3.12'
8484
&& matrix.system == 'ubuntu-latest'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
=====================================
33
generator=datazen
44
version=3.2.3
5-
hash=f935f51e4d5399e713a10807671e4810
5+
hash=4e19b7fd794cee4f663c3486ed81a7ae
66
=====================================
77
-->
88

9-
# svgen ([0.8.7](https://pypi.org/project/svgen/))
9+
# svgen ([0.8.8](https://pypi.org/project/svgen/))
1010

1111
[![python](https://img.shields.io/pypi/pyversions/svgen.svg)](https://pypi.org/project/svgen/)
1212
![Build Status](https://github.com/libre-embedded/svgen/workflows/Python%20Package/badge.svg)

local/configs/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ entry: {{entry}}
77
time_command: true
88

99
requirements:
10-
- vcorelib
10+
- vcorelib>=3.6.7
1111

1212
dev_requirements:
1313
- setuptools-wrapper

local/variables/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
major: 0
33
minor: 8
4-
patch: 7
4+
patch: 8
55
entry: svgen

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"
44

55
[project]
66
name = "svgen"
7-
version = "0.8.7"
7+
version = "0.8.8"
88
description = "A tool for working with scalable vector graphics."
99
readme = "README.md"
1010
requires-python = ">=3.12"

svgen/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# =====================================
22
# generator=datazen
33
# version=3.2.3
4-
# hash=6dbd96511bfd47795bc38e1d4b666c69
4+
# hash=d7ef29596b2bc69d2f78eb6f58e41e51
55
# =====================================
66

77
"""
@@ -10,4 +10,4 @@
1010

1111
DESCRIPTION = "A tool for working with scalable vector graphics."
1212
PKG_NAME = "svgen"
13-
VERSION = "0.8.7"
13+
VERSION = "0.8.8"

svgen/app.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
# built-in
66
import argparse
7+
from copy import deepcopy
8+
from logging import getLogger
79
from pathlib import Path
810
from sys import path
911
from typing import Iterable, cast
1012

1113
# third-party
12-
from vcorelib.dict import GenericStrDict
14+
from vcorelib.dict import GenericStrDict, merge_dicts
1315
from vcorelib.dict.config import Config
1416
from vcorelib.io import DEFAULT_INCLUDES_KEY
1517

@@ -20,6 +22,8 @@
2022
from svgen.generation.images import generate_images
2123
from svgen.script import invoke_script
2224

25+
LOG = getLogger(__name__)
26+
2327

2428
def generate(
2529
config: Config,
@@ -48,8 +52,7 @@ def generate(
4852
# Write the composed document to the output file.
4953
with output.open("w", encoding="utf-8") as output_fd:
5054
doc.encode(output_fd)
51-
52-
print(f"Generated '{output}'.")
55+
LOG.info("Wrote '%s'.", output)
5356

5457
# Generate image outputs.
5558
if images:
@@ -82,7 +85,7 @@ def entry(args: argparse.Namespace) -> int:
8285
initialize_config(config, args.height, args.width)
8386

8487
# Save the initial configuration data.
85-
original = config.data.copy()
88+
original = deepcopy(config.data)
8689

8790
scripts = set(x.resolve() for x in args.scripts)
8891

@@ -92,8 +95,12 @@ def entry(args: argparse.Namespace) -> int:
9295
# Generate any document variants.
9396
for idx, variant in enumerate(config.get("variants", [])):
9497
# Load the variant's data.
95-
config = Config(original.copy())
96-
config.update(variant.get("data", {}))
98+
config = Config(
99+
merge_dicts(
100+
[deepcopy(original), variant.get("data", {})],
101+
expect_overwrite=True,
102+
)
103+
)
97104
initialize_config(config, args.height, args.width)
98105

99106
# Set the output name for this variant.

svgen/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
vcorelib
1+
vcorelib>=3.6.7

0 commit comments

Comments
 (0)