Esempio n. 1
0
    def generate(self):
        print "generate",
        if sys.argv.count('checkonly') > 0:
            print "(check-only)",
        print self.filename, "...",

        cw = CodeWriter()
        cw.text = self.replacer.replace(CodeWriter(), self.text, self.indent)
        cw.begin_generated(self.generator)
        self.generator(cw)
        cw.end_generated()
        new_text = self.replacer.replace(cw, self.text, self.indent)
        if self.text != new_text:
            if sys.argv.count('checkonly') > 0:
                print "different!"
                name = self.filename + ".diff"
                print "    generated file saved as: " + name
                save_file(name, new_text)
                return False
            else:
                print "updated"
                if sys.argv.count('checkout') > 0:
                    nt.spawnl(0, "tf.exe", "tf.exe", "edit", self.filename)
                save_file(self.filename, new_text)
        else:
            print "ok"

        return True
Esempio n. 2
0
    def generate(self):
        print "generate",
        if sys.argv.count('checkonly') > 0:
            print "(check-only)",
        print self.filename, "...",

        cw = CodeWriter()
        cw.text = self.replacer.replace(CodeWriter(), self.text, self.indent)
        cw.begin_generated(self.generator)
        self.generator(cw)
        cw.end_generated()
        new_text = self.replacer.replace(cw, self.text, self.indent)
        if self.text != new_text:
            if sys.argv.count('checkonly') > 0:
                print "different!"
                name = self.filename + ".diff"
                print "    generated file saved as: " + name
                save_file(name, new_text)
                return False
            else:
                print "updated"
                if sys.argv.count('checkout') > 0:
                    nt.spawnl(0, "tf.exe", "tf.exe", "edit", self.filename)
                save_file(self.filename, new_text)
        else:
            print "ok"

        return True
Esempio n. 3
0
 def test_spawnl(self):
    
     #sanity check
     #CPython nt has no spawnl function
     pint_cmd = ping_cmd = os.path.join(os.environ['windir'], 'system32', 'ping.exe')
     nt.spawnl(nt.P_WAIT, ping_cmd , "ping","127.0.0.1","-n","1")
     nt.spawnl(nt.P_WAIT, ping_cmd , "ping","/?")
     nt.spawnl(nt.P_WAIT, ping_cmd , "ping")
     
     # negative case
     cmd = pint_cmd+"oo"
     self.assertRaises(OSError,nt.spawnl,nt.P_WAIT,cmd,"ping","/?")
Esempio n. 4
0
    def test_spawnl(self):

        #sanity check
        #CPython nt has no spawnl function
        pint_cmd = ping_cmd = os.path.join(os.environ['windir'], 'system32',
                                           'ping.exe')
        nt.spawnl(nt.P_WAIT, ping_cmd, "ping", "127.0.0.1", "-n", "1")
        nt.spawnl(nt.P_WAIT, ping_cmd, "ping", "/?")
        nt.spawnl(nt.P_WAIT, ping_cmd, "ping")

        # negative case
        cmd = pint_cmd + "oo"
        self.assertRaises(OSError, nt.spawnl, nt.P_WAIT, cmd, "ping", "/?")
Esempio n. 5
0
def test_spawnl():
    if is_cli == False:
        return

    #sanity check
    #CPython nt has no spawnl function
    pint_cmd = ping_cmd = get_environ_variable("windir") + "\system32\ping.exe"
    nt.spawnl(nt.P_WAIT, ping_cmd, "ping", "127.0.0.1", "-n", "1")
    nt.spawnl(nt.P_WAIT, ping_cmd, "ping", "/?")
    nt.spawnl(nt.P_WAIT, ping_cmd, "ping")

    # negative case
    cmd = pint_cmd + "oo"
    AssertError(OSError, nt.spawnl, nt.P_WAIT, cmd, "ping", "/?")
Esempio n. 6
0
def test_spawnl():
    if is_cli == False:
        return
    
    #sanity check
    #CPython nt has no spawnl function
    pint_cmd = ping_cmd = get_environ_variable("windir") + "\system32\ping.exe"
    nt.spawnl(nt.P_WAIT, ping_cmd , "ping","127.0.0.1")
    nt.spawnl(nt.P_WAIT, ping_cmd , "ping","/?")
    nt.spawnl(nt.P_WAIT, ping_cmd , "ping")
    
    # negative case
    cmd = pint_cmd+"oo"
    AssertError(OSError,nt.spawnl,nt.P_WAIT,cmd,"ping","/?")