Skip to content

Commit 95114ef

Browse files
Zoran Simiczsimic
authored andcommitted
Don't use make -j by default, log debug level by default
1 parent e28b5af commit 95114ef

6 files changed

Lines changed: 19 additions & 16 deletions

File tree

src/portable_python/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,7 @@ def xenv_PKG_CONFIG_PATH(self):
539539
yield f"{self.deps_lib}/pkgconfig"
540540

541541
def _do_run(self, program, *args, fatal=True, env=None):
542-
logger = self._log_handler
543-
return runez.run(program, *args, passthrough=logger, stdout=None, stderr=None, fatal=fatal, env=env, logger=logger or runez.UNSET)
542+
return runez.run(program, *args, passthrough=self._log_handler, stdout=None, stderr=None, fatal=fatal, env=env)
544543

545544
def run_configure(self, program, *args, prefix=None):
546545
"""
@@ -558,11 +557,13 @@ def run_configure(self, program, *args, prefix=None):
558557

559558
def run_make(self, *args, program="make", cpu_count=None):
560559
cmd = program.split()
561-
if cpu_count is None:
562-
cpu_count = multiprocessing.cpu_count()
560+
if cpu_count and cpu_count < 0:
561+
available = multiprocessing.cpu_count()
562+
if available and available > 0:
563+
cpu_count += available
563564

564-
if cpu_count and cpu_count > 3:
565-
cmd.append("-j%s" % (cpu_count - 2))
565+
if cpu_count and cpu_count > 1:
566+
cmd.append("-j%s" % cpu_count)
566567

567568
self._do_run(*cmd, *args)
568569

src/portable_python/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@
1414
@runez.click.group()
1515
@runez.click.version()
1616
@runez.click.color()
17-
@runez.click.debug("-v")
1817
@runez.click.dryrun("-n")
1918
@click.option("--config", "-c", metavar="PATH", default="portable-python.yml", show_default=True, help="Path to config file to use")
19+
@click.option("--quiet", "-q", is_flag=True, help="Turn off DEBUG logging")
2020
@click.option("--target", "-t", hidden=True, help="For internal use / testing")
21-
def main(debug, config, target):
21+
def main(config, quiet, target):
2222
"""
2323
Build (optionally portable) python binaries
2424
"""
25+
level = logging.INFO if quiet else logging.DEBUG
2526
runez.system.AbortException = SystemExit
2627
runez.log.setup(
27-
debug=debug,
28+
debug=not quiet,
29+
level=level,
2830
console_format="%(levelname)s %(message)s",
29-
console_level=logging.INFO,
31+
console_level=level,
3032
default_logger=LOG.info,
3133
locations=None,
3234
)

src/portable_python/cpython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _do_linux_compile(self):
204204

205205
self.run_make(*make_args)
206206
# Don't parallelize `make install`, see https://github.com/python/cpython/issues/109796
207-
self.run_make("install", f"DESTDIR={self.destdir}", cpu_count=0)
207+
self.run_make("install", f"DESTDIR={self.destdir}")
208208

209209
def _finalize(self):
210210
is_shared = self.setup.prefix or self.has_configure_opt("--enable-shared", "yes")

src/portable_python/external/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def version(self):
1313
return self.cfg_version("0.3.2")
1414

1515
def _do_linux_compile(self):
16-
self.run_make("LIBINTL=NOOP", cpu_count=0)
17-
self.run_make("LIBINTL=NOOP", f"DESTDIR={self.deps}", "prefix=/", "install", cpu_count=0)
16+
self.run_make("LIBINTL=NOOP")
17+
self.run_make("LIBINTL=NOOP", f"DESTDIR={self.deps}", "prefix=/", "install")
1818

1919

2020
class Toolchain(ModuleBuilder):

src/portable_python/external/xcpython.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ def _do_linux_compile(self):
244244
"--disable-docs",
245245
"--enable-portable-binary",
246246
)
247-
self.run_make(cpu_count=0)
248-
self.run_make("install", cpu_count=0)
247+
self.run_make()
248+
self.run_make("install")
249249

250250

251251
class Sqlite(ModuleBuilder):

tests/test_invoker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
def test_invoker(cli):
6-
cli.run("-v", "inspect", "invoker", "-v", "-mall")
6+
cli.run("inspect", "invoker", "-v", "-mall")
77

88
# Invoker may not be completely clean, but it has to have at least one OK .so usage
99
m = re.search(r"^\.so files: .+, (\d+) OK", cli.logged.stdout.contents(), re.MULTILINE)

0 commit comments

Comments
 (0)