Skip to content

Commit daa65b8

Browse files
committed
Make community build
1 parent d6e31d2 commit daa65b8

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

.github/workflows/build-ffmpeg.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ jobs:
6363
- name: Build FFmpeg
6464
env:
6565
CIBW_ARCHS: ${{ matrix.arch }}
66-
CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor --commercial --enable-cuda
67-
CIBW_BEFORE_BUILD_WINDOWS: python scripts\build-ffmpeg.py C:\cibw\vendor --commercial --enable-cuda
66+
CIBW_BEFORE_BUILD: python scripts/build-ffmpeg.py /tmp/vendor --community --enable-cuda
67+
CIBW_BEFORE_BUILD_WINDOWS: python scripts\build-ffmpeg.py C:\cibw\vendor --community --enable-cuda
6868
CIBW_BUILD: cp311-*
6969
CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH auditwheel repair -w {dest_dir} {wheel}
7070
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path C:\cibw\vendor\bin -w {dest_dir} {wheel}

scripts/cibuildpkg.py

+15-21
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import shutil
77
import struct
88
import subprocess
9-
import sys
109
import tarfile
1110
import tempfile
1211
import time
13-
from enum import IntEnum
12+
from collections.abc import Iterator
1413
from dataclasses import dataclass, field, replace
14+
from enum import IntEnum
1515

1616

1717
def fetch(url: str, path: str) -> None:
@@ -38,7 +38,7 @@ def get_platform() -> str:
3838

3939

4040
@contextlib.contextmanager
41-
def chdir(path):
41+
def chdir(path: str) -> Iterator[None]:
4242
"""
4343
Changes to a directory and returns to the original directory at exit.
4444
"""
@@ -51,28 +51,22 @@ def chdir(path):
5151

5252

5353
@contextlib.contextmanager
54-
def log_group(title):
54+
def log_group(title: str) -> Iterator[None]:
5555
"""
5656
Starts a log group and ends it at exit.
5757
"""
5858
start_time = time.time()
5959
success = False
60-
log_print(f"::group::{title}")
60+
print(f"::group::{title}", flush=True)
6161
try:
6262
yield
6363
success = True
6464
finally:
6565
duration = time.time() - start_time
6666
outcome = "ok" if success else "failed"
67-
start_color = "\033[32m" if success else "\033[31m"
68-
end_color = "\033[0m"
69-
log_print("::endgroup::")
70-
log_print(f"{start_color}{outcome}{end_color} {duration:.2f}s".rjust(78))
71-
72-
73-
def log_print(msg: str) -> None:
74-
sys.stdout.write(msg + "\n")
75-
sys.stdout.flush()
67+
start_color = "[32m" if success else "[31m"
68+
ok_str = f"\033{start_color}{outcome}\033[0m {duration:.2f}s".rjust(78)
69+
print(f"::endgroup::\n{ok_str}", flush=True)
7670

7771

7872
def make_args(*, parallel: bool) -> list[str]:
@@ -87,16 +81,16 @@ def make_args(*, parallel: bool) -> list[str]:
8781
return args
8882

8983

90-
def prepend_env(env, name, new, separator=" "):
84+
def prepend_env(env, name: str, new: str, separator: str = " ") -> None:
9185
old = env.get(name)
9286
if old:
9387
env[name] = new + separator + old
9488
else:
9589
env[name] = new
9690

9791

98-
def run(cmd, env=None):
99-
log_print(f"- Running: {cmd}")
92+
def run(cmd: list[str], env=None) -> None:
93+
print(f"- Running: {cmd}", flush=True)
10094
try:
10195
subprocess.run(cmd, check=True, env=env, stderr=subprocess.PIPE, text=True)
10296
except subprocess.CalledProcessError as e:
@@ -111,7 +105,7 @@ def correct_configure(file_path: str) -> None:
111105
old_string = "test_cmd $pkg_config --exists --print-errors $pkg_version || return"
112106
new_string = 'test_cmd $pkg_config --exists --print-errors "$pkg_version" || return'
113107

114-
with open(file_path, "r") as file:
108+
with open(file_path) as file:
115109
content = file.read()
116110

117111
updated_content = content.replace(old_string, new_string)
@@ -127,7 +121,7 @@ class When(IntEnum):
127121
always = 3
128122

129123

130-
@dataclass
124+
@dataclass(slots=True)
131125
class Package:
132126
name: str
133127
source_url: str
@@ -184,9 +178,9 @@ def build(self, package: Package, *, for_builder: bool = False):
184178
def create_directories(self) -> None:
185179
# print debugging information
186180
if platform.system() == "Darwin":
187-
log_print("Environment variables")
181+
print("Environment variables")
188182
for var in ("ARCHFLAGS", "MACOSX_DEPLOYMENT_TARGET"):
189-
log_print(f" - {var}: {os.environ[var]}")
183+
print(f" - {var}: {os.environ[var]}")
190184

191185
# delete build directory
192186
if os.path.exists(self.build_dir):

scripts/sbom.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def main():
5353
elif not package.gpl or allow_gpl:
5454
print(f"- {package.name} {get_version(package)}")
5555

56-
print(f"\nThe following additional packages are also enabled on Linux:\n")
56+
print("\nThe following additional packages are also enabled on Linux:\n")
5757
for package in sorted(gnutls_group):
5858
print(f"- {package.name} {get_version(package)}")
5959
print()

0 commit comments

Comments
 (0)