File: rules

package info (click to toggle)
pandas 2.2.3%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,784 kB
  • sloc: python: 422,228; ansic: 9,190; sh: 270; xml: 102; makefile: 83
file content (130 lines) | stat: -rwxr-xr-x 6,849 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
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

PY3VERS := $(shell py3versions -vr)
PY3VER := $(shell py3versions -vd)
SOURCE_DATE:=$(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%a, %d %b %Y" || echo "xxx, xx xxx xxxx")
SOURCE_TIME:=$(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%T" || echo "xx:xx:xx")

UVER := $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's,+dfsg,,g')
# Python doesn't use ~ for rc
UVER_PY := $(shell echo $(UVER) | sed -e 's,[~],,g')
UVER_PYSHORT := $(shell echo $(UVER_PY) | sed -e 's,+git.*,,g')

# Filter out tests with "marker expressions" and "keyword expressions". Ref: pytest(1)
ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH), amd64 i386 kfreebsd-amd64 kfreebsd-i386 x32))
	PYTEST_MARKER := not network
else
	PYTEST_MARKER := not network and not slow
endif
ifeq (,$(findstring mips,$(DEB_HOST_ARCH))$(findstring hppa,$(DEB_HOST_ARCH))$(findstring _ia64_,_$(DEB_HOST_ARCH)_))
	PYTEST_WARN_IGNORE :=
else
	# mips/hppa may have unusual NaN behaviour
	# https://en.wikipedia.org/wiki/NaN#Encoding
	# ia64 warns in test_groupby_quantile_all_na_group_masked (see 2.0.3+dfsg-6 build log)
	PYTEST_WARN_IGNORE := -W "ignore:invalid value encountered:RuntimeWarning"
endif

# for matplotlib etc
export HOME=$(CURDIR)/buildtmp

