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: fix issues found in common.mk with charmcraft #289

Merged
merged 1 commit into from
Dec 9, 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
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ publish-pypi: clean package-pip lint-twine ##- Publish Python packages to pypi

# Used for installing build dependencies in CI.
.PHONY: install-build-deps
install-build-deps:
install-build-deps: install-lint-build-deps
ifeq ($(shell which apt-get),)
$(warning Cannot install build dependencies without apt.)
else ifeq ($(wildcard /usr/include/libxml2/libxml/xpath.h),)
Expand All @@ -37,3 +37,7 @@ else ifeq ($(wildcard /usr/include/libxslt/xslt.h),)
else ifeq ($(wildcard /usr/share/doc/python3-venv/copyright),)
sudo $(APT) install python3-venv
endif

# If additional build dependencies need installing in order to build the linting env.
.PHONY: install-lint-build-deps
install-lint-build-deps:
12 changes: 6 additions & 6 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ setup-tests: install-uv install-build-deps ##- Set up a testing environment with
uv sync --frozen

.PHONY: setup-lint
setup-lint: install-uv install-shellcheck ##- Set up a linting-only environment
uv sync --frozen --no-dev --no-install-workspace --extra lint --extra types
setup-lint: install-uv install-shellcheck install-lint-build-deps ##- Set up a linting-only environment
uv sync --frozen --no-install-workspace --extra lint --extra types

.PHONY: setup-docs
setup-docs: install-uv ##- Set up a documentation-only environment
Expand All @@ -72,7 +72,7 @@ clean: ## Clean up the development environment
autoformat: format # Hidden alias for 'format'

.PHONY: format-ruff
format-ruff: ##- Automatically format with ruff
format-ruff: install-ruff ##- Automatically format with ruff
success=true
ruff check --fix $(SOURCES) || success=false
ruff format $(SOURCES)
Expand All @@ -83,7 +83,7 @@ format-codespell: ##- Fix spelling issues with codespell
uv run codespell --toml pyproject.toml --write-changes $(SOURCES)

.PHONY: lint-ruff
lint-ruff: ##- Lint with ruff
lint-ruff: install-ruff ##- Lint with ruff
ruff check $(SOURCES)
ruff format --diff $(SOURCES)

Expand All @@ -102,7 +102,7 @@ ifneq ($(shell which pyright),) # Prefer the system pyright
else
# Fix for a bug in npm
[ -d "/home/ubuntu/.npm/_cacache" ] && chown -R 1000:1000 "/home/ubuntu/.npm" || true
uv run pyright
uv run pyright --pythonpath .venv/bin/python
endif

.PHONY: lint-shellcheck
Expand Down Expand Up @@ -198,5 +198,5 @@ else ifneq ($(shell which snap),)
else ifneq ($(shell which brew),)
brew install shellcheck
else
$(warning Codespell not installed. Please install it yourself.)
$(warning Shellcheck not installed. Please install it yourself.)
endif
Loading