Skip to content

Commit 47577ec

Browse files
committed
Determine .lessc directory dynamically.
1 parent 5dcb6ed commit 47577ec

File tree

4 files changed

+68
-64
lines changed

4 files changed

+68
-64
lines changed

.github/dependabot.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ updates:
99
ignore:
1010
- dependency-name: black
1111
versions:
12-
- 21.4b0
13-
- 21.4b1
12+
- 23.12.1
1413
- dependency-name: faker
1514
versions:
1615
- 5.8.0
@@ -39,7 +38,7 @@ updates:
3938
- 1.26.3
4039
- dependency-name: pytest
4140
versions:
42-
- 6.2.2
41+
- 7.4.3
4342
- dependency-name: isort
4443
versions:
45-
- 5.7.0
44+
- 5.13.2

config.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Class-based Flask app configuration."""
2-
from os import environ, path, system
2+
import subprocess
3+
from os import environ, path
34

45
from dotenv import load_dotenv
56

@@ -25,13 +26,17 @@ class Config:
2526

2627
# Flask-Assets
2728
if ENVIRONMENT == "development":
28-
LESS_BIN = system("which lessc")
29-
ASSETS_DEBUG = False
30-
LESS_RUN_IN_DEBUG = False
29+
# Check if `lessc` is installed
30+
LESS_BIN = subprocess.call("which lessc", shell=True)
3131
if LESS_BIN is None:
32-
raise ValueError(
33-
"Application running in `development` mode cannot create assets without `lessc` installed."
34-
)
32+
raise ValueError("Flask requires `lessc` to be installed to compile styles.")
33+
else:
34+
# Check if `nodejs` is installed
35+
NODE_JS = subprocess.call("which node", shell=True)
36+
if NODE_JS is None:
37+
raise ValueError(
38+
"Application running in `development` mode cannot create assets without `node` installed."
39+
)
3540

3641
# Hardcoded data
3742
PRODUCT_DATA_FILEPATH = f"{BASE_DIR}/data/products.json"

poetry.lock

+51-51
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
black==23.12.0 ; python_version >= "3.10" and python_version < "4.0"
1+
black==23.12.1 ; python_version >= "3.10" and python_version < "4.0"
22
blinker==1.7.0 ; python_version >= "3.10" and python_version < "4.0"
33
click==8.1.7 ; python_version >= "3.10" and python_version < "4.0"
44
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
@@ -16,7 +16,7 @@ lesscpy==0.15.1 ; python_version >= "3.10" and python_version < "4.0"
1616
markupsafe==2.1.3 ; python_version >= "3.10" and python_version < "4.0"
1717
mccabe==0.7.0 ; python_version >= "3.10" and python_version < "4.0"
1818
mypy-extensions==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
19-
mypy==1.7.1 ; python_version >= "3.10" and python_version < "4.0"
19+
mypy==1.8.0 ; python_version >= "3.10" and python_version < "4.0"
2020
packaging==23.2 ; python_version >= "3.10" and python_version < "4.0"
2121
pathspec==0.12.1 ; python_version >= "3.10" and python_version < "4.0"
2222
platformdirs==4.1.0 ; python_version >= "3.10" and python_version < "4.0"

0 commit comments

Comments
 (0)