]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/python_distutils.pm
Modular object-orientied buildsystem implementation.
[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 Debian::Debhelper::Dh_Buildsystem_Bases;
13 use base 'Debian::Debhelper::Dh_Buildsystem_Option';
14
15 sub DESCRIPTION {
16         "support for building Python distutils based packages"
17 }
18
19 sub is_buildable {
20         return -e "setup.py";
21 }
22
23 sub get_builddir_option {
24         my $self=shift;
25         if ($self->get_builddir()) {
26                 return "--build-base=". $self->get_builddir();
27         }
28         return;
29 }
30
31 sub configure_impl {
32         # Do nothing
33         1;
34 }
35
36 sub build_impl {
37         my $self=shift;
38         doit("python", "setup.py", "build", @_);
39 }
40
41 sub test_impl {
42         1;
43 }
44
45 sub install_impl {
46         my $self=shift;
47         my $destdir=shift;
48
49         doit("python", "setup.py", "install", 
50              "--root=$destdir",
51              "--no-compile", "-O0", @_);
52 }
53
54 sub clean_impl {
55         my $self=shift;
56         doit("python", "setup.py", "clean", "-a", @_);
57         # The setup.py might import files, leading to python creating pyc
58         # files.
59         doit('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', ';');
60 }
61
62 1;