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
|
#!/usr/bin/make -f
BASE_PACKAGE = azure
# Package all submodules except azure-sdk-tools
MODULES = $(filter-out azure-sdk-tools,$(subst /setup.py,,$(wildcard */setup.py)))
# The actual python module (egg-info) names have underscores instead of dashes
PYDIST_MODULES = $(subst -,_,$(MODULES))
# Mark the nspkg modules as "py2", other packages as "pyall"
PYVER_MODULES = $(foreach module, $(filter %-nspkg,$(MODULES)), py2-$(module)) $(foreach module, $(filter-out %-nspkg,$(MODULES)), pyall-$(module))
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))$(filter nodoc,$(DEB_BUILD_PROFILES)))
HELPERS = python2,python3,sphinxdoc
else
HELPERS = python2,python3
endif
%:
dh $@ --with $(HELPERS) --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-py2-%:
cp $*/setup.py $*/setup.py.orig
sed 's/~=/>=/g' $*/setup.py.orig > $*/setup.py
PYBUILD_DISABLE_python3=1 PYBUILD_NAME=$* dh_auto_configure --sourcedirectory=$*
echo $* python-$(BASE_PACKAGE) >> debian/python-$(BASE_PACKAGE).pydist
echo $* python-$(BASE_PACKAGE) >> debian/pydist-overrides
dh_auto_configure-pyall-%:
cp $*/setup.py $*/setup.py.orig
sed 's/~=/>=/g' $*/setup.py.orig > $*/setup.py
PYBUILD_NAME=$* dh_auto_configure --sourcedirectory=$*
echo $* python-$(BASE_PACKAGE) >> debian/python-$(BASE_PACKAGE).pydist
echo $* python-$(BASE_PACKAGE) >> debian/pydist-overrides
echo $* python3-$(BASE_PACKAGE) >> debian/python3-$(BASE_PACKAGE).pydist
echo $* python3-$(BASE_PACKAGE) >> debian/py3dist-overrides
override_dh_auto_configure: $(foreach pyvermodule, $(PYVER_MODULES), dh_auto_configure-$(pyvermodule))
# dh_auto_build overrides
dh_auto_build-py2-%:
PYBUILD_DISABLE_python3=1 PYBUILD_NAME=$* dh_auto_build --sourcedirectory=$*
dh_auto_build-pyall-%:
PYBUILD_NAME=$* dh_auto_build --sourcedirectory=$*
override_dh_auto_build: $(foreach pyvermodule, $(PYVER_MODULES), dh_auto_build-$(pyvermodule))
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))$(filter nodoc,$(DEB_BUILD_PROFILES)))
PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml doc/ doc/_build/html # HTML generator
endif
# dh_auto_install overrides
export PYBUILD_INSTALL_ARGS_python2=--no-compile
$(CURDIR)/debian/python3-$(BASE_PACKAGE) $(CURDIR)/debian/python-$(BASE_PACKAGE):
mkdir -p $@
dh_auto_install-py2-%: $(CURDIR)/debian/python-$(BASE_PACKAGE)
PYBUILD_DISABLE_python3=1 PYBUILD_NAME=$* dh_auto_install --sourcedirectory=$*
cp -rv $(CURDIR)/debian/python-$*/usr $(CURDIR)/debian/python-$(BASE_PACKAGE)
rm -r $(CURDIR)/debian/python-$*
dh_auto_install-pyall-%: $(CURDIR)/debian/python3-$(BASE_PACKAGE) $(CURDIR)/debian/python-$(BASE_PACKAGE)
PYBUILD_NAME=$* dh_auto_install --sourcedirectory=$*
cp -rv $(CURDIR)/debian/python-$*/usr $(CURDIR)/debian/python-$(BASE_PACKAGE)
rm -r $(CURDIR)/debian/python-$*
cp -rv $(CURDIR)/debian/python3-$*/usr $(CURDIR)/debian/python3-$(BASE_PACKAGE)
rm -r $(CURDIR)/debian/python3-$*
dh_auto_install-pyall-$(BASE_PACKAGE):
PYBUILD_NAME=$(BASE_PACKAGE) dh_auto_install --sourcedirectory=$(BASE_PACKAGE)
override_dh_auto_install: $(foreach pyvermodule, $(PYVER_MODULES), dh_auto_install-$(pyvermodule))
# Remove python3-only files that will fail to byte-compile from the python2 package
find $(CURDIR)/debian/python-$(BASE_PACKAGE) -name '*_py3.py' -delete
# 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
|