diff options
Diffstat (limited to 'import-layers/yocto-poky/scripts/cleanup-workdir')
-rwxr-xr-x | import-layers/yocto-poky/scripts/cleanup-workdir | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/import-layers/yocto-poky/scripts/cleanup-workdir b/import-layers/yocto-poky/scripts/cleanup-workdir index 01ebd526e..98769f6b3 100755 --- a/import-layers/yocto-poky/scripts/cleanup-workdir +++ b/import-layers/yocto-poky/scripts/cleanup-workdir @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2012 Wind River Systems, Inc. # @@ -27,7 +27,7 @@ obsolete_dirs = [] parser = None def err_quit(msg): - print msg + print(msg) parser.print_usage() sys.exit(1) @@ -43,19 +43,19 @@ def run_command(cmd): pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) output = pipe.communicate()[0] if pipe.returncode != 0: - print "Execute command '%s' failed." % cmd + print("Execute command '%s' failed." % cmd) sys.exit(1) - return output + return output.decode('utf-8') def get_cur_arch_dirs(workdir, arch_dirs): pattern = workdir + '/(.*?)/' - cmd = "bitbake -e | grep ^SDK_ARCH=" + cmd = "bitbake -e | grep ^SDK_SYS=" output = run_command(cmd) - sdk_arch = output.split('"')[1] + sdk_sys = output.split('"')[1] # select thest 5 packages to get the dirs of current arch - pkgs = ['hicolor-icon-theme', 'base-files', 'acl-native', 'binutils-crosssdk-' + sdk_arch, 'nativesdk-autoconf'] + pkgs = ['hicolor-icon-theme', 'base-files', 'acl-native', 'binutils-crosssdk-' + sdk_sys, 'nativesdk-autoconf'] for pkg in pkgs: cmd = "bitbake -e " + pkg + " | grep ^IMAGE_ROOTFS=" @@ -84,7 +84,7 @@ will be deleted. Be CAUTIOUS.""") if os.getcwd() != builddir: err_quit("Please run %s under: %s\n" % (os.path.basename(args[0]), builddir)) - print 'Updating bitbake caches...' + print('Updating bitbake caches...') cmd = "bitbake -s" output = run_command(cmd) @@ -129,13 +129,13 @@ will be deleted. Be CAUTIOUS.""") # won't fail just in case if not tmpdir or not image_rootfs: - print "Can't get TMPDIR or IMAGE_ROOTFS." + print("Can't get TMPDIR or IMAGE_ROOTFS.") return 1 pattern = tmpdir + '/(.*?)/(.*?)/' m = re.match(pattern, image_rootfs) if not m: - print "Can't get WORKDIR." + print("Can't get WORKDIR.") return 1 workdir = os.path.join(tmpdir, m.group(1)) @@ -178,13 +178,13 @@ will be deleted. Be CAUTIOUS.""") break for d in obsolete_dirs: - print "Deleting %s" % d + print("Deleting %s" % d) shutil.rmtree(d, True) if len(obsolete_dirs): - print '\nTotal %d items.' % len(obsolete_dirs) + print('\nTotal %d items.' % len(obsolete_dirs)) else: - print '\nNo obsolete directory found under %s.' % workdir + print('\nNo obsolete directory found under %s.' % workdir) return 0 |