Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Python 3.12 compatibility - module attribute on EntryPoint #13

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/qemu_runner/make_runner/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def load_layers_from_all_search_paths(layer_names: List[str]) -> List[str]:
eps = importlib.metadata.entry_points(group='qemu_runner_layer_packages')

for ep in eps:
packages.append(ep.module_name)
module_name = getattr(ep, 'module', None)
if module_name is None:
module_name = ep.module_name
packages.append(module_name)

return [load_layer(layer, packages=packages) for layer in layer_names]

Expand Down
15 changes: 2 additions & 13 deletions tests/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ def install_script(builder: venv.EnvBuilder, context, name, url):
os.unlink(distpath)


def install_setuptools(builder: venv.EnvBuilder, context):
subprocess.run([context.env_exe, '-m', 'pip', 'install', 'setuptools'], check=True)


@pytest.fixture()
def venv_py(tmp_path: Path) -> Path:
venv_dir = tmp_path / 'venv'
Expand All @@ -41,9 +37,6 @@ def create_venv(venv_dir: Path):
builder = venv.EnvBuilder(with_pip=True)
builder.create(venv_dir)
ctx = builder.ensure_directories(venv_dir)
# builder.create_configuration(ctx)
# builder.setup_python(ctx)
install_setuptools(builder, ctx)
return Path(ctx.env_exe)


Expand All @@ -64,12 +57,8 @@ def make_runner(python: Path, args: List[str], cwd: Path):


def install_dev_package(python: Path, pkg: Path):
cp = subprocess.run([
python,
pkg / 'setup.py',
'-q',
'install'
],
cp = subprocess.run(
[python, '-m', 'pip', 'install', '-q', pkg],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding='utf-8',
Expand Down
3 changes: 0 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ python =
3.12: py312, mypy

[testenv]
;download = true
;recreate = true
;alwayscopy = true
deps = pytest
commands = pytest tests
Loading