Changeset 1478 for trunk/peppy/major.py

Show
Ignore:
Timestamp:
07/09/08 16:10:31 (5 months ago)
Author:
rob
Message:

Added bangpathModificationHook to JobControlMixin?
* scripts are not run by directly executing them any more -- the bangpath line is parsed out and used as the command line
* python mode now adds '-u' to the bang path if it doesn't exist

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/peppy/major.py

    r1470 r1478  
    10101010                                       script, self.getScriptArgs()) 
    10111011            else: 
    1012                 mode = os.stat(script)[stat.ST_MODE] | stat.S_IXUSR 
    1013                 os.chmod(script, mode) 
    1014              
     1012                # Rather than calling the script directly, simulate how the 
     1013                # operating system uses the bangpath by calling the bangpath 
     1014                # program with the path to the script supplied as the argument 
    10151015                script = script.replace(' ', '\ ') 
    1016                 cmd = "%s %s" % (script, self.getScriptArgs()) 
     1016                cmd = "%s %s %s" % (bangpath, script, self.getScriptArgs()) 
    10171017        else: 
    10181018            interpreter = self.classprefs.interpreter_exe 
     
    10271027            cmd = "%s %s %s %s" % (interpreter, self.getInterpreterArgs(), 
    10281028                                   script, self.getScriptArgs()) 
    1029         dprint(cmd) 
     1029        #dprint(cmd) 
    10301030        return cmd 
     1031     
     1032    def bangpathModificationHook(self, path): 
     1033        """Hook method to modify the bang path as read from the first line in 
     1034        the script. 
     1035         
     1036        Note that the passed-in string will have already had the "#!" characters 
     1037        stripped off, so only the pathname and arguments will exist. 
     1038        """ 
     1039        return path 
    10311040         
    10321041    def startInterpreter(self, argstring=None): 
     
    10431052        first = self.GetLine(0) 
    10441053        if first.startswith("#!"): 
    1045             bangpath = first[2:] 
     1054            bangpath = self.bangpathModificationHook(first[2:].rstrip()) 
    10461055             
    10471056        msg = None