# Split up the test suite to avoid running out of memory, use xvfb for plot tests, run but ignore potentially crashing tests; test_register_entrypoint expects an installed package, test_wrong_url needs internet, test_statsmodels is a circular dependency when adding a new Python version
# The echo-random-characters is to allow searching for fails that don't show the usual test failure message i.e. crashes/errors
# -v makes the log too long for salsa-ci
# the grep -q is because trying to test __pycache__ is an error in pytest 8+, #1063959
export PYBUILD_TEST_ARGS=TEST_SUCCESS=true; cd {build_dir} ; for TEST_SUBSET in {build_dir}/pandas/tests/* ; do echo $$TEST_SUBSET | grep -q -e __pycache__ || PANDAS_CI=1 LC_ALL=C.UTF-8 xvfb-run -a -s "-screen 0 1280x1024x24 -noreset" {interpreter} -m pytest -s -m "$(PYTEST_MARKER)" $(PYTEST_WARN_IGNORE) -k "not test_register_entrypoint and not test_wrong_url and not test_statsmodels" --confcutdir={build_dir}/pandas --deb-data-root-dir={dir}/pandas/tests $$TEST_SUBSET || test $$? = 5 || TEST_SUCCESS=false && echo "rdjoqkol test state = $$TEST_SUCCESS"; done ; rm -rf test-data.xml test_stata.dta .pytest_cache ; $$TEST_SUCCESS

export PYBUILD_EXT_DESTDIR=debian/python3-pandas-lib
export PYBUILD_DESTDIR=debian/python3-pandas

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

export SHELL=/bin/bash

# Mega rule
%:
	: # Explicit build system to avoid use of all-in-1 Makefile
	dh $@ --buildsystem=pybuild --with python3,numpy3,sphinxdoc

# The *cython* rules are provided to allow using pre-built Cython files in distributions without a new enough Cython; they are not (and must not be) used in official Debian builds (including -backports).  Use instructions:
# on a system with new enough Cython, run debian/rules cythonize - this will add a directory under debian/
# uncomment the _uncythonize rule dependency below
# remove the cython3 Build-Depends from d/control
# copy to the older system and build as normal
# To upgrade to a new upstream version, this process must be repeated
# Warning - has not been tested for some time
_cythonize%: override_dh_clean # force removal of previous copies
	python$(*:2=) setup.py cython
	D=debian/cythonized-files$(*:2=) && \
		git rm -rf $$D || rm -rf $$D; \
		find pandas/ -regex '.*\.c\(\|pp\)' | while read f; do \
			grep -q 'Generated by Cython' "$$f" || continue; \
			mkdir -p "$$D/$$(dirname $$f)"; \
			cp "$$f" "$$D/$$(dirname $$f)"; \
			git add -f "$$D/$$f" || true; \
		done; \
		echo "$(UVER)" >| $$D/VERSION; git add $$D/VERSION || true

_uncythonize%:
	: # Make sure that cythonized sources are up-to-date
	[ "$(UVER)" = "`cat debian/cythonized-files3/VERSION`" ]
	echo "$*" | grep -q '^3' && PY=3 || PY= ; \
		echo "I: Using pre-Cython-ed files for Python $*"; \
		cd debian/cythonized-files$$PY/ ; \
		find . -regex '.*\.c\(\|pp\)' | while read f; do cp $$f ../../$$f; done

cythonize: _cythonize3

override_dh_clean:
	find pandas/ -regex '.*\.c\(\|pp\)' | xargs grep -l -e 'Generated by Cython'  | xargs -r rm -f
	# the || true is because this will fail without docutils (-arch or nodoc builds)
	cd doc && LC_ALL=C.UTF-8 python3 make.py clean || true
	rm -rf build buildtmp *-stamp doc/source/savefig doc/source/user_guide/styled.xlsx doc/source/index.rst
	dh_clean

override_dh_auto_build-arch: # ${PY3VERS:%=_uncythonize%}
	mkdir -p buildtmp
	[ -e pandas/__version.py ] || \
	echo -e "version = '$(UVER_PY)'\nshort_version = '$(UVER_PYSHORT)'" > pandas/__version.py
	dh_auto_build

override_dh_auto_build-indep: override_dh_auto_build-arch
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	: # Build Documentation
	cd doc && PYTHONPATH=$(CURDIR)/.pybuild/cpython3_$(PY3VER)/build LC_ALL=C.UTF-8 LANGUAGE=C.UTF-8 python3 make.py html
	# strip build paths, object IDs and statsmodels timestamps for reproducibility, and online Javascript for privacy
	for html in `find doc/build/html -name _modules -prune -o -name "*.html" -o -name "*.ipynb"` ; do \
	    sed -i -e 's#$(CURDIR)/.pybuild/[^/]*/build/pandas/#/usr/lib/python3/dist-packages/pandas/#g' \
	    -e 's#$(CURDIR)/debian/python3-pandas/usr/lib/python3/dist-packages/pandas/#/usr/lib/python3/dist-packages/pandas/#g' \
	    -e 's# at 0x[0-9a-f]\{8,16\}\(>\|>\)# at 0xadde5de1e8ed\1#g' \
	    -e 's#\(Date:.*\)[A-Z][a-z]\+, \+[0-9]\+,\? \+[A-Z][a-z]\+,\? \+[0-9]\+#\1$(SOURCE_DATE)#g' \
	    -e 's#\(Time:.*\)[0-9][0-9]:[0-9][0-9]:[0-9][0-9]#\1$(SOURCE_TIME)#g' $${html} ; \
	done
endif

override_dh_installdocs:
	dh_installdocs -A *.md
	# for NEWS.html.gz - put it here and use symlinks to avoid breaking internal links
	gzip -c -n -9 debian/python-pandas-doc/usr/share/doc/python-pandas-doc/html/whatsnew/index.html > debian/python-pandas-doc/usr/share/doc/python-pandas-doc/html/whatsnew/index.html.gz || true
	cp -av debian/contributors_list.txt debian/python-pandas-doc/usr/share/doc/python-pandas-doc || true
	# deduplicate files - the ||true is because we only build-depend on jdupes if we're building documentation
	jdupes -r -l debian/python-pandas-doc/usr/share/doc || true


## 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 -Xobjects.inv

# see PYBUILD_TEST_ARGS above
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	PYBUILD_SYSTEM=custom dh_auto_test
endif