Skip to content

Commit 4468327

Browse files
authored
Merge pull request #1280 from handrews/ignore-venv
Make targets for a virtualenv
2 parents 51326f8 + 49ca037 commit 4468327

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ jsonschema-*.txt
44
relative-json-pointer.html
55
relative-json-pointer.pdf
66
relative-json-pointer.txt
7+
8+
# For the Python enviornment
9+
.venv

Makefile

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
XML2RFC ?= xml2rfc
2+
VENV ?= .venv
23

34
OUT = \
45
jsonschema-core.html jsonschema-core.txt \
56
jsonschema-validation.html jsonschema-validation.txt \
67
relative-json-pointer.html relative-json-pointer.txt
78

8-
9-
all: $(OUT)
9+
all: $(VENV) $(OUT)
1010

1111
%.txt: %.xml
1212
$(XML2RFC) --text $< -o $@
@@ -25,7 +25,15 @@ json-schema.tar.gz: $(OUT)
2525
tar -czf json-schema.tar.gz --exclude '.*' json-schema
2626
rm -rf json-schema
2727

28-
clean:
28+
$(VENV): requirements.txt
29+
python -m venv $@
30+
$@/bin/python -m pip install --upgrade pip
31+
$@/bin/python -m pip install -r $<
32+
33+
spec-clean:
2934
rm -f $(OUT) json-schema.tar.gz
3035

31-
.PHONY: clean all
36+
clean: spec-clean
37+
rm -rf $(VENV)
38+
39+
.PHONY: spec-clean clean all

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ Labels are assigned based on [Sensible Github Labels](https://github.com/Releque
3535
* links.json - JSON Hyper-Schema's Link Description Object meta-schema
3636
* hyper-schema-output.json - The recommended output format for JSON Hyper-Schema links
3737

38-
Install "xml2rfc" using "pip" (https://pypi.org/project/xml2rfc/) and type "make" at a shell to build the .txt and .html spec files:
38+
The Makefile will create the necessary Python venv for you as part of the regular make target.
39+
40+
`make clean` will remove all output including the venv. To clean just the spec output and
41+
keep the venv, use `make spec-clean`.
42+
43+
If you want to run `xml2rfc` manually after running make for the first time, you will
44+
need to activate the virtual environment:
3945

4046
```sh
41-
pip install --requirement requirements.txt
42-
make
47+
source .venv/bin/activate
4348
```
4449

4550
The version of "xml2rfc" that this project uses is updated by modifying `requirements.in` and running `pip-compile requirements.in`.

0 commit comments

Comments
 (0)