/usr/bin/dh_pydeb is in python-van.pydeb 1.3.3-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/bin/bash
set -e
# XXX: This should be written in perl, but the original author only knows python well. Volunteers?
# Figure out what packages to operate on
echo pydeb: Working on source package ${PYDEB_SRC_PACKAGE:=`grep -m1 '^Source: ' debian/control | sed 's/Source: //'`}
echo pydeb: Working on python distribution ${PYDEB_PY_PACKAGE:=`python setup.py --name`}
echo pydeb: Working on binary package ${PYDEB_BIN_PACKAGE:=`van-pydeb py_to_bin $PYDEB_PY_PACKAGE`}
# Sanity checks
if [ `grep -c "^Package: ${PYDEB_BIN_PACKAGE}$" debian/control` == 0 ]; then
echo ERROR: Expected binary package ${PYDEB_BIN_PACKAGE} in debian/control but did not find it.
exit 1
fi
# Parse environment variables that affect us
# Extras totally excluded: PYDEB_EXCLUDED_EXTRAS
for extra in $PYDEB_EXCLUDED_EXTRAS; do
excluded_extras="--exclude-extra ${extra} ${excluded_extras}"
done
# Extras to be made into metapackages: PYDEB_METAPACKAGE_EXTRAS
for extra in $PYDEB_METAPACKAGE_EXTRAS; do
# Don't put dependencies of metapackages on the main package
excluded_extras="--exclude-extra ${extra} ${excluded_extras}"
done
# Extras to be assigned to Recommends: PYDEB_RECOMMENDS_EXTRAS
for extra in $PYDEB_RECOMMENDS_EXTRAS; do
recommends_extras="--extra ${extra} ${recommends_extras}"
# exclude recommends dependencies from the main package dependencies
excluded_extras="--exclude-extra ${extra} ${excluded_extras}"
done
# Extras to be assigned to Suggests: PYDEB_SUGGESTS_EXTRAS
for extra in $PYDEB_SUGGESTS_EXTRAS; do
suggests_extras="--extra ${extra} ${suggests_extras}"
# exclude recommends dependencies from the main package dependencies
excluded_extras="--exclude-extra ${extra} ${excluded_extras}"
done
# TODO: We need a way to assign multiple extras to a arbitrarily named metapackage. But a good format for the environment variable to do this escapes me.
# something like:
# mymetapackage1: extra1 extra2 mymetapackage2: extra3 extra4
# mymetapackage1 (extra1 extra2) mymetapackage2 (extra3 extra4)
# or using one metapackage per line:
# mymetapackage1: extra1 extra2
# mymetapackage2: extra3 extra4
# Not sure...
# Now for the real work
# XXX - do we really have to run this multiple times? can dependencies ever differ for different python versions?
# Yes, they can. setup.py is a program and can generate any dependencies depending on the python used to run it.
# We should make sure we depend on all them, if there's a case that doesn't work like that, probably best would be to manage dependencies by hand
# rather than modify dh_pydeb
for pyvers in `pyversions -vr debian/control`; do
py_libdir=$(python${pyvers} -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())')
egg_info=debian/*${py_libdir}/${PYDEB_PY_PACKAGE}*.egg-info
if [ ! -x ${egg_info} ]; then
echo ERROR: could not find package metadata file to work on that matches the pattern ${egg_info}.
fi
# set dependencies of main package
(echo -n 'pydeb:Depends=' && van-pydeb depends --egg-info ${egg_info} ${excluded_extras}) >> debian/${PYDEB_BIN_PACKAGE}.substvars
# set provides for the extras included in the main package
(echo -n 'pydeb:Provides=' && van-pydeb provides --egg-info ${egg_info} ${excluded_extras}) >> debian/${PYDEB_BIN_PACKAGE}.substvars
# if some extras were moved to recommends, include them
if [ -n "${recommends_extras}" ]; then
(echo -n 'pydeb:Recommends=' && van-pydeb depends --egg-info ${egg_info} ${recommends_extras}) >> debian/${PYDEB_BIN_PACKAGE}.substvars
fi
# if some extras were moved to suggests, include them
if [ -n "${suggests_extras}" ]; then
(echo -n 'pydeb:Suggests=' && van-pydeb depends --egg-info ${egg_info} ${suggests_extras}) >> debian/${PYDEB_BIN_PACKAGE}.substvars
fi
# setup the dependencies of metapackages
for extra in $PYDEB_METAPACKAGE_EXTRAS; do
(echo -n 'pydeb:Depends=' && van-pydeb depends --egg-info ${egg_info} --extra ${extra}) >> debian/${PYDEB_BIN_PACKAGE}-${extra}.substvars
done
done
|