summaryrefslogtreecommitdiffstats
path: root/scripts/cleanup-workdir
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-30 18:14:46 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-01 12:47:10 +0100
commit2e388048b61f6029bae1913cbb546ac40b9cfe51 (patch)
tree8fa0fc951caab1430636fca971c27a7e7beb45ce /scripts/cleanup-workdir
parent79be110c1fdfd0affe6a310b96e7107c4549d23c (diff)
downloadpoky-2e388048b61f6029bae1913cbb546ac40b9cfe51.tar.gz
scripts: python3: Use print function
Used print function instead of print statement to make the code work in python 3. (From OE-Core rev: 80fecc44761fa38ccf2e4dc6897b9f1f0c9c1ed0) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/cleanup-workdir')
-rwxr-xr-xscripts/cleanup-workdir16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/cleanup-workdir b/scripts/cleanup-workdir
index 01ebd526e3..fee464c31d 100755
--- a/scripts/cleanup-workdir
+++ b/scripts/cleanup-workdir
@@ -27,7 +27,7 @@ obsolete_dirs = []
27parser = None 27parser = None
28 28
29def err_quit(msg): 29def err_quit(msg):
30 print msg 30 print(msg)
31 parser.print_usage() 31 parser.print_usage()
32 sys.exit(1) 32 sys.exit(1)
33 33
@@ -43,7 +43,7 @@ def run_command(cmd):
43 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) 43 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
44 output = pipe.communicate()[0] 44 output = pipe.communicate()[0]
45 if pipe.returncode != 0: 45 if pipe.returncode != 0:
46 print "Execute command '%s' failed." % cmd 46 print("Execute command '%s' failed." % cmd)
47 sys.exit(1) 47 sys.exit(1)
48 return output 48 return output
49 49
@@ -84,7 +84,7 @@ will be deleted. Be CAUTIOUS.""")
84 if os.getcwd() != builddir: 84 if os.getcwd() != builddir:
85 err_quit("Please run %s under: %s\n" % (os.path.basename(args[0]), builddir)) 85 err_quit("Please run %s under: %s\n" % (os.path.basename(args[0]), builddir))
86 86
87 print 'Updating bitbake caches...' 87 print('Updating bitbake caches...')
88 cmd = "bitbake -s" 88 cmd = "bitbake -s"
89 output = run_command(cmd) 89 output = run_command(cmd)
90 90
@@ -129,13 +129,13 @@ will be deleted. Be CAUTIOUS.""")
129 129
130 # won't fail just in case 130 # won't fail just in case
131 if not tmpdir or not image_rootfs: 131 if not tmpdir or not image_rootfs:
132 print "Can't get TMPDIR or IMAGE_ROOTFS." 132 print("Can't get TMPDIR or IMAGE_ROOTFS.")
133 return 1 133 return 1
134 134
135 pattern = tmpdir + '/(.*?)/(.*?)/' 135 pattern = tmpdir + '/(.*?)/(.*?)/'
136 m = re.match(pattern, image_rootfs) 136 m = re.match(pattern, image_rootfs)
137 if not m: 137 if not m:
138 print "Can't get WORKDIR." 138 print("Can't get WORKDIR.")
139 return 1 139 return 1
140 140
141 workdir = os.path.join(tmpdir, m.group(1)) 141 workdir = os.path.join(tmpdir, m.group(1))
@@ -178,13 +178,13 @@ will be deleted. Be CAUTIOUS.""")
178 break 178 break
179 179
180 for d in obsolete_dirs: 180 for d in obsolete_dirs:
181 print "Deleting %s" % d 181 print("Deleting %s" % d)
182 shutil.rmtree(d, True) 182 shutil.rmtree(d, True)
183 183
184 if len(obsolete_dirs): 184 if len(obsolete_dirs):
185 print '\nTotal %d items.' % len(obsolete_dirs) 185 print('\nTotal %d items.' % len(obsolete_dirs))
186 else: 186 else:
187 print '\nNo obsolete directory found under %s.' % workdir 187 print('\nNo obsolete directory found under %s.' % workdir)
188 188
189 return 0 189 return 0
190 190