Skip to content

Commit

Permalink
use Python virtualenv also for main Makefile
Browse files Browse the repository at this point in the history
* Makefile and tests/Makefile run Python scripts
* so have a global virtualenv to make sure all
  required Python modules are available
  • Loading branch information
darxriggs committed Sep 15, 2015
1 parent 7eee6c8 commit 4081d0f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ last_run

*.test
.DS_Store

env
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,26 @@ coverage:
benchmark:
$(GODEP) go test -short -bench=. ./...

.PHONY: env
env: env/bin/activate
env/bin/activate: requirements.txt
test -d env || virtualenv env > /dev/null
. env/bin/activate && pip install -Ur requirements.txt > /dev/null
touch env/bin/activate

.PHONY: gen
gen:
gen: env
./scripts/generate_gettingstarted.sh docs/gettingstarted.in.asciidoc docs/gettingstarted.asciidoc
python scripts/generate_template.py etc/fields.yml etc/packetbeat.template.json
python scripts/generate_field_docs.py etc/fields.yml docs/fields.asciidoc
. env/bin/activate && python scripts/generate_template.py etc/fields.yml etc/packetbeat.template.json
. env/bin/activate && python scripts/generate_field_docs.py etc/fields.yml docs/fields.asciidoc

.PHONY: clean
clean:
-rm packetbeat
-rm packetbeat.test
-rm -r packetbeat-$(VERSION)
-rm -r coverage
-rm -r env

# Generates packetbeat.test coverage testing binary
packetbeat.test: $(GOFILES)
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@

last_run
run
env
12 changes: 3 additions & 9 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ SHELL := /bin/bash
PROCESSES ?= 4
TIMEOUT ?= 30

env: env/bin/activate
env/bin/activate: requirements.txt
test -d env || virtualenv env > /dev/null
. env/bin/activate && pip install -Ur requirements.txt > /dev/null
touch env/bin/activate

.PHONY: test
test: env
test:
make -C .. packetbeat.test
. env/bin/activate; nosetests --processes=${PROCESSES} --process-timeout=$(TIMEOUT)
make -C .. env
. ../env/bin/activate && nosetests --processes=${PROCESSES} --process-timeout=$(TIMEOUT)

.PHONY: coverage
coverage: test
Expand All @@ -25,6 +20,5 @@ coverage: test

.PHONY: clean
clean:
-rm -r env
-rm -r run
-rm last_run

0 comments on commit 4081d0f

Please sign in to comment.