Skip to content

Commit 9421542

Browse files
committed
Enhance Makefile for installing insiders packages with improved error handling and OS-specific commands
1 parent 000d2c6 commit 9421542

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

Makefile

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,31 @@ docs-serve: ## Build and serve the documentation
114114

115115
.PHONY: .docs-insiders-install
116116
.docs-insiders-install: ## Install insiders packages for docs if necessary
117-
ifeq ($(PPPR_TOKEN),)
118-
@echo Error: PPPR_TOKEN is not set, cannot install insiders packages
119-
@exit 1
117+
ifeq ($(DETECTED_OS),Windows)
118+
@powershell -NoProfile -Command " \
119+
$$material = uv pip show mkdocs-material 2>$$null; \
120+
if ($$material -match 'insiders') { \
121+
Write-Host 'insiders packages already installed'; \
122+
} elseif ('$(PPPR_TOKEN)' -eq '') { \
123+
Write-Host 'Error: PPPR_TOKEN is not set, cannot install insiders packages'; \
124+
exit 1; \
125+
} else { \
126+
Write-Host 'installing insiders packages...'; \
127+
uv pip install --reinstall --no-deps --extra-index-url https://pydantic:$(PPPR_TOKEN)@pppr.pydantic.dev/simple/ mkdocs-material mkdocstrings-python; \
128+
} \
129+
"
120130
else
121-
@echo installing insiders packages...
122-
@uv pip install --reinstall --no-deps \
123-
--extra-index-url https://pydantic:${PPPR_TOKEN}@pppr.pydantic.dev/simple/ \
124-
mkdocs-material mkdocstrings-python
131+
ifeq ($(shell uv pip show mkdocs-material | grep -q insiders && echo 'installed'), installed)
132+
@echo 'insiders packages already installed'
133+
else ifeq ($(PPPR_TOKEN),)
134+
@echo "Error: PPPR_TOKEN is not set, can't install insiders packages"
135+
@exit 1
136+
else
137+
@echo 'installing insiders packages...'
138+
@uv pip install --reinstall --no-deps \
139+
--extra-index-url https://pydantic:${PPPR_TOKEN}@pppr.pydantic.dev/simple/ \
140+
mkdocs-material mkdocstrings-python
141+
endif
125142
endif
126143

127144
.PHONY: docs-insiders
@@ -151,7 +168,7 @@ help: ## Show this help (usage: make help)
151168
ifeq ($(DETECTED_OS),Windows)
152169
@echo Usage: make [recipe]
153170
@echo Recipes:
154-
@uv run python -c "import re; [print(f' {m[0]:<20} {m[1]}') for m in re.findall(r'^([a-zA-Z0-9_-]+):.*?## (.*)$$', open('$(MAKEFILE_LIST)').read(), re.MULTILINE)]"
171+
@uv run python -c "import re; [print(f' {m[0]:<20} {m[1]}') for m in re.findall(r'^([a-zA-Z0-9_-]+):.*?## (.*)$$', open('$(MAKEFILE_LIST)').read(), re.MULTILINE)]" || powershell -NoProfile -Command "Get-Content '$(MAKEFILE_LIST)' | Select-String -Pattern '^([a-zA-Z0-9_-]+):.*?## (.*)$$' | ForEach-Object { Write-Host (' {0,-20} {1}' -f $$_.Matches[0].Groups[1].Value, $$_.Matches[0].Groups[2].Value) }"
155172
else
156173
@echo "Usage: make [recipe]"
157174
@echo "Recipes:"

0 commit comments

Comments
 (0)