-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd89ea4
commit 3f2016e
Showing
9 changed files
with
68 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
import subprocess, multiprocessing | ||
from typing import Optional | ||
|
||
from build.project import Project | ||
|
||
class MakeProject(Project): | ||
def __init__(self, url, md5, installed, | ||
install_target='install', | ||
def __init__(self, url: str, md5: str, installed: str, | ||
install_target: str='install', | ||
**kwargs): | ||
Project.__init__(self, url, md5, installed, **kwargs) | ||
self.install_target = install_target | ||
|
||
def get_simultaneous_jobs(self): | ||
def get_simultaneous_jobs(self) -> int: | ||
try: | ||
# use twice as many simultaneous jobs as we have CPU cores | ||
return multiprocessing.cpu_count() * 2 | ||
except NotImplementedError: | ||
# default to 12, if multiprocessing.cpu_count() is not implemented | ||
return 12 | ||
|
||
def get_make_args(self, toolchain): | ||
def get_make_args(self, toolchain) -> list[str]: | ||
return ['--quiet', '-j' + str(self.get_simultaneous_jobs())] | ||
|
||
def get_make_install_args(self, toolchain): | ||
def get_make_install_args(self, toolchain) -> list[str]: | ||
return ['--quiet', self.install_target] | ||
|
||
def make(self, toolchain, wd, args): | ||
def make(self, toolchain, wd: str, args: list[str]) -> None: | ||
subprocess.check_call(['make'] + args, | ||
cwd=wd, env=toolchain.env) | ||
|
||
def build_make(self, toolchain, wd, install=True): | ||
def build_make(self, toolchain, wd: str, install: bool=True) -> None: | ||
self.make(toolchain, wd, self.get_make_args(toolchain)) | ||
if install: | ||
self.make(toolchain, wd, self.get_make_install_args(toolchain)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import subprocess | ||
from typing import Union | ||
|
||
def run_quilt(toolchain, cwd, patches_path, *args): | ||
def run_quilt(toolchain, cwd: str, patches_path: str, *args: str) -> None: | ||
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): | ||
def push_all(toolchain, src_path: str, patches_path: str) -> None: | ||
run_quilt(toolchain, src_path, patches_path, 'push', '-a') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters