forked from tkf/emacs-jedi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
202 lines (149 loc) · 4.97 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
ENV = $(PWD)/env
VIRTUALENV_SYSTEM_SITE_PACKAGES ?= true
VIRTUALENV = \
VIRTUALENV_SYSTEM_SITE_PACKAGES=$(VIRTUALENV_SYSTEM_SITE_PACKAGES) \
virtualenv --python=$(PYTHON)
PIP_INSTALL = $(ENV)/$(BINDIR)/pip install
JEDI_DEV_URL = https://github.com/davidhalter/jedi/archive/dev.zip
PYTHON ?= python
CASK ?= cask
export EMACS ?= emacs
BINDIR ?= bin
ELPA_DIR = $(shell EMACS=$(EMACS) $(CASK) package-directory)
# See: cask-elpa-dir
VIRTUAL_EMACS = ${CASK} exec ${EMACS} -Q \
--eval "(setq jedi:environment-root \"$(ENV)\")"
.PHONY : test test-1 tryout clean-elpa requirements env clean-env clean \
print-deps travis-ci doc
TEST_DEPS = elpa env
test: ${TEST_DEPS}
${MAKE} test-1
test-1:
${VIRTUAL_EMACS} -batch \
-L . -l test-jedi.el -f ert-run-tests-batch-and-exit
tox
compile: elpa clean-elc
${VIRTUAL_EMACS} -batch \
-L . -f batch-byte-compile *.el
clean-elc:
rm -rf *.elc
tryout: compile env
${VIRTUAL_EMACS} -L . -l tryout-jedi.el
doc: elpa
make -C doc html
ensure-git:
test -d .git # Running task that can be run only in git repository
elpa: ${ELPA_DIR}
${ELPA_DIR}: Cask
${CASK} install
test -d $@
touch $@
clean-elpa:
rm -rf ${ELPA_DIR}
requirements:
@echo "**************************************************************"
@echo " ERROR: \"make requirements\" is obsolete!"
@echo " Please run \"M-x jedi:install-server\" inside of your Emacs."
@echo " * If you are using el-get, please update it first."
@echo " See also: https://github.com/dimitri/el-get/pull/1603"
@echo "**************************************************************"
@exit 1
install-jedi-dev:
${PIP_INSTALL} --upgrade ${JEDI_DEV_URL}
env: $(ENV)/$(BINDIR)/jediepcserver
$(ENV)/$(BINDIR)/jediepcserver: setup.py
${VIRTUAL_EMACS} -batch -L . -l jedi.el \
--eval "(setq jedi:install-server--command '(\"pip\" \"install\" \"--editable\" \"$(PWD)\"))" \
-f "jedi:install-server-block"
test -x $@
clean-env:
rm -rf $(ENV)
clean-el: clean-elpa clean-elc
clean: clean-env clean-el
rm -rf .cask
print-deps: elpa env
@echo "----------------------- Dependencies -----------------------"
$(EMACS) --version
${VIRTUAL_EMACS} -batch -L . -l jedi.el -f jedi:print-jedi-version
-ls -d $(ENV)/*/python*/site-packages/*egg-info
@echo "------------------------------------------------------------"
before-test: ${TEST_DEPS}
tox --notest
travis-ci: print-deps test
test ! -d ~/.emacs.d/.python-environments
# Run test against Emacs listed in ${EMACS_LIST}.
# This is for running tests for multiple Emacs versions.
# This is not used in Travis CI. Usage::
#
# make EMACS_LIST="emacs emacs-snapshot emacs23" test-all
#
# See: http://stackoverflow.com/a/12110773/727827
#
# Use ${MET_MAKEFLAGS} to do the tests in parallel.
#
# MET_MAKEFLAGS=-j4
JOBS := $(addprefix job-,${EMACS_LIST})
.PHONY: ${JOBS}
${JOBS}: job-%:
${MAKE} EMACS=$* clean-elc elpa
${MAKE} EMACS=$* ${MET_MAKEFLAGS} test-1
test-all: env ${JOBS}
### Packaging
#
# Create dist/${PACKAGE}-${VERSION}.tar.gz ready for distribution.
#
# See: (info "(elisp) Multi-file Packages")
PACKAGE = jedi
VERSION = $(shell grep ';; Version:' jedi.el | sed 's/^.* \([0-9].*\)$$/\1/')
DIST_FILES = jedi-pkg.el jedi.el jediepcserver.py \
Makefile tryout-jedi.el
.PHONY: dist ${PACKAGE}-${VERSION}.tar.gz ${PACKAGE}-${VERSION} \
clean-dist clean-dist-all
dist: clean-dist
${MAKE} dist-1
dist-1: dist/${PACKAGE}-${VERSION}.tar dist/${PACKAGE}-${VERSION}.tar.gz
dist/${PACKAGE}-${VERSION}.tar: ${PACKAGE}-${VERSION}.tar
${PACKAGE}-${VERSION}.tar: ${PACKAGE}-${VERSION}
tar --directory dist -cvf dist/$@ $<
dist/${PACKAGE}-${VERSION}.tar.gz: ${PACKAGE}-${VERSION}.tar.gz
${PACKAGE}-${VERSION}.tar.gz: ${PACKAGE}-${VERSION}
tar --directory dist -cvzf dist/$@ $<
${PACKAGE}-${VERSION}: dist/${PACKAGE}-${VERSION}
dist/${PACKAGE}-${VERSION}:
mkdir -p $@
cp -v ${DIST_FILES} $@
clean-dist:
rm -rf dist/${PACKAGE}-${VERSION}*
clean-dist-all:
rm -rf dist
### Package installation
PACKAGE_USER_DIR =
TEST_PACKAGE_DIR = dist/test
install-dist:
test -d '${PACKAGE_USER_DIR}'
${EMACS} --batch -Q \
-l package \
--eval " \
(add-to-list 'package-archives \
'(\"marmalade\" . \"http://marmalade-repo.org/packages/\") t)" \
--eval '(setq package-user-dir "${PWD}/${PACKAGE_USER_DIR}")' \
--eval '(package-list-packages)' \
--eval '(package-install-file "${PWD}/dist/${PACKAGE}-${VERSION}.tar")'
test-install: dist/${PACKAGE}-${VERSION}.tar
rm -rf ${TEST_PACKAGE_DIR}
mkdir -p ${TEST_PACKAGE_DIR}
${MAKE} install-dist PACKAGE_USER_DIR=${TEST_PACKAGE_DIR}
test-install-requirement: test-install
${MAKE} --directory ${TEST_PACKAGE_DIR}/${PACKAGE}-${VERSION} \
requirements
### GH pages
MAKE_GH_PAGES = $(MAKE) --directory doc --file gh-pages.mk
gh-pages-latest:
$(MAKE_GH_PAGES)
# Publish released documentation. This task can be run only when the
# current revision has tag (i.e., released).
gh-pages-released:
# Make sure it's on tag
git describe --tags --dirty | grep -v -
# Run doc/gh-pages.mk
$(MAKE_GH_PAGES) DOC_VER=released