File: rules

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (90 lines) | stat: -rwxr-xr-x 4,308 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
#!/usr/bin/make -f

# Package all submodules except azure-sdk-tools, *nspkg
MODULES = $(sort $(filter-out scripts/quickstart_tooling_llc/template sdk/core/azure sdk/core/azure-mgmt sdk/storage/azure-storage-extensions sdk/storage/azure-storage sdk/core/azure-core-tracing-opencensus sdk/core/azure-core-tracing-opentelemetry sdk/monitor/azure-monitor %-nspkg tools/azure-sdk-tools tools/azure-sdk-tools/packaging_tools tools/azure-sdk-tools/devtools_testutils,$(subst /setup.py,,$(wildcard */*/*/setup.py))))

# rules with wildcards do not like '/', so we have to escape. Use three dots as it's unlikely to be used in a name.
MODULES_ESCAPE = $(subst /,...,$(MODULES))

%:
	dh $@ --buildsystem=pybuild


override_dh_auto_clean:
	dh_auto_clean
	set -e; $(foreach module, $(MODULES), \
	if [ -f $(module)/setup.py.orig ]; then \
		mv $(module)/setup.py.orig $(module)/setup.py; \
	fi;)


# dh_auto_configure overrides

dh_auto_configure-sdk...storage...azure-storage-%:
	cp sdk/storage/azure-storage-$*/setup.py sdk/storage/azure-storage-$*/setup.py.orig
	sed 's/~=/>=/g' sdk/storage/azure-storage-$*/setup.py.orig > sdk/storage/azure-storage-$*/setup.py
	PYBUILD_NAME=$(notdir $(subst -,_,sdk/storage/azure-storage-$*)) dh_auto_configure --sourcedirectory=sdk/storage/azure-storage-$*
	echo $(notdir sdk/storage/azure-storage-$*) python3-azure-storage >> debian/python3-azure-storage.pydist
	echo $(notdir sdk/storage/azure-storage-$*) python3-azure-storage >> debian/py3dist-overrides

dh_auto_configure-%:
	cp $(subst ...,/,$*)/setup.py $(subst ...,/,$*)/setup.py.orig
	sed 's/~=/>=/g' $(subst ...,/,$*)/setup.py.orig > $(subst ...,/,$*)/setup.py
	PYBUILD_NAME=$(notdir $(subst -,_,$(subst ...,/,$*))) dh_auto_configure --sourcedirectory=$(subst ...,/,$*)
	echo $(notdir $(subst ...,/,$*)) python3-azure >> debian/python3-azure.pydist
	echo $(notdir $(subst ...,/,$*)) python3-azure >> debian/py3dist-overrides

override_dh_auto_configure: $(foreach pyvermodule, $(MODULES_ESCAPE), dh_auto_configure-$(pyvermodule))


# dh_auto_build overrides

dh_auto_build-%:
	PYBUILD_NAME=$(notdir $(subst -,_,$(subst ...,/,$*))) dh_auto_build --sourcedirectory=$(subst ...,/,$*)

override_dh_auto_build: $(foreach pyvermodule, $(MODULES_ESCAPE), dh_auto_build-$(pyvermodule))
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))$(filter nodoc,$(DEB_BUILD_PROFILES)))
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N -bhtml doc/sphinx doc/sphinx/_build/html # HTML generator
endif


# dh_auto_install overrides

$(CURDIR)/debian/python3-azure-storage:
	mkdir -p $@

dh_auto_install-sdk...storage...azure-storage-%: $(CURDIR)/debian/python3-azure-storage
	PYBUILD_NAME=$(subst -,_,azure-storage-$*) dh_auto_install --sourcedirectory=sdk/storage/azure-storage-$*

	cp -rv $(CURDIR)/debian/python3-azure-storage-$*/usr $(CURDIR)/debian/python3-azure-storage
	rm -r $(CURDIR)/debian/python3-azure-storage-$*

$(CURDIR)/debian/python3-azure:
	mkdir -p $@

dh_auto_install-%: $(CURDIR)/debian/python3-azure
	PYBUILD_NAME=$(notdir $(subst -,_,$(subst ...,/,$*))) dh_auto_install --sourcedirectory=$(subst ...,/,$*)

	cp -rv $(CURDIR)/debian/python3-$(notdir $(subst ...,/,$*))/usr $(CURDIR)/debian/python3-azure
	rm -r $(CURDIR)/debian/python3-$(notdir $(subst ...,/,$*))

dh_auto_install-sdk...core...azure:
	PYBUILD_NAME=azure dh_auto_install --sourcedirectory=sdk/core/azure
	# Make the build reproducible
	LC_ALL=C sort --stable -o debian/python3-azure.pydist debian/python3-azure.pydist
	LC_ALL=C sort --stable -o debian/python3-azure-storage.pydist debian/python3-azure-storage.pydist

override_dh_auto_install: $(foreach pyvermodule, $(MODULES_ESCAPE), dh_auto_install-$(pyvermodule))
	# For some reason the __init__ is not picked up
	mkdir -p $(CURDIR)/debian/python3-azure-storage/usr/lib/python3/dist-packages/azure/storage/
	cp -v sdk/storage/azure-storage-blob/azure/__init__.py \
		$(CURDIR)/debian/python3-azure-storage/usr/lib/python3/dist-packages/azure/storage/
	# Apache2 license notice
	mkdir -p $(CURDIR)/debian/python3-azure/usr/share/doc/python3-azure/
	cp -v sdk/ml/azure-ai-ml/NOTICE.txt $(CURDIR)/debian/python3-azure/usr/share/doc/python3-azure/

# dh_auto_test overrides

override_dh_auto_test:
# Don't test at build time: the circular dependency on python-azure-storage
# makes this way too messy