Skip to content

Commit

Permalink
setup.py: use PKG_CONFIG env var to get the pkg-config to use
Browse files Browse the repository at this point in the history
pkg-config may be prefixed when cross-compiling
  • Loading branch information
Artturin authored and WyattBlue committed Apr 27, 2024
1 parent 7f357af commit ba7a2c9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,17 @@ def get_config_from_pkg_config():
"""
Get distutils-compatible extension arguments using pkg-config.
"""
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
try:
raw_cflags = subprocess.check_output(
["pkg-config", "--cflags", "--libs"]
[pkg_config, "--cflags", "--libs"]
+ ["lib" + name for name in FFMPEG_LIBRARIES]
)
except FileNotFoundError:
print("pkg-config is required for building PyAV")
print(f"{pkg_config} is required for building PyAV")
exit(1)
except subprocess.CalledProcessError:
print("pkg-config could not find libraries {}".format(FFMPEG_LIBRARIES))
print(f"{pkg_config} could not find libraries {FFMPEG_LIBRARIES}")
exit(1)

known, unknown = parse_cflags(raw_cflags.decode("utf-8"))
Expand Down

0 comments on commit ba7a2c9

Please sign in to comment.