-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
28 lines (24 loc) · 1 KB
/
Makefile
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
PYTHON_VERSION = 3.13
PYTHON_ENV_NAME = adventofcode
.PHONY: setup today aoc
# Load Python virtual environment
setup:
# pyenv install $(PYTHON_VERSION)
pyenv virtualenv --force $(PYTHON_VERSION) $(PYTHON_ENV_NAME)
echo "$(PYTHON_ENV_NAME)" > .python-version
@eval "$$(pyenv init -)" && pyenv activate ${PYTHON_ENV_NAME}
pip install -r requirements.txt
echo "Python environment $(PYTHON_ENV_NAME) set up and dependencies installed."
# Run the script for today's puzzle if it's December
today:
@eval "$$(pyenv init -)" && pyenv activate ${PYTHON_ENV_NAME}
@puzzle_path=$$(python support/aoc_helper.py --year $$(date '+%Y') --day $$(date '+%d') | tail -n 1); \
cd "$$puzzle_path" && code main.py
# Run the script for a specific puzzle by year and day
# Usage: make today YEAR=2024 DAY=5
YEAR ?= 2015
DAY ?= 1
aoc:
@eval "$$(pyenv init -)" && pyenv activate ${PYTHON_ENV_NAME}
@puzzle_path=$$(python support/aoc_helper.py --year $$(date '+%Y') --day $$(date '+%d') | tail -n 1); \
cd "$$puzzle_path" && code main.py