This repository was archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathenvironment.mk
More file actions
58 lines (50 loc) · 1.45 KB
/
environment.mk
File metadata and controls
58 lines (50 loc) · 1.45 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Environment Management Makefile
define conda_environment_file
name: sdk\\n
channels:\\n
- default\\n
- apple\\n
- conda-forge\\n
dependencies:\\n
- python=$(shell cat .python-version)\\n
- pip\\n
- pip:\\n
\ \ - poetry==$(REQUIRED_POETRY_VERSION)
endef
.PHONY: create-environment
create-environment: create-environment-$(UNAME_SYS) ## Set up virtual environment
.PHONY: create-environment-Linux
create-environment-Linux: .python-version
ifeq ($(shell which pyenv),)
@echo "pyenv is not Installed, please install before creating an environment"
@exit 1
else
@pyenv install -s $(shell cat $<)
@echo "pyenv Python version $(shell cat $<) installed."
@echo "Activate shell with poetry shell"
endif
.PHONY: create-environment-Darwin
create-environment-Darwin:
ifeq ($(UNAME_ARCH), arm64)
ifdef CONDA_ENV_NAME
$(shell echo $(conda_environment_file) > .environment.M1.yml)
$(CONDA_EXE) env update -p build/$(PROJECT_NAME) -f .environment.M1.yml
@echo
@echo "Conda env is available and can be activated."
else
$(error Unsupported Environment. Please use conda)
endif
endif
.PHONY: delete-environment
delete-environment: delete-environment-$(UNAME_SYS) ## Delete the virtual environment
.PHONY: delete-environment-Linux
delete-environment-Linux:
@echo "No action needed"
.PHONY: delete-environment-Darwin
delete-environment-Darwin:
ifeq ($(UNAME_ARCH), arm64)
@echo "Deleting conda environment."
rm -fr build/$(PROJECT_NAME)
endif
clean: delete-environment