Skip to content

Commit

Permalink
Add "quiet" option to compile_module
Browse files Browse the repository at this point in the history
  • Loading branch information
funkey committed Mar 12, 2024
1 parent f4def86 commit 83b4725
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/witty/compile_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def compile_module(
extra_link_args=None,
name=None,
force_rebuild=False,
quiet=False,
):
if source_files is None:
source_files = []
Expand Down Expand Up @@ -62,7 +63,8 @@ def compile_module(
module_lib = (module_dir / module_name).with_suffix(module_ext)
module_lock = (module_dir / module_name).with_suffix(".lock")

print(f"Compiling {module_name} into {module_lib}...")
if not quiet:
print(f"Compiling {module_name} into {module_lib}...")

module_dir.mkdir(parents=True, exist_ok=True)

Expand All @@ -72,7 +74,8 @@ def compile_module(

# already compiled?
if module_lib.is_file() and not force_rebuild:
print(f"Reusing already compiled module from {module_lib}")
if not quiet:
print(f"Reusing already compiled module from {module_lib}")
return load_dynamic(module_name, module_lib)

# create pyx file
Expand All @@ -90,7 +93,7 @@ def compile_module(
)

build_extension.extensions = cythonize(
[extension], compiler_directives={"language_level": "3"}
[extension], compiler_directives={"language_level": "3"}, quiet=quiet
)
build_extension.build_temp = str(module_dir)
build_extension.build_lib = str(module_dir)
Expand Down

0 comments on commit 83b4725

Please sign in to comment.