Skip to content

Commit d322f06

Browse files
authored
New binaries (#120)
* use latest binaries * deliberate typo to see if ci spots this * restore typo * fix windows * try fix test
1 parent ef411bf commit d322f06

File tree

2 files changed

+55
-40
lines changed

2 files changed

+55
-40
lines changed

imageio_ffmpeg/_definitions.py

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,69 @@
1+
import sys
12
import platform
2-
import struct
3+
34

45
__version__ = "0.5.1"
56

67

78
def get_platform():
8-
bits = struct.calcsize("P") * 8
9-
if platform.system().lower().startswith("linux"):
10-
architecture = platform.machine()
11-
if architecture == "aarch64":
12-
return "linuxaarch64"
13-
return "linux{}".format(bits)
14-
elif platform.system().lower().startswith("freebsd"):
15-
return "freebsd{}".format(bits)
16-
elif platform.system().lower().startswith("win"):
17-
return "win{}".format(bits)
18-
elif platform.system().lower().startswith("cygwin"):
19-
return "win{}".format(bits)
20-
elif platform.system().lower().startswith("darwin"):
21-
if platform.processor().lower().startswith("arm"): # Apple Silicon
22-
return "osx-arm{}".format(bits)
23-
else:
24-
return "osx-{}".format(bits)
25-
else: # pragma: no cover
26-
return None
9+
# get_os_string and get_arch are taken from wgpu-py
10+
return _get_os_string() + "-" + _get_arch()
11+
12+
13+
def _get_os_string():
14+
if sys.platform.startswith("win"):
15+
return "windows"
16+
elif sys.platform.startswith("darwin"):
17+
return "macos"
18+
elif sys.platform.startswith("linux"):
19+
return "linux"
20+
else:
21+
return sys.platform
22+
23+
24+
def _get_arch():
25+
# See e.g.: https://stackoverflow.com/questions/45124888
26+
is_64_bit = sys.maxsize > 2**32
27+
machine = platform.machine()
28+
29+
if machine == "armv7l":
30+
# Raspberry pi
31+
detected_arch = "armv7"
32+
elif is_64_bit and machine.startswith(("arm", "aarch64")):
33+
# Includes MacOS M1, arm linux, ...
34+
detected_arch = "aarch64"
35+
elif is_64_bit:
36+
detected_arch = "x86_64"
37+
else:
38+
detected_arch = "i686"
39+
return detected_arch
2740

2841

2942
# The Linux static builds (https://johnvansickle.com/ffmpeg/) are build
30-
# for Linux kernels 2.6.32 and up (at the time of writing, ffmpeg v4.1).
31-
# This corresponds to CentOS 6. This means we should use manylinux2010 and not
32-
# manylinux1.
33-
# manylinux1: https://www.python.org/dev/peps/pep-0513
34-
# manylinux2010: https://www.python.org/dev/peps/pep-0571
43+
# for Linux kernels 3.2.0 and up (at the time of writing, ffmpeg v7.0.2).
44+
# This corresponds to Ubuntu 12.04 / Debian 7. I'm not entirely sure'
45+
# what manylinux matches that, but I think manylinux2014 should be safe.
3546

3647

3748
# Platform string -> ffmpeg filename
3849
FNAME_PER_PLATFORM = {
39-
"osx-arm64": "ffmpeg-osx-arm64-v7.0", # Apple Silicon
40-
"osx64": "ffmpeg-osx-x86-v7.0", # 10.9+
41-
"win32": "ffmpeg-win32-v4.2.2.exe", # Windows 7+
42-
"win64": "ffmpeg-win64-v4.2.2.exe",
43-
# "linux32": "ffmpeg-linux32-v4.2.2",
44-
"linux64": "ffmpeg-linux64-v4.2.2", # Kernel 3.2.0+
45-
"linuxaarch64": "ffmpeg-linuxaarch64-v4.2.2",
50+
"macos-aarch64": "ffmpeg-macos-aarch64-v7.1",
51+
"macos-x86_64": "ffmpeg-macos-x86_64-v7.1", # 10.9+
52+
"windows-x86_64": "ffmpeg-win-x86_64-v7.1.exe",
53+
"windows-i686": "ffmpeg-win32-v4.2.2.exe", # Windows 7+
54+
"linux-aarch64": "ffmpeg-linux-aarch64-v7.0.2", # Kernel 3.2.0+
55+
"linux-x86_64": "ffmpeg-linux-x86_64-v7.0.2",
4656
}
4757

4858
osxplats = "macosx_10_9_intel.macosx_10_9_x86_64"
4959
osxarmplats = "macosx_11_0_arm64"
5060

5161
# Wheel tag -> platform string
5262
WHEEL_BUILDS = {
53-
"py3-none-manylinux2010_x86_64": "linux64",
54-
"py3-none-manylinux2014_aarch64": "linuxaarch64",
55-
"py3-none-" + osxplats: "osx64", # Apple Intel
56-
"py3-none-" + osxarmplats: "osx-arm64", # Apple Silicon
57-
"py3-none-win32": "win32",
58-
"py3-none-win_amd64": "win64",
63+
"py3-none-manylinux2014_x86_64": "linux-x86_64",
64+
"py3-none-manylinux2014_aarch64": "linux-aarch64",
65+
"py3-none-" + osxplats: "macos-x86_64",
66+
"py3-none-" + osxarmplats: "macos-aarch64",
67+
"py3-none-win32": "windows-i686",
68+
"py3-none-win_amd64": "windows-x86_64",
5969
}

tests/testutils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging.handlers
22
import os
3+
import time
34
import tempfile
45
from urllib.request import urlopen
56

@@ -47,8 +48,12 @@ def wrapper():
4748

4849

4950
def get_ffmpeg_pids():
51+
time.sleep(0.01)
5052
pids = set()
5153
for p in psutil.process_iter():
52-
if "ffmpeg" in p.name().lower():
53-
pids.add(p.pid)
54+
try:
55+
if "ffmpeg" in p.name().lower():
56+
pids.add(p.pid)
57+
except psutil.NoSuchProcess:
58+
pass
5459
return pids

0 commit comments

Comments
 (0)