-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix local plugin installation (#1129)
* test: add test for lektor.packages.install_local_package * fix(packages): fix local plugin installation The most recent version of pip (23.1) removes support for the `--install-option` parameter to `pip install`. This breaks our `install_local_package` function, which uses `--install-option` because `pip install --target` didn't used to work with `pip install --editable`. As it turns out, recent versions of pip support the use of `--target` with `--editable`. So here we make use of that. Note that this also relieves us of the need to parse our local plugin requirements ourselves (thus, hopefully, fixing #865.)
- Loading branch information
Showing
6 changed files
with
54 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""Dummy test plugin""" | ||
from lektor.pluginsystem import Plugin | ||
|
||
|
||
class DummyPlugin(Plugin): | ||
"""Dummy test plugin.""" | ||
|
||
# pylint: disable=too-few-public-methods | ||
name = "dummy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
name="lektor-dummy-plugin", | ||
description="setup.py test plugin", | ||
version="0.1a42", | ||
py_modules=["lektor_dummy_plugin"], | ||
entry_points={ | ||
"lektor.plugins": [ | ||
"dummy-plugin = lektor_dummy_plugin:DummyPlugin", | ||
] | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from lektor.packages import add_site | ||
from lektor.packages import install_local_package | ||
from lektor.pluginsystem import load_plugins | ||
|
||
|
||
@pytest.mark.usefixtures("save_sys_path") | ||
def test_install_local_package(tmp_path): | ||
package_root = os.fspath(tmp_path / "package_root") | ||
dummy_plugin_path = os.fspath(Path(__file__).parent / "setup_py-dummy-plugin") | ||
install_local_package(package_root, dummy_plugin_path) | ||
add_site(package_root) | ||
plugins = load_plugins() | ||
assert plugins["dummy-plugin"].name == "dummy" |