<commit_before># =====================================
# Makefile for the ActivityWatch bundle
# =====================================
#
# [GUIDE] How to install from source:
#  - https://activitywatch.readthedocs.io/en/latest/installing-from-source.html
#
# We recommend creating and activating a Python virtualenv before building.
# Instructions on how to do this can be found in the guide linked above.

# These targets should always rerun
.PHONY: build install test clean clean_all

SHELL := /usr/bin/env bash

# The `build` target
# ------------------
#
# What it does:
#  - Installs all the Python modules
#  - Builds the web UI and bundles it with aw-server
#
# Tips:
#  - Set the environment variable `PIP_USER=true` for pip to install all Python
#    packages as user packages (same as `pip install --user <pkg>`). This makes
#    it possible to install without using a virtualenv (or root).
build:
	if [ -e "aw-core/.git" ]; then \
		echo "Submodules seem to already be initialized, continuing..."; \
	else \
		git submodule update --init --recursive; \
	fi
#
#	needed due to https://github.com/pypa/setuptools/issues/1963
#	would ordinarily be specified in pyproject.toml, but is not respected due to https://github.com/pypa/setuptools/issues/1963
	pip install 'setuptools>49.1.1'
#
	make --directory=aw-core build
	make --directory=aw-client build
	make --directory=aw-watcher-afk build
	make --directory=aw-watcher-window build
	make --directory=aw-server build SKIP_WEBUI=$(SKIP_WEBUI)
ifndef SKIP_SERVER_RUST  # Skip building aw-server-rust if SKIP_SERVER_RUST is defined
	echo 'Looking for rust...'
	if (which cargo); then \
		echo 'Rust found!'; \
		make --directory=aw-server-rust build SKIP_WEBUI=$(SKIP_WEBUI); \
	else \
		echo 'Rust not found, skipping aw-server-rust!'; \
	fi
endif
	make --directory=aw-qt build
#   The below is needed due to: https://github.com/ActivityWatch/activitywatch/issues/173
	make --directory=aw-client build
	make --directory=aw-core build
#	Needed to ensure that the server has the correct version set
	python3 -c "import aw_server; print(aw_server.__version__)"


# Install
# -------
#
# Installs things like desktop/menu shortcuts.
# Might in the future configure autostart on the system.
install:
	make --directory=aw-qt install
# Installation is already happening in the `make build` step currently.
# We might want to change this.
# We should also add some option to install as user (pip3 install --user)

# Update
# ------
#
# Pulls the latest version, updates all the submodules, then runs `make build`.
update:
	git pull
	git submodule update --init --recursive
	make build


lint:
	pylint -E \
		aw-core/aw_core/ \
		aw-core/aw_datastore/ \
		aw-core/aw_transform/ \<commit_msg>Revert "ci: change use `python` to `python3` (#696)"<commit_after># =====================================
# Makefile for the ActivityWatch bundle
# =====================================
#
# [GUIDE] How to install from source:
#  - https://activitywatch.readthedocs.io/en/latest/installing-from-source.html
#
# We recommend creating and activating a Python virtualenv before building.
# Instructions on how to do this can be found in the guide linked above.

# These targets should always rerun
.PHONY: build install test clean clean_all

SHELL := /usr/bin/env bash

# The `build` target
# ------------------
#
# What it does:
#  - Installs all the Python modules
#  - Builds the web UI and bundles it with aw-server
#
# Tips:
#  - Set the environment variable `PIP_USER=true` for pip to install all Python
#    packages as user packages (same as `pip install --user <pkg>`). This makes
#    it possible to install without using a virtualenv (or root).
build:
	if [ -e "aw-core/.git" ]; then \
		echo "Submodules seem to already be initialized, continuing..."; \
	else \
		git submodule update --init --recursive; \
	fi
#
#	needed due to https://github.com/pypa/setuptools/issues/1963
#	would ordinarily be specified in pyproject.toml, but is not respected due to https://github.com/pypa/setuptools/issues/1963
	pip install 'setuptools>49.1.1'
#
	make --directory=aw-core build
	make --directory=aw-client build
	make --directory=aw-watcher-afk build
	make --directory=aw-watcher-window build
	make --directory=aw-server build SKIP_WEBUI=$(SKIP_WEBUI)
ifndef SKIP_SERVER_RUST  # Skip building aw-server-rust if SKIP_SERVER_RUST is defined
	echo 'Looking for rust...'
	if (which cargo); then \
		echo 'Rust found!'; \
		make --directory=aw-server-rust build SKIP_WEBUI=$(SKIP_WEBUI); \
	else \
		echo 'Rust not found, skipping aw-server-rust!'; \
	fi
endif
	make --directory=aw-qt build
#   The below is needed due to: https://github.com/ActivityWatch/activitywatch/issues/173
	make --directory=aw-client build
	make --directory=aw-core build
#	Needed to ensure that the server has the correct version set
	python -c "import aw_server; print(aw_server.__version__)"


# Install
# -------
#
# Installs things like desktop/menu shortcuts.
# Might in the future configure autostart on the system.
install:
	make --directory=aw-qt install
# Installation is already happening in the `make build` step currently.
# We might want to change this.
# We should also add some option to install as user (pip3 install --user)

# Update
# ------
#
# Pulls the latest version, updates all the submodules, then runs `make build`.
update:
	git pull
	git submodule update --init --recursive
	make build


lint:
	pylint -E \
		aw-core/aw_core/ \
		aw-core/aw_datastore/ \
		aw-core/aw_transform/ \
{'fraction_non_alphanumeric': 0.1378309756982227, 'fraction_numerical': 0.00671019223793979, 'mean_word_length': 3.61892797319933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '27405', 'n_tokens_mistral': 1783, 'n_tokens_neox': 1700, 'n_words': 613}