def deploy_framework(framework, deployFolder): if not os.path.exists(framework): raise IOError(f'no framework found at: {framework}') if os.path.exists(deployFolder): name = os.path.basename(framework) deployPath = os.path.join(deployFolder, name) console(f'Deploying framework to {deployPath}') execute(f'rm -rf {deployPath}') shutil.copytree(framework, deployPath) return True return False
def run(self, command, src_dir=False): """ Run a command in the build or source folder. Can be used for any custom commands or custom build systems. src_dir -- [False] If true, then command is relative to source directory. ``` self.run('./configure') self.run('make release -j7') ``` """ dir = self.dep.src_dir if src_dir else self.dep.build_dir execute(f'cd {dir} && {command}', echo=True)
def clone_or_pull(self, wiped=False): if is_dir_empty(self.dep.src_dir): if not wiped and self.dep.config.print: console( f" - Target {self.dep.name: <16} CLONE because src is missing" ) branch = self.branch_or_tag() if branch: branch = f" --branch {self.branch_or_tag()}" execute( f"git clone --recurse-submodules --depth 1 {branch} {self.url} {self.dep.src_dir}", self.dep.config.verbose) self.checkout_current_branch() else: if self.dep.config.print: console( f" - Pulling {self.dep.name: <16} SCM change detected") self.checkout_current_branch() execute("git submodule update --init --recursive") if not self.tag: # pull if not a tag self.run_git("reset --hard -q") self.run_git("pull")
def run_build(target, install, extraflags=''): build_dir = target.dep.build_dir flags = _build_config(target, install) extraflags = _buildsys_flags(target) execute(f'cmake --build {build_dir} {flags} {extraflags}', echo=target.config.verbose)
def install_msbuild(self): if System.windows: raise OSError('Install Visual Studio 2019 to get MSBuild on Windows') if System.macos: raise OSError('install_msbuild not implemented for macOS') dist = distro.info() if dist['id'] != "ubuntu": raise OSError('install_msbuild only supports Ubuntu') codename = dist['codename'] execute('curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg') execute('sudo mv /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg') execute(f"sudo sh -c 'echo \"deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-{codename}-prod {codename} main\" > /etc/apt/sources.list.d/dotnetdev.list'") execute('sudo apt-get install apt-transport-https') execute('sudo apt-get update') execute('sudo apt-get install dotnet-sdk-2.1')
def install_clang(self, clang_major, clang_ver, suffix): clang_major = '11' clang_ver = '11.0' clangpp = f'clang++{clang_major}' clang_zip = download_file(f'http://ateh10.net/dev/{clangpp}-{suffix}.zip', tempfile.gettempdir()) console(f'Installing to /usr/local/{clangpp}') execute(f'sudo rm -rf /usr/local/{clangpp}') # get rid of any old stuff execute(f'cd /usr/local && sudo unzip -oq {clang_zip}') # extract /usr/local/clang++11/ os.remove(clang_zip) execute(f'sudo ln -sf /usr/local/{clangpp}/lib/libc++.so.1 /usr/lib') execute(f'sudo ln -sf /usr/local/{clangpp}/lib/libc++abi.so.1 /usr/lib') execute(f'sudo ln -sf /usr/local/{clangpp}/bin/clang /usr/bin/clang-{clang_ver}') execute(f'sudo ln -sf /usr/local/{clangpp}/bin/clang++ /usr/bin/clang++-{clang_ver}') execute(f'sudo ln -sf /usr/local/{clangpp}/include/c++/v1 /usr/include/c++/v1') execute(f'sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-{clang_ver} 100') execute(f'sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-{clang_ver} 100') execute(f'sudo update-alternatives --set clang /usr/bin/clang-{clang_ver}') execute(f'sudo update-alternatives --set clang++ /usr/bin/clang++-{clang_ver}')
def run_git(self, git_command): cmd = f"cd {self.dep.src_dir} && git {git_command}" if self.dep.config.verbose: console(f' {self.dep.name: <16} git {git_command}') execute(cmd)