From 7767c2da9ac3c990f5a92e9fcc6669d5ac6a2d49 Mon Sep 17 00:00:00 2001 From: Graham Pugh Date: Thu, 11 Feb 2021 00:03:21 +0000 Subject: [PATCH] v0.5.0 --- CHANGELOG.md | 7 ++++++- README.md | 8 +++++--- pkg/plistyamlplist/build-info.plist | 2 +- plistyamlplist_lib/plist_yaml.py | 19 ++++++++++++++++--- plistyamlplist_lib/yaml_plist.py | 19 ++++++++++++++++--- setup.py | 4 ++-- 6 files changed, 46 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a6dc9c..30b6e65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. This projec ## [unreleased] +## [v0.5.0] - 2021-02-11 - v0.5.0 + +- Switched from `pyyaml` to `ruamel`. + ## [v0.4.0] - 2021-02-10 - v0.4.0 - You can now use this tool to convert `json` > `plist`. Note that the `plist` format do not accept `null`/`None` values, so this script will extract any keys with `null`/`None` values before converting. @@ -32,7 +36,8 @@ All notable changes to this project will be documented in this file. This projec - Initial Release (though the tool has been around for some time). -[unreleased]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.4.0...HEAD +[unreleased]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.5.0...HEAD +[v0.5.0]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.4.0...v0.5.0 [v0.4.0]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.3.1...v0.4.0 [v0.3.1]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.3...v0.3.1 [v0.3]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.2...v0.3 diff --git a/README.md b/README.md index a421a10..ab769b0 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,15 @@ It can also convert `json` files to `plist`. ## Prerequisites -The python `yaml` module is required, which is not installed by default on Macs. You can install it with `pip`, which you may also need to install first. +The python `ruamel` module is required, which is not installed by default on Macs. You can install it with `pip`, which you may also need to install first. ```bash -sudo python -m ensurepip -pip install ruamel +python -m ensurepip --user +python -m pip install ruamel --user ``` +If you do not pre-install `ruamel`, the script will do it for you. + ## Usage A single command can be used to convert from plist to yaml or from yaml to plist. This depends on the file suffices being predictable: diff --git a/pkg/plistyamlplist/build-info.plist b/pkg/plistyamlplist/build-info.plist index fee5e3f..4f5aebf 100644 --- a/pkg/plistyamlplist/build-info.plist +++ b/pkg/plistyamlplist/build-info.plist @@ -17,6 +17,6 @@ suppress_bundle_relocation version - 0.4.0 + 0.5.0 diff --git a/plistyamlplist_lib/plist_yaml.py b/plistyamlplist_lib/plist_yaml.py index 760c159..0834319 100755 --- a/plistyamlplist_lib/plist_yaml.py +++ b/plistyamlplist_lib/plist_yaml.py @@ -23,11 +23,24 @@ from plistlib import readPlist as load_plist try: - import yaml + from ruamel import yaml except ImportError: subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"]) - subprocess.check_call([sys.executable, "-m", "pip", "install", "pyyaml", "--user"]) - import yaml + subprocess.check_call( + [ + sys.executable, + "-m", + "pip", + "install", + "-U", + "pip", + "setuptools", + "wheel", + "ruamel", + "--user", + ] + ) + from ruamel import yaml def represent_ordereddict(dumper, data): diff --git a/plistyamlplist_lib/yaml_plist.py b/plistyamlplist_lib/yaml_plist.py index 346567e..f5594a0 100755 --- a/plistyamlplist_lib/yaml_plist.py +++ b/plistyamlplist_lib/yaml_plist.py @@ -23,11 +23,24 @@ from plistlib import writePlistToString as write_plist try: - import yaml + from ruamel import yaml except ImportError: subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"]) - subprocess.check_call([sys.executable, "-m", "pip", "install", "pyyaml", "--user"]) - import yaml + subprocess.check_call( + [ + sys.executable, + "-m", + "pip", + "install", + "-U", + "pip", + "setuptools", + "wheel", + "ruamel", + "--user", + ] + ) + from ruamel import yaml def convert(data): diff --git a/setup.py b/setup.py index 59bfe65..984bda3 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="plistyamlplist", - version="0.4.0", + version="0.5.0", packages=find_packages(include=["plistyamlplist_lib", "plistyamlplist_lib.*"]), - install_requires=["pyyaml"], + install_requires=["ruamel"], )