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

test: use lxd for python symlink tests, update craft-parts #5273

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies = [
"craft-archives~=2.1",
"craft-cli~=2.15.0",
"craft-grammar>=2.0.1,<3.0.0",
"craft-parts==2.4.1",
"craft-parts==2.6.2",
"craft-platforms~=0.6",
"craft-providers~=2.1",
"craft-store>=3.0.2,<4.0.0",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def main():
print("hello world")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from distutils.core import setup

setup(
name="hello",
version="0.1",
entry_points={"console_scripts": ["hello=hello:main"]},
packages=["hello"],
)
18 changes: 12 additions & 6 deletions tests/spread/plugins/craft-parts/python-symlinks/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,24 @@ environment:
SNAP/strict_gnome_extension: strict-gnome-extension

restore: |
unset SNAPCRAFT_BUILD_ENVIRONMENT
cd "${SNAP}"
snapcraft clean
rm -f ./*.snap
rm -rf ./squashfs-root
execute: |
unset SNAPCRAFT_BUILD_ENVIRONMENT
cd "${SNAP}"
if [ -f expected-symlink ]; then
snapcraft prime
ls -l prime/bin
[ -x prime/bin/hello ]
[ "$(readlink prime/bin/python3)" == "$(cat expected-symlink)" ]
snapcraft pack
unsquashfs ${SNAP}_1.0_amd64.snap
ls -l squashfs-root/bin
[ -x squashfs-root/bin/hello ]
[ "$(readlink squashfs-root/bin/python3)" == "$(cat expected-symlink)" ]
else
snapcraft prime 2>&1 | MATCH "No suitable Python interpreter found, giving up."
fi
snapcraft prime -v 2>&1 | MATCH "No suitable Python interpreter found, giving up."
fi
6 changes: 3 additions & 3 deletions tests/unit/parts/plugins/test_python_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_get_build_commands(plugin, new_dir):
# look for python3.10
basename=$(basename $(readlink -f ${{PARTS_PYTHON_VENV_INTERP_PATH}}))
echo Looking for a Python interpreter called \\"${{basename}}\\" in the payload...
payload_python=$(find "$install_dir" "$stage_dir" -type f -executable -name "${{basename}}" -print -quit 2>/dev/null)
payload_python=$(find "$install_dir" "$stage_dir" -type f -executable -name "${{basename}}" -print -quit 2>/dev/null || true)

if [ -n "$payload_python" ]; then
# We found a provisioned interpreter, use it.
Expand All @@ -94,12 +94,12 @@ def test_get_build_commands(plugin, new_dir):
fi
else
# Otherwise use what _get_system_python_interpreter() told us.
echo "Python interpreter not found in payload."
echo "Python interpreter not found in payload." >&2
symlink_target="/usr/bin/python3.10"
fi

if [ -z "$symlink_target" ]; then
echo "No suitable Python interpreter found, giving up."
echo "No suitable Python interpreter found, giving up." >&2
exit 1
fi

Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading