Skip to content

Commit c0b36a7

Browse files
authored
Merge pull request #26 from hummingbot/feat/update-makefile
Update Makefile
2 parents d523b8b + 265c790 commit c0b36a7

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

Makefile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11
.ONESHELL:
2+
.SHELLFLAGS := -c
3+
24
.PHONY: run
35
.PHONY: uninstall
46
.PHONY: install
7+
.PHONY: install-pre-commit
8+
.PHONY: docker_build
9+
.PHONY: docker_run
10+
11+
12+
detect_conda_bin := $(shell bash -c 'if [ "${CONDA_EXE} " == " " ]; then \
13+
CONDA_EXE=$$((find /opt/conda/bin/conda || find ~/anaconda3/bin/conda || \
14+
find /usr/local/anaconda3/bin/conda || find ~/miniconda3/bin/conda || \
15+
find /root/miniconda/bin/conda || find ~/Anaconda3/Scripts/conda || \
16+
find $$CONDA/bin/conda) 2>/dev/null); fi; \
17+
if [ "${CONDA_EXE}_" == "_" ]; then \
18+
echo "Please install Anaconda w/ Python 3.10+ first"; \
19+
echo "See: https://www.anaconda.com/distribution/"; \
20+
exit 1; fi; \
21+
echo $$(dirname $${CONDA_EXE})')
22+
23+
CONDA_BIN := $(detect_conda_bin)
524

625
run:
726
uvicorn main:app --reload
@@ -10,10 +29,21 @@ uninstall:
1029
conda env remove -n backend-api
1130

1231
install:
13-
conda env create -f environment.yml
32+
if conda env list | grep -q '^backend-api '; then \
33+
echo "Environment already exists."; \
34+
else \
35+
conda env create -f environment_conda.yml; \
36+
fi
37+
$(MAKE) install-pre-commit
38+
39+
install-pre-commit:
40+
/bin/bash -c 'source "${CONDA_BIN}/activate" backend-api && \
41+
if ! conda list pre-commit | grep pre-commit &> /dev/null; then \
42+
pip install pre-commit; \
43+
fi && pre-commit install'
1444

1545
docker_build:
1646
docker build -t hummingbot/backend-api:latest .
1747

1848
docker_run:
19-
docker compose up -d
49+
docker compose up -d

0 commit comments

Comments
 (0)