(self, script_name, contents, mode="t", blockers=())
Write an executable file to the scripts directory
Write an executable file to the scripts directory
Write an executable file to the scripts directory
def write_script(self, script_name, contents, mode="t", blockers=()):
        """Write an executable file to the scripts directory"""
        self.delete_blockers(  # clean up old .py/.pyw w/o a script
            [os.path.join(self.script_dir, x) for x in blockers]
        )
        log.info("Installing %s script to %s", script_name, self.script_dir)
        target = os.path.join(self.script_dir, script_name)
        self.add_output(target)

        if self.dry_run:
            return

        mask = current_umask()
        ensure_directory(target)
        if os.path.exists(target):
            os.unlink(target)
        with open(target, "w" + mode) as f:
            f.write(contents)
        chmod(target, 0o777 - mask)
def write_script ( self , script_name , contents , mode = "t" , blockers = ( ) ) : self . delete_blockers ( # clean up old .py/.pyw w/o a script [ os . path . join ( self . script_dir , x ) for x in blockers ] ) log . info ( "Installing %s script to %s" , script_name , self . script_dir ) target = os . path . join ( self . script_dir , script_name ) self . add_output ( target ) if self . dry_run : return mask = current_umask ( ) ensure_directory ( target ) if os . path . exists ( target ) : os . unlink ( target ) with open ( target , "w" + mode ) as f : f . write ( contents ) chmod ( target , 0o777 - mask )