@classmethod
def build_from_git(cls, git_repo, make_targets, bintool_path,
- flags=None, git_branch=None):
+ flags=None, git_branch=None, make_path=None):
"""Build a bintool from a git repo
This clones the repo in a temporary directory, builds it with 'make',
build is complete
flags (list of str): Flags or variables to pass to make, or None
git_branch (str): Branch of git repo, or None to use the default
+ make_path (str): Relative path inside git repo containing the
+ Makefile, or None
Returns:
tuple:
tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir)
for target in make_targets:
print(f"- build target '{target}'")
- cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
+ makedir = tmpdir
+ if make_path:
+ makedir = os.path.join(tmpdir, make_path)
+ cmd = ['make', '-C', makedir, '-j', f'{multiprocessing.cpu_count()}',
target]
if flags:
cmd += flags
# See Bintool.build_from_git()
tmpdir = cmd[2]
self.fname = os.path.join(tmpdir, 'pathname')
+ os.makedirs(os.path.dirname(tmpdir), exist_ok=True)
tools.write_file(self.fname, b'hello')
expected = b'this is a test'