Skip to content

Commit

Permalink
0.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Pugh (iMac Pro) committed Jun 21, 2022
1 parent 86ebfdb commit 15b49ad
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 47 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. This projec

Changes since last release will be listed here.

## [v0.6.3] - 2022-06-21 - v0.6.3

- Fixed running on folders without a destination when converting from YAML to PLIST or vice versa.

## [v0.6.1] - 2021-04-26 - v0.6.1

- Adding `ParentRecipeTrustInfo` to the `desired_order` dict so that when autopkg recipes are converted or tidied, the Trust Info is retained. Also adding this to the processors which gain a new line before them for readability (#10 - thanks to @smithjw).
Expand Down Expand Up @@ -52,7 +56,8 @@ Changes since last release will be listed here.

- Initial Release (though the tool has been around for some time).

[unreleased]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.6.1...HEAD
[unreleased]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.6.3...HEAD
[v0.6.3]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.6.1...v0.6.3
[v0.6.1]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.6.0...v0.6.1
[v0.6.0]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.5.0...v0.6.0
[v0.5.0]: https://github.com/grahampugh/plist-yaml-plist/compare/v0.4.0...v0.5.0
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ $($(CURDIR)/versionbump.py)

CURDIR := $(shell pwd)
MUNKIPKG := /usr/local/bin/munkipkg
PYTHON_PATH := /usr/local/autopkg/python
PKG_ROOT := $(CURDIR)/pkg/plistyamlplist/payload
PKG_BUILD := $(CURDIR)/pkg/plistyamlplist/build
PKG_VERSION := $(shell defaults read $(CURDIR)/pkg/plistyamlplist/build-info.plist version)
Expand All @@ -15,7 +16,7 @@ default : $(PKG_BUILD)/plistyamlplist-$(PKG_VERSION).pkg


$(PKG_BUILD)/plistyamlplist-$(PKG_VERSION).pkg: $(objects)
cd $(CURDIR)/pkg && $(MUNKIPKG) plistyamlplist
cd $(CURDIR)/pkg && $(PYTHON_PATH) $(MUNKIPKG) plistyamlplist
open $(CURDIR)/pkg/plistyamlplist/build


Expand Down
4 changes: 2 additions & 2 deletions pkg/plistyamlplist/build-info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<key>install_location</key>
<string>/</string>
<key>name</key>
<string>plistyamlplist-0.6.2.pkg</string>
<string>plistyamlplist-0.6.3.pkg</string>
<key>ownership</key>
<string>recommended</string>
<key>postinstall_action</key>
<string>none</string>
<key>suppress_bundle_relocation</key>
<true/>
<key>version</key>
<string>0.6.2</string>
<string>0.6.3</string>
</dict>
</plist>
87 changes: 45 additions & 42 deletions plistyamlplist.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,48 +198,51 @@ def main():
elif os.path.isdir(in_path) and "YAML" in in_path:
print("Processing YAML folder...")
filetype = "yaml"
if sys.argv[2] == "--tidy":
print("WARNING! Processing all subfolders...\n")
for root, dirs, files in os.walk(in_path):
for name in files:
tidy_yaml(os.path.join(root, name))
for name in dirs:
tidy_yaml(os.path.join(root, name))
elif os.path.isdir(sys.argv[2]):
# allow batch replication of folder structure and conversion of yaml to plist
# also copies other file types without conversion to the same place in the
# hierarchy
out_path_base = os.path.abspath(sys.argv[2])
print("Writing to {}".format(out_path_base))
for root, dirs, files in os.walk(in_path):
for name in dirs:
working_dir = os.path.join(out_path_base, name)
if not os.path.isdir(working_dir):
print("Creating new folder " + working_dir)
os.mkdir(working_dir)
for name in files:
source_path = os.path.join(root, name)
print("In path: " + in_path)
sub_path = re.sub(in_path, "", source_path)
print("Subdirectory path: " + sub_path)
filename, _ = os.path.splitext(
os.path.join(out_path_base, sub_path)
)
print("Source path: " + source_path)
if source_path.endswith(".yaml"):
dest_path = filename + ".plist"
print("Destination path for plist: " + dest_path)
yaml_plist(source_path, dest_path)
else:
dest_path = os.path.join(os.path.join(out_path_base, sub_path))
print("Destination path: " + dest_path)
try:
shutil.copy(source_path, dest_path)
if os.path.isfile(dest_path):
print("Written to " + dest_path + "\n")
except IOError:
print("ERROR: could not copy " + source_path + "\n")
else:
try:
if sys.argv[2] == "--tidy":
print("WARNING! Processing all subfolders...\n")
for root, dirs, files in os.walk(in_path):
for name in files:
tidy_yaml(os.path.join(root, name))
for name in dirs:
tidy_yaml(os.path.join(root, name))
elif os.path.isdir(sys.argv[2]):
# allow batch replication of folder structure and conversion of yaml to plist
# also copies other file types without conversion to the same place in the
# hierarchy
out_path_base = os.path.abspath(sys.argv[2])
print("Writing to {}".format(out_path_base))
for root, dirs, files in os.walk(in_path):
for name in dirs:
working_dir = os.path.join(out_path_base, name)
if not os.path.isdir(working_dir):
print("Creating new folder " + working_dir)
os.mkdir(working_dir)
for name in files:
source_path = os.path.join(root, name)
print("In path: " + in_path)
sub_path = re.sub(in_path, "", source_path)
print("Subdirectory path: " + sub_path)
filename, _ = os.path.splitext(
os.path.join(out_path_base, sub_path)
)
print("Source path: " + source_path)
if source_path.endswith(".yaml"):
dest_path = filename + ".plist"
print("Destination path for plist: " + dest_path)
yaml_plist(source_path, dest_path)
else:
dest_path = os.path.join(
os.path.join(out_path_base, sub_path)
)
print("Destination path: " + dest_path)
try:
shutil.copy(source_path, dest_path)
if os.path.isfile(dest_path):
print("Written to " + dest_path + "\n")
except IOError:
print("ERROR: could not copy " + source_path + "\n")
except IndexError:
for in_file in os.listdir(in_path):
in_file_path = os.path.join(in_path, in_file)
out_path = get_out_path(in_file_path, filetype)
Expand Down
2 changes: 1 addition & 1 deletion plistyamlplist_lib/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.2"
__version__ = "0.6.3"

0 comments on commit 15b49ad

Please sign in to comment.