aboutsummaryrefslogtreecommitdiffstats
path: root/win32/build.py
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-21 00:00:42 +0100
committerMax Kellermann <max@duempel.org>2015-11-21 00:00:42 +0100
commit7a08ce7ece74b63ab2a2ea66e591715029f56dea (patch)
tree1a10c2b31a7cd07d9eccd5573b8ee0fbd0feeb90 /win32/build.py
parent86486336ecf3183ab7e3444fd2bf2a60d9f71247 (diff)
downloadmpd-7a08ce7ece74b63ab2a2ea66e591715029f56dea.tar.gz
mpd-7a08ce7ece74b63ab2a2ea66e591715029f56dea.tar.xz
mpd-7a08ce7ece74b63ab2a2ea66e591715029f56dea.zip
{android,win32}/build.py: move class Project to build/project.py
Diffstat (limited to 'win32/build.py')
-rwxr-xr-xwin32/build.py54
1 files changed, 1 insertions, 53 deletions
diff --git a/win32/build.py b/win32/build.py
index db92fd7c4..d8b866699 100755
--- a/win32/build.py
+++ b/win32/build.py
@@ -58,59 +58,7 @@ class CrossGccToolchain:
# default one on the build host
self.env['PKG_CONFIG_LIBDIR'] = os.path.join(install_prefix, 'lib/pkgconfig')
-from build.download import download_and_verify
-from build.tar import untar
-
-class Project:
- def __init__(self, url, md5, installed, name=None, version=None,
- base=None):
- if base is None:
- basename = os.path.basename(url)
- m = re.match(r'^(.+)\.(tar(\.(gz|bz2|xz|lzma))?|zip)$', basename)
- if not m: raise
- self.base = m.group(1)
- else:
- self.base = base
-
- if name is None or version is None:
- m = re.match(r'^([-\w]+)-(\d[\d.]*[a-z]?)$', self.base)
- if name is None: name = m.group(1)
- if version is None: version = m.group(2)
-
- self.name = name
- self.version = version
-
- self.url = url
- self.md5 = md5
- self.installed = installed
-
- def download(self, toolchain):
- return download_and_verify(self.url, self.md5, toolchain.tarball_path)
-
- def is_installed(self, toolchain):
- tarball = self.download(toolchain)
- installed = os.path.join(toolchain.install_prefix, self.installed)
- tarball_mtime = os.path.getmtime(tarball)
- try:
- return os.path.getmtime(installed) >= tarball_mtime
- except FileNotFoundError:
- return False
-
- def unpack(self, toolchain, out_of_tree=True):
- if out_of_tree:
- parent_path = toolchain.src_path
- else:
- parent_path = toolchain.build_path
- return untar(self.download(toolchain), parent_path, self.base)
-
- def make_build_path(self, toolchain):
- path = os.path.join(toolchain.build_path, self.base)
- try:
- shutil.rmtree(path)
- except FileNotFoundError:
- pass
- os.makedirs(path, exist_ok=True)
- return path
+from build.project import Project
class AutotoolsProject(Project):
def __init__(self, url, md5, installed, configure_args=[],