forked from millejoh/emacs-ipython-notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
131 lines (114 loc) · 5.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
EMACS ?= $(shell which emacs)
SRC=$(shell cask files)
PKBUILD=2.3
ELCFILES = $(SRC:.el=.elc)
ifeq ($(TRAVIS_PULL_REQUEST_SLUG),)
TRAVIS_PULL_REQUEST_SLUG := $(shell git config --global user.name)/$(shell basename `git rev-parse --show-toplevel`)
endif
ifeq ($(TRAVIS_PULL_REQUEST_BRANCH),)
TRAVIS_PULL_REQUEST_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
endif
ifeq ($(TRAVIS_PULL_REQUEST_SHA),)
TRAVIS_PULL_REQUEST_SHA := $(shell if git show-ref --quiet --verify origin/$(TRAVIS_PULL_REQUEST_BRANCH) ; then git rev-parse origin/$(TRAVIS_PULL_REQUEST_BRANCH) ; fi))
endif
.DEFAULT_GOAL := test-compile
README.rst: README.in.rst lisp/ein.el
cask eval "(progn \
(add-to-list 'load-path \"./lisp\") \
(load \"ein-notebook\") \
(describe-minor-mode \"ein:notebook-mode\") \
(with-current-buffer \"*Help*\" (princ (buffer-string))))" 2>/dev/null \
| tools/readme-sed.sh "KEYS NOTEBOOK" README.in.rst "key.*binding" > README.rst0
sed "/CI VERSION/c"`grep -o 'emacs-[0-9][.0-9]*' .travis.yml | sort -n | head -1 | grep -o '[.0-9]*'` README.rst0 > README.rst1
grep ';;' lisp/ein.el \
| awk '/;;;\s*Commentary/{within=1;next}/;;;\s*/{within=0}within' \
| sed -e 's/^\s*;;*\s*//g' \
| tools/readme-sed.sh "COMMENTARY" README.rst1 > README.rst0
cask eval "(progn \
(add-to-list 'load-path \"./lisp\") \
(load \"ein-connect\") \
(describe-minor-mode \"ein:connect-mode\") \
(with-current-buffer \"*Help*\" (princ (buffer-string))))" 2>/dev/null \
| tools/readme-sed.sh "KEYS CONNECT" README.rst0 "key.*binding" > README.rst
rm README.rst0 README.rst1
.PHONY: autoloads
autoloads:
$(EMACS) -Q --batch --eval "(package-initialize)" --eval "(package-generate-autoloads \"ein\" \"./lisp\")"
.PHONY: clean
clean:
cask clean-elc
rm -rf test/test-install
rm -f log/*websocket*
rm -f features/Untitled*.ipynb
rm -f test/Untitled*.ipynb
.PHONY: dist-clean
dist-clean: clean
rm -rf dist
.PHONY: test-compile
test-compile: clean autoloads
# TODO When we are ready to properly compile, replace the disaster here
# with (setq byte-compile-error-on-warn t) --dickmao
cask install
! ( cask build 2>&1 | awk '{if (/^ /) { gsub(/^ +/, " ", $$0); printf "%s", $$0 } else { printf "\n%s", $$0 }}' | egrep -a "not known|Error|free variable|error for|Use of gv-ref|multiple times|Unused|but requires" )
cask clean-elc
.PHONY: quick
quick: test-compile test-ob-ein-recurse test-unit
.PHONY: test-jupyterhub
test-jupyterhub: test-compile
# jupyterhub slightly temperamental with json-readtable-error
# seems to be affecting ob-ipython too but probably my bug.. just need to find it
-cask exec ecukes --tags @jupyterhub --reporter magnars
.PHONY: test
test: quick test-int test-poly
.PHONY: test-poly
test-poly:
cask exec ert-runner -L ./lisp -L ./test -l test/testfunc.el test/test-poly.el test/test-func.el
cp test/test-poly.el features/support/test-poly.el
cask exec ecukes --reporter magnars ; (ret=$$? ; rm -f features/support/test-poly.el && exit $$ret)
.PHONY: test-int
test-int:
cask exec ert-runner -L ./lisp -L ./test -l test/testfunc.el test/test-func.el
cask exec ecukes --reporter magnars --tags ~@poly-complete
.PHONY: test-unit
test-unit:
cask exec ert-runner -L ./lisp -L ./test -l test/testein.el test/test-ein*.el
.PHONY: test-ob-ein-recurse
test-ob-ein-recurse:
cask eval "(progn (custom-set-variables (quote (org-babel-load-languages (quote ((emacs-lisp . t) (ein . t)))))) (org-version))"
.PHONY: test-install
test-install:
mkdir -p test/test-install
if [ ! -s "test/test-install/$(PKBUILD).tar.gz" ] ; then \
cd test/test-install ; curl -sLOk https://github.com/melpa/package-build/archive/$(PKBUILD).tar.gz ; fi
cd test/test-install ; tar xfz $(PKBUILD).tar.gz
cd test/test-install ; rm -f $(PKBUILD).tar.gz
cd test/test-install/package-build-$(PKBUILD) ; make -s loaddefs
mkdir -p test/test-install/recipes
cd test/test-install/recipes ; curl -sLOk https://raw.githubusercontent.com/melpa/melpa/master/recipes/ein
! ( $(EMACS) -Q --batch -L test/test-install/package-build-$(PKBUILD) \
--eval "(require 'package-build)" \
--eval "(require 'subr-x)" \
--eval "(package-initialize)" \
--eval "(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\"))" \
--eval "(package-refresh-contents)" \
--eval "(setq rcp (package-recipe-lookup \"ein\"))" \
--eval "(unless (file-exists-p package-build-archive-dir) \
(make-directory package-build-archive-dir))" \
--eval "(let* ((my-repo \"$(TRAVIS_PULL_REQUEST_SLUG)\") \
(my-branch \"$(TRAVIS_PULL_REQUEST_BRANCH)\") \
(my-commit \"$(TRAVIS_PULL_REQUEST_SHA)\")) \
(oset rcp :repo my-repo) \
(oset rcp :branch my-branch) \
(oset rcp :commit my-commit))" \
--eval "(package-build--package rcp (package-build--checkout rcp))" \
--eval "(package-install-file (car (file-expand-wildcards (concat package-build-archive-dir \"ein*.tar\"))))" 2>&1 | egrep -a "Error: " )
.PHONY: dist
dist:
rm -rf dist
cask package
.PHONY: install
install: dist
$(EMACS) -Q --batch --eval "(package-initialize)" \
--eval "(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\"))" \
--eval "(package-refresh-contents)" \
--eval "(package-install-file (car (file-expand-wildcards \"dist/ein*.tar\")))"