diff --git a/code/client/munkilib/admin/pkginfolib.py b/code/client/munkilib/admin/pkginfolib.py index 10c01f3b..9315bdbf 100755 --- a/code/client/munkilib/admin/pkginfolib.py +++ b/code/client/munkilib/admin/pkginfolib.py @@ -293,7 +293,7 @@ def get_catalog_info_from_dmg(dmgpath, options): def readfile(path): '''Reads file at path. Returns a string.''' try: - fileobject = open(os.path.expanduser(path), mode='r', buffering=1) + fileobject = open(os.path.expanduser(path), mode='r') data = fileobject.read() fileobject.close() return data diff --git a/code/client/munkilib/adobeutils/core.py b/code/client/munkilib/adobeutils/core.py index d6dbff4e..e31fa785 100644 --- a/code/client/munkilib/adobeutils/core.py +++ b/code/client/munkilib/adobeutils/core.py @@ -257,7 +257,7 @@ def run_adobe_install_tool( # indeterminate progress bar munkistatus.percent(-1) - proc = subprocess.Popen(cmd, shell=False, bufsize=1, + proc = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -386,7 +386,7 @@ def writefile(stringdata, path): '''Writes string data to path. Returns the path on success, empty string on failure.''' try: - fileobject = open(path, mode='w', buffering=1) + fileobject = open(path, mode='wb') print(stringdata.encode('UTF-8'), file=fileobject) fileobject.close() return path @@ -729,7 +729,7 @@ def update_acrobatpro(dmgpath): app_list = [] app_list_file = os.path.join(resources_dir, 'app_list.txt') if os.path.exists(app_list_file): - fileobj = open(app_list_file, mode='r', buffering=-1) + fileobj = open(app_list_file, mode='r') if fileobj: for line in fileobj.readlines(): app_list.append(line) diff --git a/code/client/munkilib/appleupdates/au.py b/code/client/munkilib/appleupdates/au.py index f37a61e5..d5439c58 100644 --- a/code/client/munkilib/appleupdates/au.py +++ b/code/client/munkilib/appleupdates/au.py @@ -234,7 +234,7 @@ class AppleUpdates(object): # pylint: disable=no-self-use cmd = ['/usr/sbin/pkgutil', '--regexp', '--pkg-info-plist', r'com\.apple\.*'] - proc = subprocess.Popen(cmd, shell=False, bufsize=1, + proc = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = proc.communicate()[0] # don't decode because we need the bytes diff --git a/code/client/munkilib/munkilog.py b/code/client/munkilib/munkilog.py index f422a521..fa7c0a7f 100644 --- a/code/client/munkilib/munkilog.py +++ b/code/client/munkilib/munkilog.py @@ -60,7 +60,7 @@ def log(msg, logname=''): else: logpath = os.path.join(os.path.dirname(prefs.pref('LogFile')), logname) try: - fileobj = codecs.open(logpath, mode='a', buffering=1, encoding='UTF-8') + fileobj = codecs.open(logpath, mode='a', encoding='UTF-8') try: fileobj.write("%s %s\n" % (time.strftime(formatstr), msg)) except (OSError, IOError): diff --git a/code/client/munkilib/osutils.py b/code/client/munkilib/osutils.py index 29e90e43..cd848b44 100644 --- a/code/client/munkilib/osutils.py +++ b/code/client/munkilib/osutils.py @@ -140,7 +140,7 @@ def currentGUIusers(): def pythonScriptRunning(scriptname): """Returns Process ID for a running python script""" cmd = ['/bin/ps', '-eo', 'pid=,command='] - proc = subprocess.Popen(cmd, shell=False, bufsize=1, + proc = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = proc.communicate()[0].decode("UTF-8") @@ -176,7 +176,7 @@ def pythonScriptRunning(scriptname): def osascript(osastring): """Wrapper to run AppleScript commands""" cmd = ['/usr/bin/osascript', '-e', osastring] - proc = subprocess.Popen(cmd, shell=False, bufsize=1, + proc = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = proc.communicate() diff --git a/code/client/munkilib/pkgutils.py b/code/client/munkilib/pkgutils.py index 61b387bc..4b7cb894 100644 --- a/code/client/munkilib/pkgutils.py +++ b/code/client/munkilib/pkgutils.py @@ -635,7 +635,6 @@ def getInstalledPackageVersion(pkgid): # First check (Leopard and later) package database proc = subprocess.Popen(['/usr/sbin/pkgutil', '--pkg-info-plist', pkgid], - bufsize=1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = proc.communicate()[0] @@ -776,7 +775,7 @@ def getChoiceChangesXML(pkgitem): try: proc = subprocess.Popen( ['/usr/sbin/installer', '-showChoiceChangesXML', '-pkg', pkgitem], - bufsize=1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = proc.communicate()[0] if out: plist = FoundationPlist.readPlistFromString(out) diff --git a/code/client/munkilib/reports.py b/code/client/munkilib/reports.py index b6236b33..2d74850e 100644 --- a/code/client/munkilib/reports.py +++ b/code/client/munkilib/reports.py @@ -124,7 +124,7 @@ def archive_report(): _warn('Could not archive report.') # now keep number of archived reports to 100 or fewer proc = subprocess.Popen(['/bin/ls', '-t1', archivepath], - bufsize=1, stdout=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = proc.communicate()[0].decode('UTF-8') if output: diff --git a/code/client/munkilib/scriptutils.py b/code/client/munkilib/scriptutils.py index 4ef0e318..dd6a485f 100644 --- a/code/client/munkilib/scriptutils.py +++ b/code/client/munkilib/scriptutils.py @@ -36,7 +36,7 @@ def _writefile(stringdata, path): '''Writes string data to path. Returns the path on success, empty string on failure.''' try: - fileobject = open(path, mode='wb', buffering=1) + fileobject = open(path, mode='wb') # write line-by-line to ensure proper UNIX line-endings for line in stringdata.splitlines(): fileobject.write(line.encode('UTF-8') + b"\n") @@ -93,7 +93,7 @@ def run_script(itemname, path, scriptname, suppress_error=False): scriptoutput = [] try: - proc = subprocess.Popen(path, shell=False, bufsize=1, + proc = subprocess.Popen(path, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)