Skip to content

Commit ac64a70

Browse files
committed
Add warnings when compiling from source
1 parent 0eca76e commit ac64a70

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

setup.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,31 @@
66
import shlex
77
import subprocess
88
import sys
9+
from time import sleep
10+
11+
12+
def is_virtualenv():
13+
return sys.base_prefix != sys.prefix
14+
15+
16+
if platform.system() == "Darwin":
17+
major_version = int(platform.mac_ver()[0].split(".")[0])
18+
if major_version < 12:
19+
print(
20+
"\033[1;91mWarning!\033[0m You are using an EOL, unsupported, and out-of-date OS."
21+
)
22+
sleep(3)
23+
24+
# Don't show message when using our project tooling.
25+
if not is_virtualenv() or os.getenv("_PYAV_ACTIVATED", "") != "1":
26+
print(
27+
"\n\033[1;91mWarning!\033[0m You are installing from source.\n"
28+
"It is \033[1;37mEXPECTED\033[0m that it will fail. You are \033[1;37mREQUIRED\033[0m"
29+
" to use ffmpeg 7.\nYou \033[1;37mMUST\033[0m have Cython, pkg-config, and a C compiler.\n"
30+
)
31+
if os.getenv("GITHUB_ACTIONS") != "true":
32+
sleep(3)
33+
934

1035
from Cython.Build import cythonize
1136
from Cython.Compiler.AutoDocTransforms import EmbedSignature
@@ -141,7 +166,7 @@ def parse_cflags(raw_flags):
141166
cythonize = lambda ext, **kwargs: [ext]
142167
use_pkg_config = False
143168

144-
# Locate FFmpeg libraries and headers.
169+
# Locate ffmpeg libraries and headers.
145170
if FFMPEG_DIR is not None:
146171
extension_extra = get_config_from_directory(FFMPEG_DIR)
147172
elif use_pkg_config:

0 commit comments

Comments
 (0)