Пример #1
0
def rip(driveLetter, movieName):
    out = Path.Combine(Path.GetTempPath(), movieName)
    # for debugging
    if True:
        return Directory.GetFiles(out)[0]

    print("Saving to: '%s'" % out)

    if not os.path.exists(out):
        os.makedirs(out)

    p = Process()
    p.StartInfo.UseShellExecute = False
    #p.StartInfo.RedirectStandardOutput = True
    p.StartInfo.FileName = "makemkvcon"
    p.StartInfo.Arguments = '--minlength=2700 mkv disc:0 all "%s"' % out
    print("Saving to: '%s'" % out)
    print(p.StartInfo.Arguments)
    if p.Start():
        print("Ripping")
        p.WaitForExit()
        if p.ExitCode == 0:
            print("Successfully ripped %s" % movieName)

            return Directory.GetFiles(out)[0]
        else:
            print("Error: %d" % p.ExitCode)
    else:
        print("Error ripping, quitting")
Пример #2
0
def genPeverifyInteropAsm(file):
    #if this isn't a test run that will invoke peverify there's no point in
    #continuing
    if not is_peverify_run:
        return
    else:
        mod_name = file.rsplit("\\", 1)[1].split(".py")[0]
        print "Generating interop assemblies for the", mod_name, "test module which are needed in %TEMP% by peverify..."
        from System.IO import Path
        tempDir = Path.GetTempPath()
        cwd = nt.getcwd()

    #maps COM interop test module names to a list of DLLs
    module_dll_dict = {
        "excel": [],
        "msagent": [agentsvr_path],
        "scriptpw": [scriptpw_path],
        "word": [],
    }

    dlrcomlib_list = [
        "dlrcomserver",
        "paramsinretval",
        "method",
        "obj",
        "prop",
    ]
    if is_cli32:
        temp_name = testpath.rowan_root + "\\Test\\DlrComLibrary\\Debug\\DlrComLibrary.dll"
    else:
        temp_name = testpath.rowan_root + "\\Test\\DlrComLibrary\\x64\\Release\\DlrComLibrary.dll"
    for mod_name in dlrcomlib_list:
        module_dll_dict[mod_name] = [temp_name]

    if not file_exists_in_path("tlbimp.exe"):
        print "ERROR: tlbimp.exe is not in the path!"
        sys.exit(1)

    try:
        if not module_dll_dict.has_key(mod_name):
            print "WARNING: cannot determine which interop assemblies to install!"
            print "         This may affect peverify runs adversely."
            print
            return

        else:
            nt.chdir(tempDir)

            for com_dll in module_dll_dict[mod_name]:
                if not file_exists(com_dll):
                    print "\tERROR: %s does not exist!" % (com_dll)
                    continue

                print "\trunning tlbimp on", com_dll
                run_tlbimp(com_dll)

    finally:
        nt.chdir(cwd)
    def setUp(self):
        super(SuperConsoleTest, self).setUp()

        import clr
        if is_netstandard:
            clr.AddReference("System.Diagnostics.Process")
            clr.AddReference("System.IO.FileSystem")

        #if this is a debug build and the assemblies are being saved...peverify is run.
        #for the test to pass, Maui assemblies must be in the AssembliesDir
        if is_peverify_run:
            AddReferenceToDlrCore()
            clr.AddReference("Microsoft.Scripting")
            from Microsoft.Scripting.Runtime import ScriptDomainManager
            from System.IO import Path

            tempMauiDir = Path.GetTempPath()

            print "Copying Maui.Core.dll to %s for peverify..." % (tempMauiDir)
            if not File.Exists(tempMauiDir + '\\Maui.Core.dll'):
                File.Copy(
                    testpath.rowan_root +
                    '\\Util\\Internal\\Maui_old\\Maui.Core.dll',
                    tempMauiDir + '\\Maui.Core.dll')

        #Cleanup the last run
        for t_name in ['ip_session.log', 'ip_session_stderr.log']:
            if File.Exists(t_name):
                File.Delete(t_name)
            Assert(not File.Exists(t_name))

        sys.path.append(testpath.rowan_root + '\\Util\\Internal\\Maui_old')
        try:
            clr.AddReference('Maui.Core.dll')
        except:
            print "test_superconsole.py failed: cannot load Maui.Core assembly"
            sys.exit(int(is_snap))

        from Maui.Core import App
        proc = Process()
        proc.StartInfo.FileName = sys.executable
        proc.StartInfo.WorkingDirectory = testpath.rowan_root + '\\Languages\\IronPython\\Tests'
        proc.StartInfo.Arguments = '-X:TabCompletion -X:AutoIndent -X:ColorfulConsole'
        proc.StartInfo.UseShellExecute = True
        proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        proc.StartInfo.CreateNoWindow = False
        started = proc.Start()

        try:
            superConsole = App(proc.Id)
        except Exception as e:
            print "test_superconsole.py failed: cannot initialize App object (probably running as service, or in minimized remote window)"
            print "On VSLGO-MAUI machines close all remote desktop sessions using EXIT command on desktop!"
            proc.Kill()
            sys.exit(1)

        superConsole.SendKeys('from pretest import *{ENTER}')
from System.IO import Path, File, StreamWriter
from Spotfire.Dxp.Application.Visuals import TablePlot
 
#Temp file for storing the table data
tempFolder = Path.GetTempPath()
tempFilename = Path.GetTempFileName()

#Export table data to the temp file
writer = StreamWriter(tempFilename)
vTable.As[TablePlot]().ExportText(writer)

print tempFilename
Пример #5
0
from System.Diagnostics import Process, ProcessWindowStyle
from System.IO import File
import clr

