forked from blampe/IbPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (54 loc) · 2.4 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
##
## This is the IbPy distribution Makefile. Use this file to build a
## source distribution only after the source has been edited, remade,
## and checked into the repository.
##
## To build a source distribution, run:
##
## make dist
##
ibpy_ver := 0.8.0
ibpy_rev := $(shell svnversion|cut -f 2 -d \:|cut -f 1 -d M)
twsapi_ver := $(shell cat ib/ext/src/IBJts/API_VersionNum.txt |cut -f 2 -d \=)
release_num := $(ibpy_ver)-$(twsapi_ver)
release_dir := release-$(release_num)
release_date := $(shell date +"%d %b %Y")
release_root := IbPy-$(release_num)
release_file := $(release_root).tar.gz
svn_root := http://ibpy.googlecode.com/svn/trunk
.PHONY: all clean test
.SILENT: clean $(release_dir)
all: dist
test:
PYTHONPATH=. ./demo/api_coverage
tests: test
clean:
$(if $(wildcard $(release_dir)), echo [W] removing release directory $(release_dir)).
rm -rf $(release_dir)
dist: $(release_dir)
README.mkd:
sed s/\:release_num\:/$(release_num)/ .README.in > README.mkd
sed -i '.bak' s/\:release_date\:/"$(release_date)"/ README.mkd
sed -i '.bak' s/\:twsapi_ver\:/$(twsapi_ver)/ README.mkd
sed -i '.bak' s/\:release_file\:/$(release_file)/ README.mkd
sed -i '.bak' s/\:release_root\:/$(release_root)/ README.mkd
mv README.mkd.bak README.mkd
$(release_dir): README.mkd
echo [I] building release=$(release_num) version=$(ibpy_ver) revision=$(ibpy_rev) api=$(twsapi_ver).
echo [I] exporting source from $(svn_root) into $(release_dir).
svn export $(svn_root) $(release_dir) > /dev/null
echo [I] overwriting ib/ and demo/ with local source
cp -r ib/ $(release_dir)/ib
cp -r demo/ $(release_dir)/demo
echo [I] fixing version strings
cd $(release_dir)/ib && sed -i '.bak' s/api\ \=\ \"0\"/api\ \=\ \"$(twsapi_ver)\"/ __init__.py
cd $(release_dir)/ib && sed -i '.bak' s/version\ \=\ \"0\"/version\ \=\ \"$(release_num)\"/ __init__.py
cd $(release_dir)/ib && sed -i '.bak' s/revision\ \=\ \"r0\"/revision\ \=\ \"r$(ibpy_rev)\"/ __init__.py
cd $(release_dir) && mv setup.py.in setup.py
cd $(release_dir)/ && sed -i '.bak' s/version\ \=\ \"0\"/version\ \=\ \"$(release_num)\"/ setup.py
cd $(release_dir)/ && sed -i '.bak' s/\:release_file\:/$(release_file)/ setup.py
cp README.mkd $(release_dir)/README
echo [I] building source distribution
cd $(release_dir) && python setup.py sdist --formats=gztar,zip > /dev/null
echo [I] source distribution complete. files in ./$(release_dir)/dist/
ls $(release_dir)/dist