From 39afb515f21ef9e904fa165b0418f75086424719 Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Tue, 8 Jun 2021 23:37:06 +0200 Subject: [PATCH 1/3] Specify attrs minimum required version We use kw_only in attr.s which was added in 18.2.0 [1] https://github.com/python-attrs/attrs/blob/main/CHANGELOG.rst#1820-2018-09-01 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3657362e..86ce2325 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,7 @@ setup_requires = setuptools >= 40.6 pip >= 10 install_requires = - attrs + attrs >= 18.2.0 typing-extensions [options.packages.find] From ed3159373d084c83df78595735336492148e9b2a Mon Sep 17 00:00:00 2001 From: Darren Eberly Date: Fri, 9 Jul 2021 21:06:11 -0400 Subject: [PATCH 2/3] Fix color parsing --- pytiled_parser/util.py | 2 +- tests/test_data/map_tests/external_tileset_dif_dir/expected.py | 2 +- tests/test_data/map_tests/no_layers/expected.py | 2 +- tests/test_data/map_tests/template/expected.py | 2 +- tests/test_data/tilesets/image_properties/expected.py | 2 +- tests/test_tiled_object.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pytiled_parser/util.py b/pytiled_parser/util.py index 8db180a5..75c7d1db 100644 --- a/pytiled_parser/util.py +++ b/pytiled_parser/util.py @@ -20,10 +20,10 @@ def parse_color(color: str) -> Color: return Color(int(color[0:2], 16), int(color[2:4], 16), int(color[4:6], 16), 255) elif len(color) == 8: return Color( - int(color[0:2], 16), int(color[2:4], 16), int(color[4:6], 16), int(color[6:8], 16), + int(color[0:2], 16), ) raise ValueError("Improperly formatted color passed to parse_color") diff --git a/tests/test_data/map_tests/external_tileset_dif_dir/expected.py b/tests/test_data/map_tests/external_tileset_dif_dir/expected.py index 1e866299..61687dfa 100644 --- a/tests/test_data/map_tests/external_tileset_dif_dir/expected.py +++ b/tests/test_data/map_tests/external_tileset_dif_dir/expected.py @@ -173,7 +173,7 @@ }, properties={ "bool property - true": True, - "color property": common_types.Color(255, 73, 252, 255), + "color property": common_types.Color(73, 252, 255, 255), "file property": Path("../../../../../../var/log/syslog"), "float property": 1.23456789, "int property": 13, diff --git a/tests/test_data/map_tests/no_layers/expected.py b/tests/test_data/map_tests/no_layers/expected.py index 7bc5ca2d..ab8b5ca0 100644 --- a/tests/test_data/map_tests/no_layers/expected.py +++ b/tests/test_data/map_tests/no_layers/expected.py @@ -35,7 +35,7 @@ }, properties={ "bool property - true": True, - "color property": common_types.Color(255, 73, 252, 255), + "color property": common_types.Color(73, 252, 255, 255), "file property": Path("../../../../../../var/log/syslog"), "float property": 1.23456789, "int property": 13, diff --git a/tests/test_data/map_tests/template/expected.py b/tests/test_data/map_tests/template/expected.py index ae8f84a5..5cab7fcb 100644 --- a/tests/test_data/map_tests/template/expected.py +++ b/tests/test_data/map_tests/template/expected.py @@ -68,7 +68,7 @@ }, properties={ "bool property - true": True, - "color property": common_types.Color(255, 73, 252, 255), + "color property": common_types.Color(73, 252, 255, 255), "file property": Path("../../../../../../var/log/syslog"), "float property": 1.23456789, "int property": 13, diff --git a/tests/test_data/tilesets/image_properties/expected.py b/tests/test_data/tilesets/image_properties/expected.py index d756b2b3..f83a9fb8 100644 --- a/tests/test_data/tilesets/image_properties/expected.py +++ b/tests/test_data/tilesets/image_properties/expected.py @@ -18,7 +18,7 @@ version="1.6", properties={ "bool property": True, - "color property": Color(255, 0, 0, 255), + "color property": Color(0, 0, 255, 255), "float property": 5.6, "int property": 5, "string property": "testing", diff --git a/tests/test_tiled_object.py b/tests/test_tiled_object.py index f202029d..10e71c4a 100644 --- a/tests/test_tiled_object.py +++ b/tests/test_tiled_object.py @@ -261,7 +261,7 @@ coordinates=common_types.OrderedPair(39.0678640445606, 131.826759122428), properties={ "bool property": False, - "color property": common_types.Color(255, 170, 0, 0), + "color property": common_types.Color(170, 0, 0, 255), "file property": Path("../../../../../../dev/null"), "float property": 42.1, "int property": 8675309, From 5dd76443871880fe9f3eccb5202ad35ae4ff5f89 Mon Sep 17 00:00:00 2001 From: Darren Eberly Date: Fri, 9 Jul 2021 21:06:22 -0400 Subject: [PATCH 3/3] Update version and changelog for 1.5.1 --- CHANGELOG.md | 7 +++++++ pytiled_parser/version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ce43330..71fe7947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [1.5.1] - 2021-07-09 + +This release contains two bugfixes: + +- Pinned minimum attrs version to usage of `kw_only` which was introduced in 18.2.0. See https://github.com/Beefy-Swain/pytiled_parser/pull/39 +- Fixed color parsing to be correct. Tiled saves it's colors in either RGB or ARGB format. We were previously parsing RGB correctly, but if an alpha value was present it would be parsed if it were RGBA and so all the values would be offset by one. + ## [1.5.0] - 2021-05-16 This release contains several new features. As of this release pytiled-parser supports 100% of Tiled's feature-set as of Tiled 1.6. diff --git a/pytiled_parser/version.py b/pytiled_parser/version.py index b16a143e..68061947 100644 --- a/pytiled_parser/version.py +++ b/pytiled_parser/version.py @@ -1,3 +1,3 @@ """pytiled_parser version""" -__version__ = "1.5.0" +__version__ = "1.5.1"