Skip to content

Commit

Permalink
Add make compiledeps
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Jul 8, 2021
1 parent 1469838 commit 6fad6f1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ help: ensurevenv
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo "---"
@echo " bumpdeps to bump dependencies in requirement files."
@echo " compiledeps to update requirements.txt files to adhere to dependencies"
@echo " declared in requirements.in files (with minimal version changes)."

.PHONY: help bumpdeps ensurevenv Makefile
.PHONY: help bumpdeps compiledeps ensurevenv Makefile

# Note to whoever sees this in future:
# Using indentation before `ensurevenv` lines breaks this target
Expand Down Expand Up @@ -43,8 +45,17 @@ ensurevenv: ;

bumpdeps: ensurevenv
echo.- Upgrading requirement files
venv/bin/pip-compile --quiet --upgrade
venv/bin/pip-compile --quiet --upgrade dev-requirements.in
./venv/bin/pip-compile --quiet --upgrade
./venv/bin/pip-compile --quiet --upgrade dev-requirements.in
$(MAKE) aftercompiledeps

compiledeps: ensurevenv
echo.- Compiling requirement files
./venv/bin/pip-compile --quiet
./venv/bin/pip-compile --quiet dev-requirements.in
$(MAKE) aftercompiledeps

aftercompiledeps:
-./venv/bin/pre-commit run mixed-line-ending --files requirements.txt dev-requirements.txt >/dev/null
git diff -U1 -- ./requirements.txt ./dev-requirements.txt
@echo
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ needed by this documentation.

To update dependencies, run `make bumpdeps`.

## Adding new build dependencies

To add new build dependencies, add them to appropriate file (`requirements.in`
for docs build requirements, `dev-requirements.in` for dev requirements) and
run `make compiledeps` to automatically update `requirements.txt` appropriately.

## License

See the [LICENSE file](LICENSE) for details.
17 changes: 16 additions & 1 deletion make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "bumpdeps" goto bumpdeps
if "%1" == "compiledeps" goto compiledeps
if "%1" == "" goto help

call :ensurevenv
Expand Down Expand Up @@ -45,18 +46,32 @@ call :ensurevenv
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
echo.---
echo. bumpdeps to bump dependencies in requirement files.
echo. compiledeps to update requirements.txt files to adhere to dependencies
echo. declared in requirements.in files (with minimal version changes).
goto end

:bumpdeps
call :ensurevenv
echo.- Upgrading requirement files
venv\Scripts\pip-compile --quiet --upgrade
venv\Scripts\pip-compile --quiet --upgrade dev-requirements.in
call :aftercompiledeps
goto end

:compiledeps
call :ensurevenv
echo.- Compiling requirement files
venv\Scripts\pip-compile --quiet
venv\Scripts\pip-compile --quiet dev-requirements.in
call :aftercompiledeps
goto end

:aftercompiledeps
venv\Scripts\pre-commit run mixed-line-ending --files requirements.txt dev-requirements.txt >nul
git diff -U1 -- requirements.txt dev-requirements.txt
echo.
call :ensurevenv
goto end
goto :eof

:end
popd

0 comments on commit 6fad6f1

Please sign in to comment.