Beispiel #1
0
def register_thermo_com_net(path):
    '''Register a bundle of Thermo's RawFileReader library's DLLs. The `--path` option can
    be used to specify additional search paths.
    '''
    if path is None:
        path = []
    try:
        import clr
    except ImportError:
        click.secho("pythonnet not installed", fg='yellow')
        raise click.ClickException(
            "This feature requires the pythonnet library. Please install it.")
    from ms_deisotope.data_source.thermo_raw_net import _register_dll, _RawFileReader
    from ms_deisotope.data_source.thermo_raw_net import determine_if_available
    if _RawFileReader:
        click.secho("DLL Already Registered and Loaded")
        return
    result = _register_dll(path)
    if result:
        click.secho("DLL Registration Successful")
        if determine_if_available():
            click.secho("DLL Load Succesful", fg='cyan')
            if path is not None:
                config = get_config()
                rest = sorted(set(path) - set(config['vendor_readers']['thermo-net']))
                config['vendor_readers']['thermo-net'].extend(rest)
                save_config(config)
        else:
            click.secho("DLL Load Unsuccessful", fg='red')
    else:
        click.secho("DLL Registration Unsuccessful")
def register_waters_masslynx(path):
    if path is None:
        path = []
    from ms_deisotope.data_source._vendor.masslynx import libload
    path = list(map(os.path.abspath, path))
    result = libload._register_dll(path)
    if result:
        click.secho("DLL Registration Successful")
        out = libload.determine_if_available()
        if out:
            click.secho("DLL Load Succesful", fg='cyan')
            if path is not None:
                config = get_config()
                config.setdefault('vendor_readers', {})
                config['vendor_readers'].setdefault("waters-masslynx", [])
                rest = sorted(
                    set(path) - set(
                        config.get('vendor_readers', {}).get(
                            'waters-masslynx', [])))
                config['vendor_readers']['waters-masslynx'].extend(rest)
                save_config(config)
        else:
            click.secho("DLL Load Unsuccessful", fg='red')
    else:
        click.secho("DLL Registration Unsuccessful")
Beispiel #3
0
def register_thermo_com(path=None):
    '''Register an installed MSFileReader or XRawFile DLL. Searches the standard installation
    paths, but the `--path` option can be used to specify additional search paths.
    '''
    if path is None:
        path = []
    try:
        import comtypes
    except ImportError:
        click.secho("comtypes not installed", fg='yellow')
        raise click.ClickException(
            "This feature requires the comtypes library. Please install it.")
    import logging
    from ms_deisotope.data_source._vendor.MSFileReader import _register_dll, log, DLL_IS_LOADED
    from ms_deisotope.data_source.thermo_raw import determine_if_available
    if DLL_IS_LOADED:
        click.secho("DLL Already Registered and Loaded")
        return
    if log is not None:
        log.addHandler(logging.StreamHandler())
        log.setLevel('DEBUG')
    result = _register_dll(path)
    if result:
        click.secho("DLL Registration Successful")
        if determine_if_available():
            click.secho("DLL Load Succesful", fg='cyan')
            if path is not None:
                config = get_config()
                config['vendor_readers']['thermo-com'].extend(path)
                save_config(config)
        else:
            click.secho("DLL Load Unsuccessful", fg='red')
    else:
        click.secho("DLL Registration Unsuccessful")
    if log is not None:
        log.handlers = log.handlers[:-1]