def link_lang_spacy(lang, lang_path):
    origin_path = os.path.join(get_package_path('spacy'), 'lang', lang)
    try:
        symlink_to(Path(origin_path), os.path.abspath(lang_path))
        try:
            importlib.import_module('spacy.lang.{}'.format(lang))
            print('link created')
        except Exception as e:
            print('link not created')
            raise e
    except Exception as e:
        print('error to create link to {} from {}'.format(lang, lang_path))
        raise e
示例#2
0
def link_lang_spacy(lang, lang_path):
    origin_path = os.path.join(str(get_package_path("spacy").resolve()),
                               "lang", lang)
    try:
        symlink_to(Path(origin_path), os.path.abspath(lang_path))
        try:
            importlib.import_module("spacy.lang.{}".format(lang))
            print("link created")
        except Exception as e:
            print("link not created")
            raise e
    except Exception as e:
        print("error to create link to {} from {}".format(lang, lang_path))
        raise e
示例#3
0
def test_create_symlink_windows(symlink_setup_target, symlink_target, symlink,
                                is_admin):
    """Test the creation of symlinks on windows. If run as admin or not on windows it should succeed, otherwise a CalledProcessError should be raised."""
    assert symlink_target.exists()

    if is_admin or not is_windows:
        try:
            symlink_to(symlink, symlink_target)
            assert symlink.exists()
        except CalledProcessError as e:
            pytest.fail(e)
    else:
        with pytest.raises(CalledProcessError):
            symlink_to(symlink, symlink_target)

        assert not symlink.exists()
示例#4
0
def test_create_symlink_windows(
    symlink_setup_target, symlink_target, symlink, is_admin
):
    """Test the creation of symlinks on windows. If run as admin or not on windows it should succeed, otherwise a CalledProcessError should be raised."""
    assert symlink_target.exists()

    if is_admin or not is_windows:
        try:
            symlink_to(symlink, symlink_target)
            assert symlink.exists()
        except CalledProcessError as e:
            pytest.fail(e)
    else:
        with pytest.raises(CalledProcessError):
            symlink_to(symlink, symlink_target)

        assert not symlink.exists()
示例#5
0
def test_create_symlink_windows(symlink_setup_target, symlink_target, symlink):
    assert symlink_target.exists()
    symlink_to(symlink, symlink_target)
    assert symlink.exists()