mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-01-07 11:23:23 +00:00
chore(x11/python-torch): Move to x11-packages for opencv-qt5 addition
This commit is contained in:
99
x11-packages/python-torchvision/setup.py.patch
Normal file
99
x11-packages/python-torchvision/setup.py.patch
Normal file
@@ -0,0 +1,99 @@
|
||||
--- ./setup.py.orig
|
||||
+++ ./setup.py
|
||||
@@ -6,10 +6,9 @@
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
-import torch
|
||||
from pkg_resources import DistributionNotFound, get_distribution, parse_version
|
||||
from setuptools import find_packages, setup
|
||||
-from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDA_HOME, CUDAExtension
|
||||
+from setuptools import Extension as CppExtension
|
||||
|
||||
|
||||
def read(*names, **kwargs):
|
||||
@@ -159,11 +158,6 @@
|
||||
|
||||
is_rocm_pytorch = False
|
||||
|
||||
- if torch.__version__ >= "1.5":
|
||||
- from torch.utils.cpp_extension import ROCM_HOME
|
||||
-
|
||||
- is_rocm_pytorch = (torch.version.hip is not None) and (ROCM_HOME is not None)
|
||||
-
|
||||
if is_rocm_pytorch:
|
||||
from torch.utils.hipify import hipify_python
|
||||
|
||||
@@ -189,7 +183,7 @@
|
||||
define_macros = []
|
||||
|
||||
- extra_compile_args = {"cxx": []}
|
||||
- if (torch.cuda.is_available() and ((CUDA_HOME is not None) or is_rocm_pytorch)) or force_cuda:
|
||||
+ extra_compile_args = {}
|
||||
+ if False:
|
||||
extension = CUDAExtension
|
||||
sources += source_cuda
|
||||
if not is_rocm_pytorch:
|
||||
@@ -245,7 +245,7 @@
|
||||
image_macros += [("USE_PYTHON", None)]
|
||||
|
||||
# Locating libPNG
|
||||
- libpng = shutil.which("libpng-config")
|
||||
+ libpng = "@TERMUX_PREFIX@/bin/libpng-config"
|
||||
pngfix = shutil.which("pngfix")
|
||||
png_found = libpng is not None or pngfix is not None
|
||||
|
||||
@@ -308,11 +302,7 @@
|
||||
|
||||
# Locating nvjpeg
|
||||
# Should be included in CUDA_HOME for CUDA >= 10.1, which is the minimum version we have in the CI
|
||||
- nvjpeg_found = (
|
||||
- extension is CUDAExtension
|
||||
- and CUDA_HOME is not None
|
||||
- and os.path.exists(os.path.join(CUDA_HOME, "include", "nvjpeg.h"))
|
||||
- )
|
||||
+ nvjpeg_found = False
|
||||
|
||||
use_nvjpeg = use_nvjpeg and nvjpeg_found
|
||||
if use_nvjpeg:
|
||||
@@ -343,7 +333,7 @@
|
||||
)
|
||||
|
||||
# Locating ffmpeg
|
||||
- ffmpeg_exe = shutil.which("ffmpeg")
|
||||
+ ffmpeg_exe = "@TERMUX_PREFIX@/bin/ffmpeg"
|
||||
has_ffmpeg = ffmpeg_exe is not None
|
||||
ffmpeg_version = None
|
||||
# FIXME: Building torchvision with ffmpeg on MacOS or with Python 3.9
|
||||
@@ -352,7 +342,7 @@
|
||||
# FIXME: https://github.com/pytorch/vision/issues/3367
|
||||
if sys.platform != "linux" or (sys.version_info.major == 3 and sys.version_info.minor == 9):
|
||||
has_ffmpeg = False
|
||||
- if has_ffmpeg:
|
||||
+ if False:
|
||||
try:
|
||||
# This is to check if ffmpeg is installed properly.
|
||||
ffmpeg_version = subprocess.check_output(["ffmpeg", "-version"])
|
||||
@@ -444,13 +434,7 @@
|
||||
# CUDA_HOME should be set to the cuda root directory.
|
||||
# TORCHVISION_INCLUDE and TORCHVISION_LIBRARY should include the location to
|
||||
# video codec header files and libraries respectively.
|
||||
- video_codec_found = (
|
||||
- extension is CUDAExtension
|
||||
- and CUDA_HOME is not None
|
||||
- and any([os.path.exists(os.path.join(folder, "cuviddec.h")) for folder in vision_include])
|
||||
- and any([os.path.exists(os.path.join(folder, "nvcuvid.h")) for folder in vision_include])
|
||||
- and any([os.path.exists(os.path.join(folder, "libnvcuvid.so")) for folder in library_dirs])
|
||||
- )
|
||||
+ video_codec_found = False
|
||||
|
||||
use_video_codec = use_video_codec and video_codec_found
|
||||
if (
|
||||
@@ -547,7 +531,6 @@
|
||||
ext_modules=get_extensions(),
|
||||
python_requires=">=3.8",
|
||||
cmdclass={
|
||||
- "build_ext": BuildExtension.with_options(no_python_abi_suffix=True),
|
||||
"clean": clean,
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user