diff --git a/.gitignore b/.gitignore index 83386b0d..f375fa6e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ jsonschema-*.txt relative-json-pointer.html relative-json-pointer.pdf relative-json-pointer.txt + +# For the Python enviornment +.venv diff --git a/Makefile b/Makefile index cb7008f7..a81ca9b4 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ XML2RFC ?= xml2rfc +VENV ?= .venv OUT = \ jsonschema-core.html jsonschema-core.txt \ jsonschema-validation.html jsonschema-validation.txt \ relative-json-pointer.html relative-json-pointer.txt - -all: $(OUT) +all: $(VENV) $(OUT) %.txt: %.xml $(XML2RFC) --text $< -o $@ @@ -25,7 +25,15 @@ json-schema.tar.gz: $(OUT) tar -czf json-schema.tar.gz --exclude '.*' json-schema rm -rf json-schema -clean: +$(VENV): requirements.txt + python -m venv $@ + $@/bin/python -m pip install --upgrade pip + $@/bin/python -m pip install -r $< + +spec-clean: rm -f $(OUT) json-schema.tar.gz -.PHONY: clean all +clean: spec-clean + rm -rf $(VENV) + +.PHONY: spec-clean clean all diff --git a/README.md b/README.md index 3c100288..ce62c2e1 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,16 @@ Labels are assigned based on [Sensible Github Labels](https://github.com/Releque * links.json - JSON Hyper-Schema's Link Description Object meta-schema * hyper-schema-output.json - The recommended output format for JSON Hyper-Schema links -Install "xml2rfc" using "pip" (https://pypi.org/project/xml2rfc/) and type "make" at a shell to build the .txt and .html spec files: +The Makefile will create the necessary Python venv for you as part of the regular make target. + +`make clean` will remove all output including the venv. To clean just the spec output and +keep the venv, use `make spec-clean`. + +If you want to run `xml2rfc` manually after running make for the first time, you will +need to activate the virtual environment: ```sh -pip install --requirement requirements.txt -make +source .venv/bin/activate ``` The version of "xml2rfc" that this project uses is updated by modifying `requirements.in` and running `pip-compile requirements.in`.