def executable(self, top, execute=1):
        """Make the specified directory tree executable (execute == 1)
        or not (execute == None).

        This method has no effect on Windows systems, which use a
        completely different mechanism to control file executability.
        """

        if sys.platform == 'win32':
            return

        if execute:
            def do_chmod(fname):
                try: st = os.stat(fname)
                except OSError: pass
                else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|stat.S_IEXEC))
        else:
            def do_chmod(fname):
                try: st = os.stat(fname)
                except __HOLE__: pass
                else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~stat.S_IEXEC))

        if os.path.isfile(top):
            # If it's a file, that's easy, just chmod it.
            do_chmod(top)
        elif execute:
            # It's a directory and we're trying to turn on execute
            # permission, so it's also pretty easy, just chmod the
            # directory and then chmod every entry on our walk down the
            # tree.  Because os.path.walk() is top-down, we'll enable
            # execute permission on any directories that have it disabled
            # before os.path.walk() tries to list their contents.
            do_chmod(top)

            def chmod_entries(arg, dirname, names, do_chmod=do_chmod):
                for n in names:
                    do_chmod(os.path.join(dirname, n))

            os.path.walk(top, chmod_entries, None)
        else:
            # It's a directory and we're trying to turn off execute
            # permission, which means we have to chmod the directories
            # in the tree bottom-up, lest disabling execute permission from
            # the top down get in the way of being able to get at lower
            # parts of the tree.  But os.path.walk() visits things top
            # down, so we just use an object to collect a list of all
            # of the entries in the tree, reverse the list, and then
            # chmod the reversed (bottom-up) list.
            col = Collector(top)
            os.path.walk(top, col, None)
            col.entries.reverse()
            for d in col.entries: do_chmod(d)
dataset/ETHPy150Open adblockplus/gyp/test/lib/TestCmd.py/TestCmd.executable