]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/python_distutils.pm
Merge branch 'master' into buildsystems
[debhelper.git] / Debian / Debhelper / Buildsystem / python_distutils.pm
1 # A buildsystem plugin for building Python Distutils based
2 # projects.
3 #
4 # Copyright: © 2008 Joey Hess
5 #            © 2008-2009 Modestas Vainius
6 # License: GPL-2+
7
8 package Debian::Debhelper::Buildsystem::python_distutils;
9
10 use strict;
11 use Debian::Debhelper::Dh_Lib;
12 use base 'Debian::Debhelper::Buildsystem';
13
14 sub DESCRIPTION {
15         "Python distutils"
16 }
17
18 sub check_auto_buildable {
19         return -e "setup.py";
20 }
21
22 sub setup_py {
23         my $this=shift;
24         my $act=shift;
25
26         if ($this->get_builddir()) {
27                 unshift @_, "--build-base=" . $this->get_builddir();
28         }
29         doit("python", "setup.py", $act, @_);
30 }
31
32 sub build {
33         my $this=shift;
34         $this->setup_py("build", @_);
35 }
36
37 sub install {
38         my $this=shift;
39         my $destdir=shift;
40         $this->setup_py("install", "--root=$destdir", "--no-compile", "-O0", @_);
41 }
42
43 sub clean {
44         my $this=shift;
45         $this->setup_py("clean", "-a", @_);
46         # The setup.py might import files, leading to python creating pyc
47         # files.
48         doit('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', ';');
49 }
50
51 1;