File: rules

package info (click to toggle)
scikit-learn 1.4.2%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 25,036 kB
  • sloc: python: 201,105; cpp: 5,790; ansic: 854; makefile: 304; sh: 56; javascript: 20
file content (232 lines) | stat: -rwxr-xr-x 9,035 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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

# See also: skimage

# This was used as last resort to advance the python3.10 transition by Paul Gevers in NMU, disable the tests during build (see: #1003165)
# export DEB_BUILD_OPTIONS += nocheck

include /usr/share/dpkg/default.mk

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

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

export DEB_CFLAGS_MAINT_APPEND := -Wno-incompatible-pointer-types
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)
export JOBLIB_MULTIPROCESSING=0

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

# don't run network tests at build time
EXCLUDE_TESTS = not test_load_boston_alternative and \
                not test_fetch_openml and \
                not test_missing_values_pandas and \
                not test_illegal_column and \
                not test_dataset_with_openml_warning and \
                not test_string_attribute_without_dataframe and \
                not test_warn_ignore_attribute and \
                not test_raises_illegal_multitarget and \
                not test_fetch_nonexiting and \
                not test_decode_emotions and \
                not test_decode_cpu and \
                not test_decode_anneal and \
                not test_decode_iris and \
                not test_dataset_with_openml_error and \
                not test_convert_arff_data_dataframe_warning_low_memory_pandas
# Until https://github.com/scikit-learn/scikit-learn/issues/17798
# is not solved
EXCLUDE_TEST += and not sklearn.ensemble._weight_boosting.AdaBoostRegressor

# need version of scikit-learn newer than 1.4 to support scipy 1.15 fully. In the meantime skip failing tests
EXCLUDE_TEST += and not test_csr_polynomial_expansion_index_overflow[csr_array-False-True

IGNORE_ERRORS=
ERROR_LOG=record
#we rather want to record the test suite errors in build log than ignoring the potentially failing tests
ifeq ($(ERROR_LOG),ignore)
# 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
  EXCLUDE_TESTS += and not test_dump
endif

# Its a shame that nobody cares for all architectures but we do not have the manpower to fix all tests
ifeq ($(DEB_HOST_ARCH),armel)
  # Ignored due to bug #1003165
  EXCLUDE_TESTS += and not test_tfidf_no_smoothing
  EXCLUDE_TESTS += and not test_qda_regularization
endif

# Until these are fixed:
# https://github.com/scikit-learn/scikit-learn/issues/16443
# https://github.com/scikit-learn/scikit-learn/issues/13052
## armhf is in a really bad state,  The log says "Fatal Python error: Bus error".  This really needs to be investigated
ifeq ($(DEB_HOST_ARCH),armhf)
  EXCLUDE_TESTS += and not test_check_estimators_stacking_estimator
  EXCLUDE_TESTS += and not test_check_estimators_voting_estimator
  EXCLUDE_TESTS += and not test_apply_path_readonly_all_trees
  EXCLUDE_TESTS += and not test_check_estimator
  EXCLUDE_TESTS += and not test_check_estimator_clones
  EXCLUDE_TESTS += and not test_check_estimator_pairwise
  EXCLUDE_TESTS += and not test_novelty_true_common_tests
  # This is actually a test generator, so this skips a *lot* of tests
  EXCLUDE_TESTS += and not test_common
endif

# Its a shame that nobody cares for all architectures but we do not have the manpower to fix all tests
ifeq ($(DEB_HOST_ARCH),mips64el)
  # Ignored due to bug #1003165
  EXCLUDE_TESTS += and not test_lasso_lars_vs_R_implementation
endif

# TBD. See https://bugs.debian.org/967977
ifeq ($(DEB_HOST_ARCH),s390x)
  EXCLUDE_TESTS += and not test_gaussian_kde
  EXCLUDE_TESTS += and not test_gaussian_kde
endif
ifeq ($(DEB_HOST_ARCH),alpha)
  EXCLUDE_TESTS += and not test_gaussian_kde
endif

# Same test, but not entirely the same results as above. Assuming same cause
ifeq ($(DEB_HOST_ARCH),i386)
  EXCLUDE_TESTS += and not test_gaussian_kde
  EXCLUDE_TESTS += and not test_y_multioutput
  EXCLUDE_TESTS += and not test_svc_ovr_tie_breaking[NuSVC]
endif


# Until https://github.com/scikit-learn/scikit-learn/issues/19230 is open
ifeq ($(DEB_HOST_ARCH),i368)
  EXCLUDE_TESTS += and not test_convergence_dtype_consistency
endif

else
# for all architectures that are known to have failures in test suite we are ignoring these
ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH), i386 loong64 mipsel mips64el hppa armel armhf arm64 ppc64 ppc64el s390x alpha riscv64 amd64))
  # Ignored due to bug #1003165
