File: rules

package info (click to toggle)
scikit-learn 0.20.2%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 51,036 kB
  • sloc: python: 108,171; ansic: 8,722; cpp: 5,651; makefile: 192; sh: 40
file content (163 lines) | stat: -rwxr-xr-x 4,841 bytes parent folder | download
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
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

# See also: skimage

PY2VERS ?= $(shell pyversions -vr)
PY3VER  ?= $(shell py3versions -vd)
PY3VERS ?= $(shell py3versions -vr)

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

export DEB_CFLAGS_MAINT_APPEND :=
export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  JOBS := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
  JOBS := 1
endif
export JOBS := $(JOBS)

include /usr/share/dpkg/architecture.mk

PYBUILD_TEST_ARGS = -m "not network" -v

# Some tests are known to fail randomly so need to be excluded ATM
ifeq ($(DEB_HOST_ARCH),arm64)
  # A bit aggressive exclusion of some tests which exhibit a problem I have no time to deal with on arm64
  PYBUILD_TEST_ARGS += -k-test_dump
endif

export PYBUILD_TEST_PYTEST := 1
# python2 soon deprecated -- doctests unreliable
export PYBUILD_TEST_ARGS_python2 := $(PYBUILD_TEST_ARGS)
export PYBUILD_TEST_ARGS_python3 := $(PYBUILD_TEST_ARGS)
export JOBLIB_MULTIPROCESSING := $(shell expr $(JOBS) / $$(expr $(words $(PY2VERS)) + $(words $(PY3VERS))))

# try to prevent unsunctioned downloads
export http_proxy := http://127.0.0.1:9/
export https_proxy := http://127.0.0.1:9/

# things in the doc building and tests try to access stuff in HOME (https://bugs.debian.org/915078)
export HOME=$(CURDIR)/tmp

%:
	dh $@ --with python2,python3,sphinxdoc --buildsystem pybuild  --parallel

%-arch:
	dh $@ --with python2,python3 --buildsystem pybuild --parallel

clean:
	dh $@ --with python2,python3 --buildsystem pybuild --parallel

override_dh_clean:
	dh_clean
	rm -rf .pytest_cache build scikit_learn.egg-info tmp
	-mv PKG-INFO-BAK PKG-INFO
	rm -f debian/build-stamp-*
	for i in $$(find -name '*.pyx'); do \
		rm -f $${i%.*}.c $${i%.*}.cpp; \
	done
	for i in $$(find -name '*.pyx.in'); do \
		rm -f $${i%.*}; \
	done
ifneq (,$(filter python-sklearn-doc,$(shell dh_listpackages)))
	+$(MAKE) -C doc clean
endif

#debian/build-stamp-pyx:
override_dh_auto_configure:
	mkdir -p tmp
	-mv PKG-INFO PKG-INFO-BAK
	python$(PY3VER) setup.py config
# 	dh_auto_configure
	mv PKG-INFO-BAK PKG-INFO

# Ensure sample and test data are copied to .pybuild
define PYBUILD_AFTER_BUILD
  for d in tests/data data descr images; do
    rm -rf {build_dir}/sklearn/datasets/$$d;
    ln -s {dir}/sklearn/datasets/$$d {build_dir}/sklearn/datasets/$$d;
  done;
endef
export PYBUILD_AFTER_BUILD

# Only with the default Python 3, additionally use pybuild to run
# sphinx once the build is complete
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
# FIXME: urllib.error.URLError -- have to ignore
define PYBUILD_AFTER_BUILD_python$(PY3VER)
  $(PYBUILD_AFTER_BUILD)
  PYTHONPATH={build_dir} \
  SPHINXBUILD="python$(PY3VER) -m sphinx -j $(JOBS) -D mathjax_path=MathJax.js" \
  SPHINXOPTS="-j $(JOBS) -D mathjax_path=MathJax.js" \
  $(MAKE) -C doc html || true;
  [ -d doc/_build/html ]
endef
export PYBUILD_AFTER_BUILD_python$(PY3VER)
endif

define PYBUILD_BEFORE_TEST
  (cd {build_dir} && python{version} -c 'import sklearn;  sklearn.show_versions()')
endef
export PYBUILD_BEFORE_TEST

export PYBUILD_AFTER_INSTALL = rm -f {destdir}/{install_dir}/_configtest*

override_dh_auto_build-arch:
	# Don't try to build docs in the arch build, so unset that hook
	env -u PYBUILD_AFTER_BUILD_python$(PY3VER) \
		dh_auto_build

override_dh_auto_test-indep:

override_dh_auto_install:
	dh_auto_install
	# cleanup python3 cache (mixing python3 subversions)
	-find debian/tmp -name "__pycache__" -exec rm -r {} +

override_dh_installdocs-arch:
	dh_installdocs -A README*.rst

override_dh_installdocs-indep:
	dh_installdocs -A README*.rst
ifneq (,$(filter python-sklearn-doc,$(shell dh_listpackages)))
    docdir=debian/python-sklearn-doc/usr/share/doc/python-sklearn-doc; \
	if [ -e $$docdir/stable ] ; then \
	mv \
		$$docdir/stable $$docdir/html; \
    fi
endif

override_dh_installchangelogs:
	dh_installchangelogs doc/whats_new.rst

# remove .so libraries from main package, and call dh_numpy*
_dh_python%:
	-find debian/python$(*:2=)-sklearn/usr/lib -name "*.so" -delete;

	dh_numpy$(*:2=) -ppython$(*:2=)-sklearn-lib
	dh_python$*

override_dh_python2: _dh_python2
override_dh_python3: _dh_python3

## immediately useable documentation and exemplar scripts/data
override_dh_compress:
	dh_compress -X.py -X.html -X.pdf -X.css -X.jpg -X.txt -X.js -X.json -X.rtc

override_dh_sphinxdoc-indep:
	@# no need to filter out this call, if sphinxdoc is not used it won't be called.
	dh_sphinxdoc -XMathJax.js -Xjquery.js


## to prepare next Debian upstream source tarball
dfsg: dfsg-releases
dfsg-%:
	git checkout dfsg
	-git merge --no-commit $*
	-git rm -rf sklearn/externals/joblib
	: # -git rm -f ./sklearn/svm/src/libsvm/svm.*
	git commit -m "Merge $* into DFSG (pruning externals: joblib)" -a
	git checkout debian