Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3 #22

Merged
merged 1 commit into from
Oct 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions mcxToProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Simple utility to assist with creating Custom Settings Configuration Profiles
# from plist files and Directory Services nodes

from __future__ import print_function

import sys
import os
import optparse
Expand Down Expand Up @@ -67,7 +69,7 @@ def _addPayload(self, payload_content_dict):
PayloadContent dict within the payload. Handles the boilerplate, naming and descriptive
elements.
"""
domains = payload_content_dict.keys()
domains = list(payload_content_dict.keys())
if len(domains) == 1:
domain = domains[0]
self.data['PayloadDescription'] += "%s\n" % domain
Expand Down Expand Up @@ -121,7 +123,6 @@ def addPayloadFromPlistContents(self, plist_dict, domain, manage, is_byhost=Fals
if manage == 'Once':
now = NSDate.new()
payload_dict[domain][state][0]['mcx_data_timestamp'] = now

self._addPayload(payload_dict)

def addPayloadFromMCX(self, mcxdata):
Expand All @@ -143,7 +144,7 @@ def makeNewUUID():


def errorAndExit(errmsg):
print >> sys.stderr, errmsg
print(errmsg, file=sys.stderr)
exit(-1)


Expand Down Expand Up @@ -450,7 +451,7 @@ def main():
errorAndExit("Error: One of '--dsobject' or '--plist' or '--defaults' must be specified.")

if options.dsobject and options.manage:
print options.manage
print(options.manage)
parser.print_usage()
errorAndExit("Error: The '--manage' option is used only in conjunction with '--plist'. DS Objects already contain this information.")

Expand Down Expand Up @@ -483,12 +484,11 @@ def main():
else:
manage = None
if manage == 'Often':
print >> sys.stderr, \
("WARNING: Deploying profiles configured for 'Often' settings "
print(("WARNING: Deploying profiles configured for 'Often' settings "
"management is known to have undesirable effects on OS X "
"Yosemite. \n"
" Consider using 'Once' instead, and see this repo's "
"README for links to more documentation.")
"README for links to more documentation."), file=sys.stderr)


if options.output:
Expand Down