<commit_before>.PHONY: build install check clean format

ROOT_DIR = .
SRC_DIR = $(ROOT_DIR)/source
TST_DIR = $(ROOT_DIR)/tests

PYTHON ?= python
# --user does not work from inside a virtual environment
# PIP_OPTIONS ?= --user
PIP_OPTIONS ?=

build:
	$(PYTHON) setup.py build

install:
	$(PYTHON) -m pip install -r requirements.txt -v $(PIP_OPTIONS) .

autohintexe:
	make -C $(SRC_DIR)

clean:
	$(PYTHON) setup.py clean --all
	make -C $(SRC_DIR) clean

check: install
	make -C $(TST_DIR)

format:
	clang-format -i `find $(SRC_DIR) -name '*.c'`<commit_msg>Makefile: extend sys.path with build/lib.* dir in `check` target<commit_after>.PHONY: build install check clean format

ROOT_DIR = .
SRC_DIR = $(ROOT_DIR)/source
TST_DIR = $(ROOT_DIR)/tests

PYTHON ?= python
# --user does not work from inside a virtual environment
# PIP_OPTIONS ?= --user
PIP_OPTIONS ?=

# Get the platform/version-specific build/lib.* folder
define GET_BUILD_DIR
import os
import sys
import sysconfig
root = sys.argv[1]
plat_lib_name = "lib.{platform}-{version[0]}.{version[1]}".format(
    platform=sysconfig.get_platform(), version=sys.version_info)
build_dir = os.path.abspath(os.path.join(root, "build", plat_lib_name))
print(build_dir)
endef

BUILD_DIR := $(shell $(PYTHON) -c '$(GET_BUILD_DIR)' $(ROOT_DIR))

build:
	$(PYTHON) setup.py build

install:
	$(PYTHON) -m pip install -r requirements.txt -v $(PIP_OPTIONS) .

autohintexe:
	make -C $(SRC_DIR)

clean:
	$(PYTHON) setup.py clean --all
	make -C $(SRC_DIR) clean

check: build
	make -C $(TST_DIR) PYTHONPATH="$(BUILD_DIR)"

format:
	clang-format -i `find $(SRC_DIR) -name '*.c'`
{'fraction_non_alphanumeric': 0.14959652389819988, 'fraction_numerical': 0.00186219739292365, 'mean_word_length': 4.501706484641638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5019505', 'n_tokens_mistral': 623, 'n_tokens_neox': 617, 'n_words': 165}