0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-11 20:13:22 +00:00
Files
termux-packages/packages/python-scipy/wrapper.py.in
Fredrik Fornwall 01c8e30d53 bump(main/python-numpy): 2.1.1 and update revdeps
Update to numpy 2, and update reverse dependencies:

- matplotlib from 3.9.1 to 3.9.2
- python-contourpy from 1.2.1 to 1.3.0
- python-numpy from 1.26.5 to 2.1.1
- python-onnxruntime from 1.19.0 to 1.19.2
- python-scipy from 1.14.0 to 1.14.1
- python-torch from 2.1.2 to 2.4.1
- python-torchaudio from 2.0.1 to 2.4.1
- python-torchvision from 0.15.1 to `0.19.1
- Revbump: python-pyarrow, inkscape and opencv

Some of these packages does not currently build before this PR. Getting these updated and buildable is a nice step to prepare for [python 3.12](https://github.com/termux/termux-packages/pull/18078).

Fixes #21059, #21110, #21194 and #21284.

Co-authored-by: Chongyun Lee <45286352+licy183@users.noreply.github.com>
2024-10-04 21:02:55 +02:00

52 lines
1.5 KiB
Python

#!/usr/bin/python3
import os
import subprocess
import sys
import typing
"""
This wrapper is used to ignore or replace some unsupported flags for flang-new.
It will operate as follows:
1. Ignore `-Minform=inform` and `-fdiagnostics-color`.
They are added by meson automatically, but are not supported by flang-new yet.
2. Remove `-lflang` and `-lpgmath`.
It exists in classic-flang but doesn't exist in flang-new.
3. Replace `-Oz` to `-O2`.
`-Oz` is not supported by flang-new.
4. Replace `-module` to `-J`.
See https://github.com/llvm/llvm-project/issues/66969
5. Ignore `-MD`, `-MQ file` and `-MF file`.
They generates files used by GNU make but we're using ninja.
6. Ignore `-fvisibility=hidden`.
It is not supported by flang-new, and ignoring it will not break the functionality,
as scipy also uses version script for shared libraries.
"""
COMPLIER_PATH = "@COMPILER@"
def main(argv: typing.List[str]):
cwd = os.getcwd()
argv_new = []
i = 0
while i < len(argv):
arg = argv[i]
if arg in ["-Minform=inform", "-lflang", "-lpgmath", "-MD", "-fvisibility=hidden"] \
or arg.startswith("-fdiagnostics-color"):
pass
elif arg == "-Oz":
argv_new.append("-O2")
elif arg == "-module":
argv_new.append("-J")
elif arg in ["-MQ", "-MF"]:
i += 1
else:
argv_new.append(arg)
i += 1
args = [COMPLIER_PATH] + argv_new
subprocess.check_call(args, env=os.environ, cwd=cwd, text=True)
if __name__ == '__main__':
main(sys.argv[1:])