I am trying to package numpy 1.12.1 into deb package. In order to do that first I run

dh_make -f ../numpy1.12.1.tar.gz

and it generates a debian directory, in the control file generated it shows numpyBROKEN, I change that to numpy1.12.1 and edit debian/rules to tell that this package has a setup.py file and must be compiled with python3. This is my debian/rules file:

#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# main packaging script based on dh7 syntax
        dh $@ --with python3 --buildsystem=pybuild

# debmake generated override targets
# This is example for Cmake (See http://bugs.debian.org/641051 )
#       dh_auto_configure -- \

Then I run:

dpkg-buildpackage -us -uc

and it generates a package. But if I unpack the deb package or if I watch the structure folder generated by dpkg-buildpackage I only can see the following

$ ls debian/numpy1.12.1
$ ls debian/numpy1.12.1/DEBIAN/
control  md5sums
$ ls debian/numpy1.12.1/usr/
$ ls debian/numpy1.12.1/usr/share/doc/numpy1.12.1/
changelog.Debian.gz  copyright

Only the DEBIAN files and in usr folder only appear share folder nothing about the numpy compiled files...

How can I generate a debian package from python module?

  • Unfortunately, dh_make is unlikely to be useful on a complicated package like numpy. As it happens, 1.12.1 is already packaged in the jessie-backports repository. Why don't you use this? :) – Chris Lamb Mar 22 '17 at 22:34
  • Because I am compiling for raspberry pi and for python3.6 (python3.6 isn't in the oficial repository). I have needed to compile python3.6 and I want to distribute a numpy deb for my python compilation. – RdlP Mar 22 '17 at 22:49

Why reinvent the wheel?

dget http://httpredir.debian.org/debian/pool/main/p/python-numpy/python-numpy_1.12.0-2.dsc
cd python-numpy-1.12.0

Check PY3VERS in debian/rules then rebuild:

dch -n "Rebuild with Python 3.6."
dch -r ignored
dpkg-buildpackage -us -uc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.