@@ -16,11 +16,18 @@ ACTIVATE?=. ${VENV}/bin/activate;
16
16
VIRTUALENV_PYZ =../etc/thirdparty/virtualenv.pyz
17
17
# Do not depend on Python to generate the SECRET_KEY
18
18
GET_SECRET_KEY =` base64 /dev/urandom | head -c50 `
19
+
19
20
# Customize with `$ make envfile ENV_FILE=/etc/purldb/.env`
20
21
ENV_FILE =.env
22
+
21
23
# Customize with `$ make postgres PACKAGEDB_DB_PASSWORD=YOUR_PASSWORD`
22
24
PACKAGEDB_DB_PASSWORD =packagedb
23
25
MATCHCODEIO_DB_PASSWORD =matchcodeio
26
+ SCANCODEIO_DB_PASSWORD =scancodeio
27
+
28
+ # Django settings shortcuts
29
+ DJSM_PDB=DJANGO_SETTINGS_MODULE =purldb_project.settings
30
+ DJSM_MAT=DJANGO_SETTINGS_MODULE =matchcode_project.settings
24
31
25
32
# Use sudo for postgres, but only on Linux
26
33
UNAME := $(shell uname)
@@ -56,22 +63,17 @@ envfile_testing: envfile
56
63
@echo SCANCODEIO_DB_USER=\" postgres\" >> ${ENV_FILE}
57
64
@echo SCANCODEIO_DB_PASSWORD=\" postgres\" >> ${ENV_FILE}
58
65
59
- doc8 :
60
- @echo " -> Run doc8 validation"
61
- @${ACTIVATE} doc8 --max-line-length 100 --ignore-path docs/_build/ --quiet docs/
62
-
63
66
valid :
64
67
@echo " -> Run Ruff format"
65
68
@${ACTIVATE} ruff format --exclude etc/scripts/ --exclude purldb-toolkit/ --exclude purl2vcs/
66
69
@echo " -> Run Ruff linter"
67
70
@${ACTIVATE} ruff check --fix --exclude etc/scripts/ --exclude purldb-toolkit/ --exclude purl2vcs/
68
71
69
- check :
72
+ check : check_docs
70
73
@echo " -> Run Ruff linter validation (pycodestyle, bandit, isort, and more)"
71
74
@${ACTIVATE} ruff check --exclude etc/scripts/ --exclude purldb-toolkit/ --exclude purl2vcs/
72
75
@echo " -> Run Ruff format validation"
73
76
@${ACTIVATE} ruff format --check --exclude etc/scripts/ --exclude purldb-toolkit/ --exclude purl2vcs/
74
- @$(MAKE ) doc8
75
77
76
78
clean :
77
79
@echo " -> Clean the Python env"
@@ -102,7 +104,7 @@ postgres_matchcodeio:
102
104
@echo " -> Create 'matchcodeio' database"
103
105
${SUDO_POSTGRES} createdb --encoding=utf-8 --owner=matchcodeio matchcodeio
104
106
${MATCHCODE_MANAGE} migrate
105
-
107
+
106
108
run :
107
109
${MANAGE} runserver 8001 --insecure
108
110
@@ -118,13 +120,20 @@ run_visit: seed
118
120
run_map :
119
121
${MANAGE} run_map
120
122
121
- test :
122
- @echo " -> Run the test suite"
123
- ${ACTIVATE} DJANGO_SETTINGS_MODULE=purldb_project.settings ${PYTHON_EXE} -m pytest -vvs --ignore matchcode_pipeline --ignore matchcode_project --ignore purldb-toolkit --ignore packagedb/tests/test_throttling.py
124
- ${ACTIVATE} DJANGO_SETTINGS_MODULE=purldb_project.settings ${PYTHON_EXE} -m pytest -vvs packagedb/tests/test_throttling.py
125
- ${ACTIVATE} DJANGO_SETTINGS_MODULE=matchcode_project.settings ${PYTHON_EXE} -m pytest -vvs matchcode_pipeline
126
- ${ACTIVATE} ${PYTHON_EXE} -m pytest -vvs purldb-toolkit/
127
- ${ACTIVATE} DJANGO_SETTINGS_MODULE=purldb_project.settings ${PYTHON_EXE} -m pytest -vvs purl2vcs
123
+ test_purldb :
124
+ ${ACTIVATE} ${DJSM_PDB} pytest -vvs --lf minecode packagedb purl2vcs purldb_project purldb_public_project --ignore packagedb/tests/test_throttling.py
125
+ ${ACTIVATE} ${DJSM_PDB} pytest -vvs --lf packagedb/tests/test_throttling.py
126
+
127
+ test_toolkit :
128
+ ${ACTIVATE} pytest -vvs purldb-toolkit/
129
+
130
+ test_clearcode :
131
+ ${ACTIVATE} ${DJSM_PDB} ${PYTHON_EXE} -m pytest -vvs clearcode clearindex
132
+
133
+ test_matchcode :
134
+ ${ACTIVATE} ${DJSM_MAT} ${PYTHON_EXE} -m pytest -vvs matchcode_pipeline matchcode-toolkit matchcode
135
+
136
+ test : test_purldb test_matchcode test_toolkit test_clearcode
128
137
129
138
shell :
130
139
${MANAGE} shell
@@ -153,7 +162,7 @@ check_docs:
153
162
@echo " Check Sphinx Documentation build minimally"
154
163
@${ACTIVATE} sphinx-build -E -W docs/source build
155
164
@echo " Check for documentation style errors"
156
- @${ACTIVATE} doc8 --max-line-length 100 docs/source --ignore D000 --quiet
165
+ @${ACTIVATE} doc8 --max-line-length 100 docs/source --ignore-path docs/_build/ --ignore D000 --quiet
157
166
158
167
docker-images :
159
168
@echo " -> Build Docker services"
@@ -164,4 +173,5 @@ docker-images:
164
173
@mkdir -p dist/
165
174
@docker save minecode minecode_minecode nginx | gzip > dist/minecode-images-` git describe --tags` .tar.gz
166
175
167
- .PHONY : virtualenv conf dev envfile isort black doc8 valid check clean migrate postgres run test shell clearsync clearindex index_packages bump docs docker-images
176
+ # keep this sorted
177
+ .PHONY : black bump check check_docs clean `clearindex clearsync conf dev docker-images docs envfile envfile_testing index_packages isort migrate postgres postgres_matchcodeio priority_queue run run_map run_matchcodeio run_visit seed shell test test_clearcode test_matchcode test_purldb test_toolkit valid virtualenv
0 commit comments