@@ -21,7 +21,7 @@ GOOS ?= $(word 1,$(GO_ENV))
21
21
GOARCH ?= $(word 2,$(GO_ENV ) )
22
22
ROOT_DIR := $(realpath .)
23
23
PKG_DIR := build/pkg/$(GOOS ) _$(GOARCH )
24
- PY_DIR := build/site-packages
24
+ PY_DIR := build/lib/python2.7/ site-packages
25
25
26
26
export GOPATH := $(ROOT_DIR ) /build
27
27
export PYTHONPATH := $(ROOT_DIR ) /$(PY_DIR )
@@ -31,10 +31,10 @@ COMPILER_BIN := build/bin/grumpc
31
31
COMPILER_SRCS := $(addprefix $(PY_DIR ) /grumpy/compiler/,$(notdir $(shell find compiler -name '* .py' -not -name '* _test.py') ) ) $(PY_DIR ) /grumpy/__init__.py
32
32
COMPILER_TESTS := $(patsubst % .py,grumpy/% ,$(filter-out compiler/expr_visitor_test.py compiler/stmt_test.py,$(wildcard compiler/* _test.py) ) )
33
33
COMPILER_TEST_SRCS := $(patsubst % ,$(PY_DIR ) /% .py,$(COMPILER_TESTS ) )
34
- COMPILER_SHARDED_TEST_SRCS := $(patsubst % ,build/site-packages /grumpy/compiler/% ,expr_visitor_test.py stmt_test.py)
34
+ COMPILER_SHARDED_TEST_SRCS := $(patsubst % ,$( PY_DIR ) /grumpy/compiler/% ,expr_visitor_test.py stmt_test.py)
35
35
COMPILER_PASS_FILES := $(patsubst % ,$(PY_DIR ) /% .pass,$(COMPILER_TESTS ) )
36
- COMPILER_EXPR_VISITOR_PASS_FILES := $(patsubst % ,build/site-packages /grumpy/compiler/expr_visitor_test.% of32.pass,$(shell seq 32) )
37
- COMPILER_STMT_PASS_FILES := $(patsubst % ,build/site-packages /grumpy/compiler/stmt_test.% of16.pass,$(shell seq 16) )
36
+ COMPILER_EXPR_VISITOR_PASS_FILES := $(patsubst % ,$( PY_DIR ) /grumpy/compiler/expr_visitor_test.% of32.pass,$(shell seq 32) )
37
+ COMPILER_STMT_PASS_FILES := $(patsubst % ,$( PY_DIR ) /grumpy/compiler/stmt_test.% of16.pass,$(shell seq 16) )
38
38
COMPILER_D_FILES := $(patsubst % ,$(PY_DIR ) /% .d,$(COMPILER_TESTS ) )
39
39
COMPILER := $(COMPILER_BIN ) $(COMPILER_SRCS )
40
40
@@ -64,6 +64,7 @@ BENCHMARK_BINS := $(patsubst %,build/%_benchmark,$(BENCHMARKS))
64
64
TOOL_BINS = $(patsubst % ,build/bin/% ,benchcmp coverparse diffrange)
65
65
66
66
GOLINT_BIN = build/bin/golint
67
+ PYLINT_BIN = build/bin/pylint
67
68
68
69
all : $(COMPILER ) $(RUNTIME ) $(STDLIB ) $(TOOL_BINS )
69
70
@@ -80,7 +81,7 @@ test: $(ACCEPT_PASS_FILES) $(COMPILER_PASS_FILES) $(COMPILER_EXPR_VISITOR_PASS_F
80
81
81
82
precommit : cover lint test
82
83
83
- .PHONY : all benchmarks clean cover lint precommit run test
84
+ .PHONY : all benchmarks clean cover golint lint precommit pylint run test
84
85
85
86
# ------------------------------------------------------------------------------
86
87
# grumpc compiler
@@ -105,13 +106,13 @@ $(COMPILER_D_FILES): $(PY_DIR)/%.d: $(PY_DIR)/%.py $(COMPILER_SRCS)
105
106
-include $(COMPILER_D_FILES )
106
107
107
108
# Does not depend on stdlibs since it makes minimal use of them.
108
- $(COMPILER_EXPR_VISITOR_PASS_FILES ) : build/site-packages/ grumpy/compiler/expr_visitor_test.% .pass: build/site-packages /grumpy/compiler/expr_visitor_test.py $(RUNNER_BIN ) $(COMPILER ) $(RUNTIME )
109
+ $(COMPILER_EXPR_VISITOR_PASS_FILES ) : $( PY_DIR ) / grumpy/compiler/expr_visitor_test.% .pass: $( PY_DIR ) /grumpy/compiler/expr_visitor_test.py $(RUNNER_BIN ) $(COMPILER ) $(RUNTIME )
109
110
@python $< --shard=$*
110
111
@touch $@
111
112
@echo ' compiler/expr_visitor_test $* PASS'
112
113
113
114
# Does not depend on stdlibs since it makes minimal use of them.
114
- $(COMPILER_STMT_PASS_FILES ) : build/site-packages/ grumpy/compiler/stmt_test.% .pass: build/site-packages /grumpy/compiler/stmt_test.py $(RUNNER_BIN ) $(COMPILER ) $(RUNTIME )
115
+ $(COMPILER_STMT_PASS_FILES ) : $( PY_DIR ) / grumpy/compiler/stmt_test.% .pass: $( PY_DIR ) /grumpy/compiler/stmt_test.py $(RUNNER_BIN ) $(COMPILER ) $(RUNTIME )
115
116
@python $< --shard=$*
116
117
@touch $@
117
118
@echo ' compiler/stmt_test $* PASS'
@@ -143,9 +144,17 @@ cover: $(RUNTIME_COVER_FILE) $(TOOL_BINS)
143
144
$(GOLINT_BIN ) :
144
145
@go get -u github.com/golang/lint/golint
145
146
146
- lint : $(GOLINT_BIN )
147
+ golint : $(GOLINT_BIN ) $( PYLINT_BIN )
147
148
@$(GOLINT_BIN ) -set_exit_status runtime
148
149
150
+ $(PYLINT_BIN ) :
151
+ @pip install --prefix=$(ROOT_DIR ) /build pylint
152
+
153
+ pylint : $(PYLINT_BIN )
154
+ @$(PYLINT_BIN ) compiler/* .py tools/{benchcmp,coverparse,diffrange,grumpc,grumprun}
155
+
156
+ lint : golint pylint
157
+
149
158
# ------------------------------------------------------------------------------
150
159
# Standard library
151
160
# ------------------------------------------------------------------------------
0 commit comments