Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up build #32

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# These targets do not construct files named after the target itself. Rerun them every time.
.PHONY: setup build test dist/main lint

# This first target is the one that runs by default.
dist/archive.tar.gz: dist/main
tar -czvf dist/archive.tar.gz dist/main

setup:
./build.sh


build: dist/main

test:
PYTHONPATH=./src pytest
dist/archive.tar.gz:
tar -czvf dist/archive.tar.gz dist/main

dist/main:
python -m PyInstaller --onefile --hidden-import="googleapiclient" --add-data="./src:src" src/main.py

lint:
pylint --disable=C0114,E0401,E1101,C0116,W0613,R0913,C0116,R0914,C0103,W0201,W0719 src/
Expand Down
12 changes: 7 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash
# setup.sh -- environment bootstrapper for python virtualenv

set -euo pipefail
# x: print out commands as they are run
# e: exit on any failure
# u: using a nonexistent environment variable is an error
# o pipefail: in a pipeline, any intermediate step exiting with failure counts as an overall fail
set -xeuo pipefail

SUDO=sudo
if ! command -v $SUDO; then
Expand Down Expand Up @@ -32,9 +36,7 @@ echo creating virtualenv at $VIRTUAL_ENV
python3 -m venv $VIRTUAL_ENV
echo installing dependencies from requirements.txt
$VIRTUAL_ENV/bin/pip install -r requirements.txt -U
source $VIRTUAL_ENV/bin/activate
$PYTHON -m PyInstaller --onefile --hidden-import="googleapiclient" --add-data="./src:src" src/main.py

# When running as a local module, we need meta.json to be in the same directory as the module.
mkdir -p dist
ln -sf ../meta.json dist
tar -czvf dist/archive.tar.gz dist/main