This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new ea4ca697d9 [DOCS] Improve Makefile by Using requirements-docs.txt for
Documentation Dependencies (#1808)
ea4ca697d9 is described below
commit ea4ca697d90f947afb628a1e83b1eb395ca1470e
Author: Max Base <[email protected]>
AuthorDate: Wed Feb 12 23:06:24 2025 +0100
[DOCS] Improve Makefile by Using requirements-docs.txt for Documentation
Dependencies (#1808)
* Update Makefile
* Create requirements-docs.txt
* Update Makefile
* Update Makefile
* Update Makefile
---
Makefile | 66 +++++++++++++++++++++++++++++++++++----------------
requirements-docs.txt | 6 +++++
2 files changed, 51 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
index 9ca0c1e00b..274707936a 100644
--- a/Makefile
+++ b/Makefile
@@ -15,29 +15,53 @@
# specific language governing permissions and limitations
# under the License.
-check :
+PYTHON := $(shell command -v python || command -v python3 || echo python)
+PIP := $(PYTHON) -m pip
+MKDOCS := mkdocs
+MIKE := mike
+
+.PHONY: check checkinstall checkupdate install docsinstall docsbuild clean test
+
+check:
+ @echo "Running pre-commit checks..."
+ @if ! command -v pre-commit >/dev/null 2>&1; then \
+ echo "Error: pre-commit is not installed. Run 'make
checkinstall' first."; \
+ exit 1; \
+ fi
pre-commit run --all-files
-.PHONY : check
-checkinstall :
+checkinstall:
+ @echo "Installing pre-commit..."
+ @if ! command -v pre-commit >/dev/null 2>&1; then \
+ $(PIP) install pre-commit; \
+ fi
pre-commit install
-.PHONY : checkinstall
-checkupdate :
+checkupdate: checkinstall
+ @echo "Updating pre-commit hooks..."
pre-commit autoupdate
-.PHONY : checkupdate
-
-docsinstall :
- pip install mkdocs
- pip install mkdocs-jupyter
- pip install mkdocs-material
- pip install mkdocs-macros-plugin
- pip install mkdocs-git-revision-date-localized-plugin
- pip install mike
-.PHONY : docsinstall
-
-docsbuild : docsinstall
- mkdocs build
- mike deploy --update-aliases latest-snapshot -b website -p
- mike serve
-.PHONY : docsbuild
+
+install:
+ @echo "Installing dependencies..."
+ @if [ -f requirements.txt ]; then \
+ $(PIP) install -r requirements.txt; \
+ else \
+ echo "Error: requirements.txt not found."; \
+ exit 1; \
+ fi
+
+docsinstall:
+ @echo "Installing documentation dependencies..."
+ $(PIP) install -r requirements-docs.txt
+
+docsbuild: docsinstall
+ @echo "Building documentation..."
+ $(MKDOCS) build
+ $(MIKE) deploy --update-aliases latest-snapshot -b website -p
+ $(MIKE) serve
+
+clean:
+ @echo "Cleaning up generated files... (TODO)"
+ rm -rf __pycache__
+ rm -rf .mypy_cache
+ rm -rf .pytest_cache
diff --git a/requirements-docs.txt b/requirements-docs.txt
new file mode 100644
index 0000000000..f3015888b4
--- /dev/null
+++ b/requirements-docs.txt
@@ -0,0 +1,6 @@
+mkdocs
+mkdocs-jupyter
+mkdocs-material
+mkdocs-macros-plugin
+mkdocs-git-revision-date-localized-plugin
+mike