Skip to content

Commit

Permalink
fix: fix issues found in common.mk with charmcraft (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau authored Dec 9, 2024
1 parent d956942 commit 0ffe5a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
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

0 comments on commit 0ffe5a7

Please sign in to comment.