Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
grahampugh committed Feb 11, 2021
1 parent eb82f64 commit 7767c2d
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 13 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pkg/plistyamlplist/build-info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<key>suppress_bundle_relocation</key>
<true/>
<key>version</key>
<string>0.4.0</string>
<string>0.5.0</string>
</dict>
</plist>
19 changes: 16 additions & 3 deletions plistyamlplist_lib/plist_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
19 changes: 16 additions & 3 deletions plistyamlplist_lib/yaml_plist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)

0 comments on commit 7767c2d

Please sign in to comment.