#------------------------------------------------------------------------------
#--Globals

#if this is a debug build and the assemblies are being saved...peverify is run.
#for the test to pass, Maui assemblies must be in the AssembliesDir
if is_peverify_run:
    AddReferenceToDlrCore()
    clr.AddReference("Microsoft.Scripting")
    from Microsoft.Scripting.Runtime import ScriptDomainManager
    from System.IO import Path

    tempMauiDir = Path.GetTempPath()

    print "Copying Maui.Core.dll to %s for peverify..." % (tempMauiDir)
    if not File.Exists(tempMauiDir + '\\Maui.Core.dll'):
        File.Copy(
            testpath.rowan_root +
            '\\Languages\\IronPython\\External\\Maui\\Maui.Core.dll',
            tempMauiDir + '\\Maui.Core.dll')

#Cleanup the last run
for t_name in ['ip_session.log', 'ip_session_stderr.log']:
    if File.Exists(t_name):
        File.Delete(t_name)
    Assert(not File.Exists(t_name))

Пример #6
0
def f3(arg0, arg1, arg2, *arg3): return "same## %s %s %s %s" % (arg0, arg1, arg2, arg3)

if is_cli: 
    from iptest.process_util import run_csc 
    run_csc("/nologo /target:library /out:sbs_library.dll sbs_library.cs")
    import clr
    clr.AddReference("sbs_library")
    from SbsTest import C
    o = C()
    g1 = o.M1
    g2 = o.M2
    g3 = o.M3
    
    #for peverify runs
    from System.IO import Path, File, Directory
    if File.Exists(Path.GetTempPath() + r"\sbs_library.dll"):
        try:
            File.Delete(Path.GetTempPath() + r"\sbs_library.dll")
        except:
            pass
    if not File.Exists(Path.GetTempPath() + r"\sbs_library.dll"):
        File.Copy(Directory.GetCurrentDirectory() + r"\sbs_library.dll", Path.GetTempPath() + r"\sbs_library.dll")
    
else:
    g1 = f1
    g2 = f2
    g3 = f3

# combinations
choices = [(), (0,), (1,), (2,), (3,), (0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3), (0, 1, 2), (0, 1, 3), (0, 2, 3), (1, 2, 3), (0, 1, 2, 3) ]
Пример #7
0
def f3(arg0, arg1, arg2, *arg3): return "same## %s %s %s %s" % (arg0, arg1, arg2, arg3)

if is_cli:
    from iptest.process_util import run_csc 
    run_csc("/nologo /target:library /out:sbs_library.dll sbs_library.cs")
    import clr
    clr.AddReferenceToFile("sbs_library.dll")
    from SbsTest import C
    o = C()
    g1 = o.M1
    g2 = o.M2
    g3 = o.M3
    
    #for peverify runs
    from System.IO import Path, File, Directory
    if File.Exists(Path.Combine(Path.GetTempPath(), "sbs_library.dll")):
        try:
            File.Delete(Path.Combine(Path.GetTempPath(), "sbs_library.dll"))
        except:
            pass
    if not File.Exists(Path.Combine(Path.GetTempPath(), "sbs_library.dll")):
        File.Copy(Path.Combine(Directory.GetCurrentDirectory(), "sbs_library.dll"), Path.Combine(Path.GetTempPath(), "sbs_library.dll"))
    
else:
    g1 = f1
    g2 = f2
    g3 = f3

# combinations
choices = [(), (0,), (1,), (2,), (3,), (0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3), (0, 1, 2), (0, 1, 3), (0, 2, 3), (1, 2, 3), (0, 1, 2, 3) ]
Пример #8
0

if is_cli:
    from iptest.process_util import run_csc
    run_csc("/nologo /target:library /out:sbs_library.dll sbs_library.cs")
    import clr
    clr.AddReference("sbs_library")
    from SbsTest import C
    o = C()
    g1 = o.M1
    g2 = o.M2
    g3 = o.M3

    #for peverify runs
    from System.IO import Path, File, Directory
    if File.Exists(Path.GetTempPath() + r"\sbs_library.dll"):
        try:
            File.Delete(Path.GetTempPath() + r"\sbs_library.dll")
        except:
            pass
    if not File.Exists(Path.GetTempPath() + r"\sbs_library.dll"):
        File.Copy(Directory.GetCurrentDirectory() + r"\sbs_library.dll",
                  Path.GetTempPath() + r"\sbs_library.dll")

else:
    g1 = f1
    g2 = f2
    g3 = f3

# combinations
choices = [(), (0, ), (1, ), (2, ), (3, ), (0, 1), (0, 2), (0, 3), (1, 2),
Пример #9
0
if is_cli:
    from iptest.process_util import run_csc
    run_csc("/nologo /target:library /out:sbs_library.dll sbs_library.cs")
    import clr
    clr.AddReferenceToFile("sbs_library.dll")
    from SbsTest import C
    o = C()
    g1 = o.M1
    g2 = o.M2
    g3 = o.M3

    #for peverify runs
    if clr.IsNetStandard:
        clr.AddReference("System.IO.FileSystem")
    from System.IO import Path, File, Directory
    if File.Exists(Path.Combine(Path.GetTempPath(), "sbs_library.dll")):
        try:
            File.Delete(Path.Combine(Path.GetTempPath(), "sbs_library.dll"))
        except:
            pass
    if not File.Exists(Path.Combine(Path.GetTempPath(), "sbs_library.dll")):
        File.Copy(
            Path.Combine(Directory.GetCurrentDirectory(), "sbs_library.dll"),
            Path.Combine(Path.GetTempPath(), "sbs_library.dll"))

else:
    g1 = f1
    g2 = f2
    g3 = f3

# combinations