summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-02-09 22:57:31 +0100
committerMax Kellermann <max@musicpd.org>2018-02-09 22:59:12 +0100
commit927071e08511442604e7514aac8399229f722b63 (patch)
tree36e89b96c740d164353614b577e985197b61b9b5 /python
parent6ba918b20346056294c15bdf1abd207f1dca84b4 (diff)
python/build/project.py: add quilt support
Diffstat (limited to 'python')
-rw-r--r--python/build/project.py9
-rw-r--r--python/build/quilt.py9
2 files changed, 18 insertions, 0 deletions
diff --git a/python/build/project.py b/python/build/project.py
index 352806fcb..b78c89238 100644
--- a/python/build/project.py
+++ b/python/build/project.py
@@ -3,10 +3,12 @@ import re
from build.download import download_and_verify
from build.tar import untar
+from build.quilt import push_all
class Project:
def __init__(self, url, md5, installed, name=None, version=None,
base=None,
+ patches=None,
edits=None,
use_cxx=False):
if base is None:
@@ -29,6 +31,10 @@ class Project:
self.md5 = md5
self.installed = installed
+ if patches is not None:
+ srcdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+ patches = os.path.join(srcdir, patches)
+ self.patches = patches
self.edits = edits
self.use_cxx = use_cxx
@@ -51,6 +57,9 @@ class Project:
parent_path = toolchain.build_path
path = untar(self.download(toolchain), parent_path, self.base)
+ if self.patches is not None:
+ push_all(toolchain, path, self.patches)
+
if self.edits is not None:
for filename, function in self.edits.items():
with open(os.path.join(path, filename), 'r+t') as f:
diff --git a/python/build/quilt.py b/python/build/quilt.py
new file mode 100644
index 000000000..876453d2b
--- /dev/null
+++ b/python/build/quilt.py
@@ -0,0 +1,9 @@
+import subprocess
+
+def run_quilt(toolchain, cwd, patches_path, *args):
+ env = dict(toolchain.env)
+ env['QUILT_PATCHES'] = patches_path
+ subprocess.check_call(['quilt'] + list(args), cwd=cwd, env=env)
+
+def push_all(toolchain, src_path, patches_path):
+ run_quilt(toolchain, src_path, patches_path, 'push', '-a')