

def execute(self):
    targets = self.context.targets(self.is_zipaligntarget)
    for target in targets:

        def get_products_path(target):
            "Get path of target's apks that are signed with release keystores by SignApk task."
            apks = self.context.products.get('release_apk')
            packages = apks.get(target)
            if packages:
                for (tgts, products) in packages.items():
                    for prod in products:
                        (yield os.path.join(tgts, prod))
        packages = list(get_products_path(target))
        for package in packages:
            safe_mkdir(self.zipalign_out(target))
            args = self._render_args(package, target)
            with self.context.new_workunit(name='zipalign', labels=[WorkUnitLabel.MULTITOOL]) as workunit:
                returncode = subprocess.call(args, stdout=workunit.output('stdout'), stderr=workunit.output('stderr'))
                if returncode:
                    raise TaskError('The zipalign process exited non-zero: {0}'.format(returncode))

dataset/ETHPy150Open pantsbuild/pants/contrib/android/src/python/pants/contrib/android/tasks/zipalign.py Zipalign.execute/original