Skip to content

Commit 875b37b

Browse files
committed
Python 3 migration: external_deps/cygtar.py
1 parent 8beb986 commit 875b37b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

external_deps/cygtar.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2
1+
#!/usr/bin/env python3
22
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
33
# Use of this source code is governed by a BSD-style license that can be
44
# found in the LICENSE file.
@@ -78,12 +78,12 @@ def CreateCygwinSymlink(filepath, target):
7878
lnk.close()
7979
break
8080
except EnvironmentError:
81-
print 'Try %d: Failed open %s -> %s\n' % (cnt, filepath, target)
81+
print('Try %d: Failed open %s -> %s\n' % (cnt, filepath, target))
8282

8383
# Verify the file was created
8484
if not os.path.isfile(filepath):
85-
print 'Try %d: Failed create %s -> %s\n' % (cnt, filepath, target)
86-
print 'Giving up.'
85+
print('Try %d: Failed create %s -> %s\n' % (cnt, filepath, target))
86+
print('Giving up.')
8787
return False
8888

8989
# Now set the system attribute bit so that Cygwin knows it's a link.
@@ -92,8 +92,8 @@ def CreateCygwinSymlink(filepath, target):
9292
return subprocess.call(['cmd', '/C', 'C:\\Windows\\System32\\attrib.exe',
9393
'+S', ToNativePath(filepath)])
9494
except EnvironmentError:
95-
print 'Try %d: Failed attrib %s -> %s\n' % (cnt, filepath, target)
96-
print 'Giving up.'
95+
print('Try %d: Failed attrib %s -> %s\n' % (cnt, filepath, target))
96+
print('Giving up.')
9797
return False
9898

9999

@@ -122,8 +122,8 @@ def CreateWin32Hardlink(filepath, targpath, try_mklink):
122122
shutil.copyfile(targpath, filepath)
123123
return False
124124
except EnvironmentError:
125-
print 'Try %d: Failed hardlink %s -> %s\n' % (cnt, filepath, targpath)
126-
print 'Giving up.'
125+
print('Try %d: Failed hardlink %s -> %s\n' % (cnt, filepath, targpath))
126+
print('Giving up.')
127127
return try_mklink
128128

129129

@@ -170,7 +170,7 @@ def __DumpInfo(self, tarinfo):
170170
if tarinfo.isfile():
171171
typeinfo = 'F'
172172
reable_size = ReadableSizeOf(tarinfo.size)
173-
print '%s %s : %s %s' % (reable_size, typeinfo, tarinfo.name, lnk)
173+
print('%s %s : %s %s' % (reable_size, typeinfo, tarinfo.name, lnk))
174174
return tarinfo
175175

176176
def __AddFile(self, tarinfo, fileobj=None):
@@ -232,7 +232,7 @@ def Add(self, filepath, prefix=None):
232232

233233
# At this point we only allow addition of "FILES"
234234
if not tarinfo.isfile():
235-
print 'Failed to add non real file: %s' % filepath
235+
print('Failed to add non real file: %s' % filepath)
236236
return False
237237

238238
# Now check if it is a Cygwin style link disguised as a file.

0 commit comments

Comments
 (0)