-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (64 loc) · 1.55 KB
/
Makefile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Makefile for climate_analyzer
# Automate packaging & virtual environment management
# Make is far from the idea tool for this!
#
# Build Artifacts are stored in ./dist/*
# src distribution (dist) = *.tar.gz
# built distribution (wheel) = *.whl
#
# Virtual Environment in ./venv/*
# Command Line tool *.exe in ./venv/Scripts
#
##########################################################
define venvbat
py -m venv venv
call venv\Scripts\activate
pip install -r requirements.txt
endef
PKG = climate_analyzer
HPKG = $(subst _,-,$(PKG))
SRC = ./src/$(PKG)
VPKG = venv\Lib\site-packages\climate_analyzer
DISTOK = $(shell if [ -d './dist' ]; then echo 1; else echo 0; fi)
ifeq ($(DISTOK), 1)
GZFILE = $(shell find './dist' -name '*.gz')
else
GZFILE =
endif
clean:
rm -r -f dist
rm -r -f venv
rm -f $(SRC)/*.ini
rm -r -f $(HPKG)
noinst:
rm -r -f $(VPKG)
# Create Virtual Environment
venv:
hatch env create venv
rm -r -f $(HPKG)
# Create Package Distribution
dist:
@rm -f src\climte_analyzer\*.ini
@rm -r -f venv
@py -m build
$(VPKG): dist venv
@echo $(GZFILE)
# Install package in Virtual Environment
instpkg: $(VPKG)
ifeq ($(words $(GZFILE)),1)
@$(file >[email protected],call venv\Scripts\activate)
@$(file >>[email protected],pip install $(GZFILE))
@rm -f [email protected]
endif
upld:
twine upload dist/*
help:
@echo venv - Create Virtual Environment venv
@echo dist - Create Distrubution Folder dist
@echo instpkg - Install $(PKG) into Virtual Env
@echo sdist = $(GZFILE)
@echo $(HPKG)
# @$(file >[email protected]$^,$(venvbat))
# @rm -f [email protected]