-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
81 lines (64 loc) · 2.25 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
76
77
78
79
80
81
INSTALL_PATH ?= /usr/local
SPARROW_INSTALL_PATH ?= $(INSTALL_PATH)
.PHONY: build install install-dev build-dev install-dist test clean
all: install-hooks build-dev
build:
_cli/_scripts/build-dist
# Install locally-built executable. There should be no links preserved to the source
# code after that
install: build install-dist
# Development installation
build-dev:
_cli/_scripts/build-local
# Install without building with PyInstaller
install-dev: build-dev
mkdir -p $(SPARROW_INSTALL_PATH)/bin
ln -sf "$(shell pwd)/_cli/sparrow-dev-shim" "$(SPARROW_INSTALL_PATH)/bin/sparrow"
## TODO: fix bugs with install-dist to make it more capable
# Bundle with PyInstaller and install (requires local Python 3)
install-dist: install-hooks
./get-sparrow.sh --no-confirm _cli/dist/sparrow
test:
_cli/_scripts/test-cli
clean:
rm -rf _cli/build
# Build locally for the current platform (DEFAULT)
_cli/build/sparrow:
_cli/_scripts/build-dist
# For older varieties of Linux, we have to build in a Docker container
# with an older libc. This is mostly an issue for RHEL and older Ubuntu installations.
build-linux:
docker run \
-v "$(shell pwd):/src/" \
cdrx/pyinstaller-linux:latest \
_cli/_scripts/build-docker-linux
# This will build the CLI for windows, which is currently unsupported
# (WSL integration with the linux binaries should be used instead)
build-windows:
docker run \
-v "$(shell pwd):/src/" \
cdrx/pyinstaller-windows:latest \
_cli/_scripts/build-dist
# Helper to generate a build specification
_generate_buildspec:
cd _cli && \
pyinstaller --noconfirm --distpath dist sparrow_cli/__main__.py
# Link git hooks
# (handles automatic submodule updating etc.)
# For git > 2.9
install-hooks:
git config --local core.hooksPath .githooks
# Always git prune on config
git config --local remote.origin.prune true
# Initialize submodules if we haven't already
-[ ! -d .git/modules ] && git submodule update --init
format-code:
black backend/**/*.py _cli/**/*.py
prettier --ignore-path frontend/.prettierignore --write frontend
get-poetry-installer:
rm -f _cli/_scripts/install-poetry.py && \
curl -sSL https://install.python-poetry.org > _cli/_scripts/install-poetry.py
prepare:
pip3 install "poetry>=1.4.2"
cd _cli && poetry update
cd backend && poetry update