Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include ffmpeg suitable for Apple Silicon macos arm64 platform #114

Merged
merged 8 commits into from
Jan 16, 2025
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -38,34 +38,34 @@ jobs:
matrix:
include:
# Python versions
- name: Linux py37
os: ubuntu-latest
pyversion: '3.7'
- name: Linux py38
os: ubuntu-latest
pyversion: '3.8'
- name: Linux py39
os: ubuntu-latest
pyversion: '3.9'
- name: Linux py310
os: ubuntu-latest
pyversion: '3.10'
- name: Linux py311
os: ubuntu-latest
pyversion: '3.11'
- name: Linux py312
os: ubuntu-latest
pyversion: '3.12'
- name: Linux py313
os: ubuntu-latest
pyversion: '3.13'
- name: Linux pypy
os: ubuntu-latest
pyversion: 'pypy3.9'
# OS's
- name: Linux py311
- name: Linux py313
os: ubuntu-latest
pyversion: '3.11'
- name: Windows py311
pyversion: '3.13'
- name: Windows py313
os: windows-latest
pyversion: '3.11'
- name: MacOS py311
pyversion: '3.13'
- name: MacOS py313
os: macos-latest
pyversion: '3.11'
pyversion: '3.13'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.pyversion }}
Expand Down
25 changes: 15 additions & 10 deletions imageio_ffmpeg/_definitions.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import platform
import struct
import sys

__version__ = "0.5.1"


def get_platform():
bits = struct.calcsize("P") * 8
if sys.platform.startswith("linux"):
if platform.system().lower().startswith("linux"):
architecture = platform.machine()
if architecture == "aarch64":
return "linuxaarch64"
return "linux{}".format(bits)
elif sys.platform.startswith("freebsd"):
elif platform.system().lower().startswith("freebsd"):
return "freebsd{}".format(bits)
elif sys.platform.startswith("win"):
elif platform.system().lower().startswith("win"):
return "win{}".format(bits)
elif sys.platform.startswith("cygwin"):
elif platform.system().lower().startswith("cygwin"):
return "win{}".format(bits)
elif sys.platform.startswith("darwin"):
return "osx{}".format(bits)
elif platform.system().lower().startswith("darwin"):
if platform.processor().lower().startswith("arm"): # Apple Silicon
return "osx-arm{}".format(bits)
else:
return "osx-{}".format(bits)
else: # pragma: no cover
return None

Expand All @@ -34,21 +36,24 @@ def get_platform():

# Platform string -> ffmpeg filename
FNAME_PER_PLATFORM = {
"osx64": "ffmpeg-osx64-v4.2.2", # 10.10+
"osx-arm64": "ffmpeg-osx-arm64-v7.0", # Apple Silicon
"osx64": "ffmpeg-osx-x86-v7.0", # 10.9+
"win32": "ffmpeg-win32-v4.2.2.exe", # Windows 7+
"win64": "ffmpeg-win64-v4.2.2.exe",
# "linux32": "ffmpeg-linux32-v4.2.2",
"linux64": "ffmpeg-linux64-v4.2.2", # Kernel 3.2.0+
"linuxaarch64": "ffmpeg-linuxaarch64-v4.2.2",
}

osxplats = "macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64"
osxplats = "macosx_10_9_intel.macosx_10_9_x86_64"
osxarmplats = "macosx_11_0_arm64"

# Wheel tag -> platform string
WHEEL_BUILDS = {
"py3-none-manylinux2010_x86_64": "linux64",
"py3-none-manylinux2014_aarch64": "linuxaarch64",
"py3-none-" + osxplats: "osx64",
"py3-none-" + osxplats: "osx64", # Apple Intel
"py3-none-" + osxarmplats: "osx-arm64", # Apple Silicon
"py3-none-win32": "win32",
"py3-none-win_amd64": "win64",
}
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
long_description=long_description,
platforms="any",
provides=["imageio_ffmpeg"],
python_requires=">=3.5",
python_requires=">=3.9",
setup_requires=[],
install_requires=[],
packages=["imageio_ffmpeg", "imageio_ffmpeg.binaries"],
Expand All @@ -74,11 +74,10 @@
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
)
Loading