@@ 0,0 1,11 @@
+image: ubuntu/lts
+packages:
+ - python3
+ - python3-venv
+ - python3-pip
+source:
+ - hg+https://hg.sr.ht/~obensonne/poole
+tasks:
+ - test: |
+ cd poole
+ make test
@@ 1,10 1,11 @@
-APP := poole
-
+# =============================================================================
+# Make file for development and testing poole
+#
+# You most likely will run poole.py in your own virtual env.
# =============================================================================
export LC_ALL := en_US.UTF-8
-
-VIRTUALENV := virtualenv --python=python3
+export PYTHONIOENCODING := UTF-8:replace
HERE:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
@@ 16,46 17,29 @@ HERE:=$(shell dirname $(realpath $(first
.PHONY: clean
clean:
- rm *.pyc
+ rm -f *.pyc
touch requirements.txt
- rm -f env/_done_*
.PHONY: distclean
distclean: clean
- rm -f bin
rm -rf env
# =============================================================================
-# build
+# build virtual environment
# =============================================================================
env/bin/python:
- $(VIRTUALENV) env
+ python3 -m venv env
-env/_done_requirements: requirements.txt
+env/_requirements: requirements.txt
+ env/bin/pip install --upgrade pip
env/bin/pip install -U -r requirements.txt
touch $@
-bin:
- ln -s env/bin
-
-.PHONY: env
-env: env/bin/python bin
-env: env/_done_requirements
-
-define POOLE_BIN
-#!/bin/bash
+.PHONY: build
+build: ## build everything needed to run tests and deploy releases
+build: env/bin/python env/_requirements
-$(HERE)/env/bin/python $(HERE)/poole.py $$@
-endef
-export POOLE_BIN
-
-poole: poole.py Makefile
- @echo "$$POOLE_BIN" > $@
- chmod +x poole
-
-.PHONY: build
-build: env poole
# =============================================================================
# tests
@@ 28,7 28,7 @@ env, then make Poole easily runnable via
$ hg clone https://hg.sr.ht/~obensonne/poole /some/where/poole
$ cd /some/where/poole
$ make
- $ alias poole=/some/where/poole/poole
+ $ alias poole=/some/where/poole/poole.py
**TIP**: You might want to add the last command to your `~/.bashrc`.
@@ 7,7 7,10 @@ import sys
import glob
HERE = os.path.dirname(__file__)
-POOLE = os.path.join(HERE, "..", "poole")
+POOLE = [
+ os.path.join(HERE, "..", "env", "bin", "python"),
+ os.path.join(HERE, "..", "poole.py"),
+]
ACTUAL = os.path.join(HERE, "actual")
EXPECTED = os.path.join(HERE, "expected")
ERRORS = os.path.join(HERE, "errors.diff")
@@ 20,9 23,9 @@ if os.path.exists(ACTUAL):
if os.path.exists(ERRORS):
os.remove(ERRORS)
-cmd_init = [POOLE, ACTUAL, "--init"]
-cmd_build_dry_run = [POOLE, ACTUAL, "--build", "--dry-run"]
-cmd_build = [POOLE, ACTUAL, "--build"]
+cmd_init = POOLE + [ACTUAL, "--init"]
+cmd_build_dry_run = POOLE + [ACTUAL, "--build", "--dry-run"]
+cmd_build = POOLE + [ACTUAL, "--build"]
cmd_diff = ["diff", "-Naur", EXPECTED, ACTUAL]
r = subprocess.call(cmd_init, stdout=subprocess.PIPE)