1
1
# === makefile ------------------------------------------------------------===
2
2
3
3
ROOT =$(shell pwd)
4
- CACHE_ROOT =${ROOT}/.cache
5
- PKG_ROOT =${ROOT}/.pkg
4
+ CACHE =${ROOT}/.cache
5
+ PYENV =${ROOT}/.pyenv
6
+ CONF =${ROOT}/conf
7
+ APP_NAME =p2pool
6
8
7
9
-include Makefile.local
8
10
9
11
.PHONY : all
10
- all : ${PKG_ROOT}/.stamp-h
12
+ all : python-env
11
13
12
14
.PHONY : check
13
15
check : all
14
- " ${PKG_ROOT } " /bin/coverage run " ${PKG_ROOT } " /bin/trial p2pool
15
- " ${PKG_ROOT } " /bin/coverage xml -o build/report/coverage.xml
16
+ " ${PYENV } " /bin/coverage run " ${PYENV } " /bin/trial p2pool
17
+ " ${PYENV } " /bin/coverage xml -o build/report/coverage.xml
16
18
17
19
.PHONY : run
18
20
run : all
19
- " ${PKG_ROOT } " /bin/python run_p2pool.py
21
+ " ${PYENV } " /bin/python run_p2pool.py
20
22
21
23
.PHONY : shell
22
24
shell : all
23
- " ${PKG_ROOT } " /bin/ipython
25
+ " ${PYENV } " /bin/ipython
24
26
25
27
.PHONY : mostlyclean
26
28
mostlyclean :
@@ -29,11 +31,11 @@ mostlyclean:
29
31
30
32
.PHONY : clean
31
33
clean : mostlyclean
32
- -rm -rf " ${PKG_ROOT } "
34
+ -rm -rf " ${PYENV } "
33
35
34
36
.PHONY : distclean
35
37
distclean : clean
36
- -rm -rf " ${CACHE_ROOT } "
38
+ -rm -rf " ${CACHE } "
37
39
38
40
.PHONY : maintainer-clean
39
41
maintainer-clean : distclean
@@ -45,55 +47,73 @@ dist:
45
47
46
48
# ===--------------------------------------------------------------------===
47
49
48
- ${CACHE_ROOT}/virtualenv/virtualenv-1.10.1.tar.gz :
49
- mkdir -p ${CACHE_ROOT} /virtualenv
50
- sh -c " cd ${CACHE_ROOT} /virtualenv && curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz"
51
-
52
- ${PKG_ROOT}/.stamp-h : conf/requirements* .pip ${CACHE_ROOT}/virtualenv/virtualenv-1.10.1.tar.gz
53
- # Because build and run-time dependencies are not thoroughly tracked,
54
- # it is entirely possible that rebuilding the development environment
55
- # on top of an existing one could result in a broken build. For the
56
- # sake of consistency and preventing unnecessary, difficult-to-debug
57
- # problems, the entire development environment is rebuilt from scratch
58
- # everytime this make target is selected.
59
- ${MAKE} clean
60
-
61
- # The ``${PKG_ROOT}`` directory, if it exists, is removed by the
62
- # ``clean`` target. The PyPI cache is nonexistant if this is a freshly
63
- # checked-out repository, or if the ``distclean`` target has been run.
64
- # This might cause problems with build scripts executed later which
65
- # assume their existence, so they are created now if they don't
66
- # already exist.
67
- mkdir -p " ${PKG_ROOT} "
68
- mkdir -p " ${CACHE_ROOT} " /pypi
50
+ ${CACHE}/pyenv/virtualenv-1.11.6.tar.gz :
51
+ mkdir -p " ${CACHE} " /pyenv
52
+ curl -L ' https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.11.6.tar.gz' > ' $@' || { rm -f ' $@' ; exit 1; }
53
+
54
+ ${CACHE}/pyenv/pyenv-1.11.6-base.tar.gz : ${CACHE}/pyenv/virtualenv-1.11.6.tar.gz
55
+ -rm -rf " ${PYENV} "
56
+ mkdir -p " ${PYENV} "
69
57
70
- # `` virtualenv`` is used to create a separate Python installation for
71
- # this project in ``${PKG_ROOT}`` .
58
+ # virtualenv is used to create a separate Python installation
59
+ # for this project in ${PYENV} .
72
60
tar \
73
- -C " ${CACHE_ROOT} " /virtualenv --gzip \
74
- -xf " ${CACHE_ROOT} " /virtualenv/virtualenv-1.10.1.tar.gz
75
- python " ${CACHE_ROOT} " /virtualenv/virtualenv-1.10.1/virtualenv.py \
76
- --clear \
77
- --distribute \
78
- --never-download \
79
- --prompt=" (p2pool) " \
80
- " ${PKG_ROOT} "
81
- -rm -rf " ${CACHE_ROOT} " /virtualenv/virtualenv-1.10.1
61
+ -C " ${CACHE} " /pyenv --gzip \
62
+ -xf " ${CACHE} " /pyenv/virtualenv-1.11.6.tar.gz
63
+ python " ${CACHE} " /pyenv/virtualenv-1.11.6/virtualenv.py \
64
+ --clear \
65
+ --distribute \
66
+ --never-download \
67
+ --prompt=" (${APP_NAME} ) " \
68
+ " ${PYENV} "
69
+ -rm -rf " ${CACHE} " /pyenv/virtualenv-1.11.6
70
+
71
+ # Snapshot the Python environment
72
+ tar -C " ${PYENV} " --gzip -cf " $@ " .
73
+ rm -rf " ${PYENV} "
74
+
75
+ ${CACHE}/pyenv/pyenv-1.11.6-extras.tar.gz : ${CACHE}/pyenv/pyenv-1.11.6-base.tar.gz ${ROOT}/requirements.txt ${CONF}/requirements* .txt
76
+ -rm -rf " ${PYENV} "
77
+ mkdir -p " ${PYENV} "
78
+ mkdir -p " ${CACHE} " /pypi
79
+
80
+ # Uncompress saved Python environment
81
+ tar -C " ${PYENV} " --gzip -xf " ${CACHE} " /pyenv/pyenv-1.11.6-base.tar.gz
82
+ find " ${PYENV} " -not -type d -print0 > " ${ROOT} " /.pkglist
82
83
83
- # readline is installed here to get around a bug on Mac OS X which is
84
- # causing readline to not build properly if installed from pip.
85
- " ${PKG_ROOT} " /bin/easy_install readline
84
+ # readline is installed here to get around a bug on Mac OS X
85
+ # which is causing readline to not build properly if installed
86
+ # from pip, and the fact that a different package must be used
87
+ # to support it on Windows/Cygwin.
88
+ if [ " x` uname -s` " = " xCygwin" ]; then \
89
+ " ${PYENV} " /bin/pip install pyreadline; \
90
+ else \
91
+ " ${PYENV} " /bin/easy_install readline; \
92
+ fi
86
93
87
94
# pip is used to install Python dependencies for this project.
88
- for reqfile in conf/requirements* .pip; do \
89
- " ${PKG_ROOT} " /bin/python " ${PKG_ROOT} " /bin/pip install \
90
- --download-cache=" ${CACHE_ROOT} " /pypi \
91
- -r $$ reqfile; \
95
+ for reqfile in " ${ROOT} " /requirements.txt \
96
+ " ${CONF} " /requirements* .txt; do \
97
+ " ${PYENV} " /bin/python " ${PYENV} " /bin/pip install \
98
+ --download-cache=" ${CACHE} " /pypi \
99
+ -r " $$ reqfile" || exit 1; \
92
100
done
93
101
94
- # All done!
95
- touch " ${PKG_ROOT} " /.stamp-h
102
+ # Snapshot the Python environment
103
+ cat " ${ROOT} " /.pkglist | xargs -0 rm -rf
104
+ tar -C " ${PYENV} " --gzip -cf " $@ " .
105
+ rm -rf " ${PYENV} " " ${ROOT} " /.pkglist
96
106
97
- # ===--------------------------------------------------------------------===
98
- # End of File
99
- # ===--------------------------------------------------------------------===
107
+ .PHONY :
108
+ python-env : ${PYENV}/.stamp-h
109
+
110
+ ${PYENV}/.stamp-h : ${CACHE}/pyenv/pyenv-1.11.6-base.tar.gz ${CACHE}/pyenv/pyenv-1.11.6-extras.tar.gz
111
+ -rm -rf " ${PYENV} "
112
+ mkdir -p " ${PYENV} "
113
+
114
+ # Uncompress saved Python environment
115
+ tar -C " ${PYENV} " --gzip -xf " ${CACHE} " /pyenv/pyenv-1.11.6-base.tar.gz
116
+ tar -C " ${PYENV} " --gzip -xf " ${CACHE} " /pyenv/pyenv-1.11.6-extras.tar.gz
117
+
118
+ # All done!
119
+ touch " $@ "
0 commit comments