Skip to content

Commit

Permalink
fix(flask): use rustup snap
Browse files Browse the repository at this point in the history
Fixes #1743
  • Loading branch information
lengau committed Jul 19, 2024
1 parent 51a55f7 commit a8cc2e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 7 additions & 7 deletions charmcraft/extensions/gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ def _get_root_snippet(self) -> dict[str, Any]:
"grafana-dashboard": {"interface": "grafana_dashboard"},
},
"config": {"options": {**self._WEBSERVER_OPTIONS, **self.options}},
"parts": {"charm": {"plugin": "charm", "source": "."}},
"parts": {
"charm": {
"plugin": "charm",
"source": ".",
"build-snaps": ["rustup"], # Needed to build pydantic.
}
}
}

@override
Expand Down Expand Up @@ -225,12 +231,6 @@ def is_experimental(base: tuple[str, ...] | None) -> bool: # noqa: ARG004
"""Check if the extension is in an experimental state."""
return False

@override
def get_parts_snippet(self) -> dict[str, Any]:
"""Return the parts to add to parts."""
# rust is needed to build pydantic-core, a dependency of flask.
return {"flask-framework/rust-deps": {"plugin": "nil", "build-packages": ["cargo"]}}


class DjangoFramework(_GunicornBase):
"""Extension for 12-factor Django applications."""
Expand Down
8 changes: 5 additions & 3 deletions tests/spread/commands/init-flask-framework/task.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
summary: test charmcraft init with flask-framework profile
priority: 500 # This builds pydantic, so do it early
kill-timeout: 45m # Because it builds pydantic, it takes a long time.
systems:
# We only need to run this test once, and it takes a long time.
- ubuntu-22.04-64

execute: |
unset CHARMCRAFT_STORE_API_URL
unset CHARMCRAFT_UPLOAD_URL
unset CHARMCRAFT_REGISTRY_URL
mkdir -p test-init
cd test-init
charmcraft init --profile flask-framework
Expand Down

0 comments on commit a8cc2e3

Please sign in to comment.