mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Fix byte vs string error in Python 3.7
This commit is contained in:
committed by
Mat Sutcliffe
parent
fb46947252
commit
f63d6cc392
@@ -38,7 +38,7 @@ def get_environment_from_batch_command(env_cmd, initial=None):
|
||||
# Construct the command that will alter the environment.
|
||||
env_cmd = subprocess.list2cmdline(env_cmd)
|
||||
# Create a tag so we can tell in the output when the proc is done.
|
||||
tag = 'END OF BATCH COMMAND'
|
||||
tag = b'END OF BATCH COMMAND'
|
||||
# Construct a cmd.exe command to do accomplish this.
|
||||
cmd = 'cmd.exe /s /c "{env_cmd} && echo "{tag}" && set"'.format(**vars())
|
||||
# Launch the process.
|
||||
@@ -48,7 +48,7 @@ def get_environment_from_batch_command(env_cmd, initial=None):
|
||||
# Consume whatever output occurs until the tag is reached.
|
||||
consume(itertools.takewhile(lambda l: tag not in l, lines))
|
||||
# Define a way to handle each KEY=VALUE line.
|
||||
handle_line = lambda l: l.rstrip().split('=', 1)
|
||||
handle_line = lambda l: l.decode('utf-8').rstrip().split('=', 1)
|
||||
# Parse key/values into pairs.
|
||||
pairs = map(handle_line, lines)
|
||||
# Make sure the pairs are valid.
|
||||
|
||||
@@ -312,12 +312,6 @@ class Dumper:
|
||||
# FILE index filename
|
||||
(x, index, filename) = line.rstrip().split(None, 2)
|
||||
filename = os.path.normpath(self.fix_filename_case(filename))
|
||||
# We want original file paths for the source server.
|
||||
sourcepath = filename
|
||||
# gather up files with hg for indexing
|
||||
if filename.startswith("hg"):
|
||||
(ver, checkout, source_file, revision) = filename.split(":", 3)
|
||||
source_file_stream += sourcepath + "*" + source_file + '*' + revision + "\r\n"
|
||||
f.write("FILE %s %s\n" % (index, filename))
|
||||
elif line.startswith("INFO CODE_ID "):
|
||||
# INFO CODE_ID code_id code_file
|
||||
@@ -379,8 +373,8 @@ class DumperWin32(Dumper):
|
||||
result = file_name
|
||||
|
||||
ctypes.windll.kernel32.SetErrorMode(ctypes.c_uint(1))
|
||||
if not isinstance(file_name, unicode):
|
||||
file_name = unicode(file_name, sys.getfilesystemencoding())
|
||||
if not isinstance(file_name, str):
|
||||
file_name = file_name.decode(sys.getfilesystemencoding())
|
||||
handle = ctypes.windll.kernel32.CreateFileW(file_name,
|
||||
# GENERIC_READ
|
||||
0x80000000,
|
||||
|
||||
Reference in New Issue
Block a user