-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (137 loc) · 4.63 KB
/
Makefile
File metadata and controls
151 lines (137 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# CAT12 BIDS Pipeline Makefile
# Provides convenient commands for installation, testing, and usage
.PHONY: help install test clean activate example dev-install lint format format-check
# Optional MATLAB path for install-matlab
ifdef MATLAB_PATH
MATLAB_PATH_FLAG = --matlab-path $(MATLAB_PATH)
endif
# Default target
help:
@echo "CAT12 BIDS Pipeline - Available Commands"
@echo "========================================"
@echo ""
@echo "Setup and Installation:"
@echo " install - Install CAT12 standalone and Python dependencies"
@echo " install-matlab - Install CAT12 for existing MATLAB installation"
@echo " (Optional: MATLAB_PATH=/path/to/matlab)"
@echo " test - Run installation tests"
@echo " activate - Show how to activate the environment"
@echo ""
@echo "Development:"
@echo " dev-install - Install development dependencies"
@echo " lint - Run code linting"
@echo " format-check- Check formatting (advisory)"
@echo " format - Format code with black and isort"
@echo ""
@echo "Usage:"
@echo " example - Show usage examples"
@echo " clean - Clean temporary files"
@echo ""
@echo "To get started:"
@echo " 1. make install (or make install-matlab)"
@echo " 2. make test"
@echo " 3. make activate"
# Installation
install:
@echo "Installing CAT12 standalone and dependencies..."
@chmod +x scripts/install_cat12_standalone.sh
@./scripts/install_cat12_standalone.sh
install-matlab:
@echo "Installing CAT12 for existing MATLAB..."
@chmod +x scripts/install_cat12_matlab.sh
@./scripts/install_cat12_matlab.sh $(MATLAB_PATH_FLAG)
@echo "Installing Python dependencies..."
@if [ -f ".venv/bin/activate" ]; then \
. .venv/bin/activate && \
uv pip install -r requirements.txt; \
else \
uv venv .venv && \
. .venv/bin/activate && \
uv pip install -r requirements.txt; \
fi
# Test installation
test:
@echo "Testing CAT12 installation..."
@chmod +x scripts/test_installation.sh
@./scripts/test_installation.sh
# Show activation instructions
activate:
@echo "To activate the CAT12 environment, run:"
@echo " source activate_cat12.sh"
@echo ""
@echo "Then you can use:"
@echo " python bids_cat12_processor.py --help"
# Development installation
dev-install:
@echo "Installing development dependencies..."
@if [ -f ".venv/bin/activate" ]; then \
. .venv/bin/activate && \
uv pip install -e ".[dev]"; \
else \
echo "Virtual environment not found. Run 'make install' first."; \
exit 1; \
fi
# Linting
lint:
@echo "Running code linting..."
@if [ -f ".venv/bin/activate" ]; then \
. .venv/bin/activate && \
flake8 utils/ scripts/ bids_cat12_processor.py && \
mypy utils/ scripts/ bids_cat12_processor.py; \
else \
echo "Virtual environment not found. Run 'make install' first."; \
exit 1; \
fi
# Advisory formatting check (does not fail)
format-check:
@echo "Checking code formatting (advisory)..."
@if [ -f ".venv/bin/activate" ]; then \
. .venv/bin/activate && \
(black --check utils/ scripts/ bids_cat12_processor.py >/dev/null 2>&1 || echo "[warn] Black would reformat files (advisory). Run 'make format' to apply.") && \
(isort --check-only --skip-glob '*.backup' utils/ scripts/ bids_cat12_processor.py >/dev/null 2>&1 || echo "[warn] isort would reorder imports (advisory). Run 'make format' to apply."); \
else \
echo "Virtual environment not found. Run 'make install' first."; \
exit 1; \
fi
# Code formatting
format:
@echo "Formatting code..."
@if [ -f ".venv/bin/activate" ]; then \
. .venv/bin/activate && \
black utils/ scripts/ bids_cat12_processor.py && \
isort utils/ scripts/ bids_cat12_processor.py; \
else \
echo "Virtual environment not found. Run 'make install' first."; \
exit 1; \
fi
# Show usage examples
example:
@echo "Running example usage script..."
@if [ -f ".venv/bin/activate" ]; then \
. .venv/bin/activate && \
python example_usage.py; \
else \
echo "Virtual environment not found. Run 'make install' first."; \
exit 1; \
fi
# Clean temporary files
clean:
@echo "Cleaning temporary files..."
@find . -type f -name "*.pyc" -delete
@find . -type d -name "__pycache__" -delete
@find . -type f -name "*.log" -delete
@find . -type f -name "processing_*.json" -delete
@find . -type f -name "processing_*.mat" -delete
@rm -rf .pytest_cache/
@rm -rf htmlcov/
@echo "Temporary files cleaned."
# Clean everything (including installation)
clean-all: clean
@echo "WARNING: This will remove the entire installation!"
@echo "Press Ctrl+C to cancel, or Enter to continue..."
@read dummy
@rm -rf external/
@rm -rf .venv/
@rm -f .env
@rm -f activate_cat12.sh
@echo "Installation cleaned. Run 'make install' to reinstall."