IGNORE_ERRORS= || true
endif
endif

# This is used by patch sphinx-doc-no-download.patch to prevent the sphinx
# doc build from downloading datasets, while not breaking the actual download
# functionality when user runs the same function. Disabling downloads also
# makes the build slightly faster. See also #1015805
export DEBIAN_POLICY_SECTION_4_9_NO_NETWORK_ACCESS=1

%:
	dh $@ --buildsystem pybuild

execute_after_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
	find . -name "bootstrap.min*" -delete
ifneq (,$(filter python-sklearn-doc,$(shell dh_listpackages)))
	+$(MAKE) -C doc clean
endif

execute_after_dh_auto_configure:
	# Provide bootstrap links even at build process - otherwise sphinx fails
	mkdir -p doc/themes/scikit-learn-modern/static/css/vendor/
	ln -s /usr/share/javascript/bootstrap4/css/bootstrap.min.css doc/themes/scikit-learn-modern/static/css/vendor/bootstrap.min.css
	mkdir -p doc/themes/scikit-learn-modern/static/js/vendor
	ln -s /usr/share/javascript/bootstrap4/js/bootstrap.min.js doc/themes/scikit-learn-modern/static/js/vendor/bootstrap.min.js
	ln -s /usr/share/javascript/jquery/jquery.min.js           doc/themes/scikit-learn-modern/static/js/vendor/jquery-3.6.3.slim.min.js

# 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

execute_after_dh_auto_build-indep:
# Only with the default Python 3, additionally use pybuild to run
# sphinx once the build is complete.
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(shell pybuild --print build_dir  --interpreter python3) \
	http_proxy='127.0.0.1.9' \
	https_proxy='127.0.0.1.9' \
	SPHINXBUILD="python$(PY3VER) -m sphinx" \
	$(MAKE) -C doc html SPHINXOPTS="-j $(JOBS)" || true;
	[ -d doc/_build/html ]
endif

export PYBUILD_TEST_PYTEST := 1
export PYBUILD_TEST_ARGS := -m "not network" -v $(DEB_BUILD_OPTION_PARALLEL:%=-n %) --color=no -k "$(EXCLUDE_TESTS)"
define PYBUILD_BEFORE_TEST
  (mv $(CURDIR)/sklearn/conftest.py $(CURDIR)/sklearn/conftest.py.test; \
   mv $(CURDIR)/sklearn/datasets/tests/conftest.py $(CURDIR)/sklearn/datasets/tests/conftest.py.test; \
   cd {build_dir} && python{version} -c 'import sklearn; sklearn.show_versions()')
endef
export PYBUILD_BEFORE_TEST
define PYBUILD_AFTER_TEST
  (mv $(CURDIR)/sklearn/conftest.py.test $(CURDIR)/sklearn/conftest.py; \
   mv $(CURDIR)/sklearn/datasets/tests/conftest.py.test $(CURDIR)/sklearn/datasets/tests/conftest.py)
endef
export PYBUILD_AFTER_TEST

# Nothing to do for indep
override_dh_auto_test-indep:

override_dh_auto_test-arch:
	dh_auto_test -a $(IGNORE_ERRORS)

export PYBUILD_AFTER_INSTALL = rm -f {destdir}/{install_dir}/_configtest*
execute_after_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
	if [ -e debian/README.Debian.$(DEB_HOST_ARCH) ] ; then dh_installdocs -A debian/README.Debian.$(DEB_HOST_ARCH) ; fi

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_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 -Xsearchtools.js