summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Buildsystem/python_distutils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Debian/Debhelper/Buildsystem/python_distutils.pm')
-rw-r--r--Debian/Debhelper/Buildsystem/python_distutils.pm51
1 files changed, 51 insertions, 0 deletions
diff --git a/Debian/Debhelper/Buildsystem/python_distutils.pm b/Debian/Debhelper/Buildsystem/python_distutils.pm
new file mode 100644
index 00000000..01a8c14e
--- /dev/null
+++ b/Debian/Debhelper/Buildsystem/python_distutils.pm
@@ -0,0 +1,51 @@
+# A buildsystem plugin for building Python Distutils based
+# projects.
+#
+# Copyright: © 2008 Joey Hess
+# © 2008-2009 Modestas Vainius
+# License: GPL-2+
+
+package Debian::Debhelper::Buildsystem::python_distutils;
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+use base 'Debian::Debhelper::Buildsystem';
+
+sub DESCRIPTION {
+ "Python distutils"
+}
+
+sub check_auto_buildable {
+ return -e "setup.py";
+}
+
+sub setup_py {
+ my $this=shift;
+ my $act=shift;
+
+ if ($this->get_builddir()) {
+ unshift @_, "--build-base=" . $this->get_builddir();
+ }
+ doit("python", "setup.py", $act, @_);
+}
+
+sub build {
+ my $this=shift;
+ $this->setup_py("build", @_);
+}
+
+sub install {
+ my $this=shift;
+ my $destdir=shift;
+ $this->setup_py("install", "--root=$destdir", "--no-compile", "-O0", @_);
+}
+
+sub clean {
+ my $this=shift;
+ $this->setup_py("clean", "-a", @_);
+ # The setup.py might import files, leading to python creating pyc
+ # files.
+ doit('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', ';');
+}
+
+1;