mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 06:26:03 +00:00
Replace pkg_resources.parse_requirements with packaging.requirements.Requiremen
This commit is contained in:
parent
f7e34da3e9
commit
dd816f3675
13
setup.py
13
setup.py
@ -3,6 +3,7 @@ import platform
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from packaging.requirements import Requirement
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
|
|
||||||
@ -13,6 +14,11 @@ def read_version(fname="whisper/version.py"):
|
|||||||
return version_module.__version__
|
return version_module.__version__
|
||||||
|
|
||||||
|
|
||||||
|
def parse_requirements(file_path = Path(__file__).with_name("requirements.txt")):
|
||||||
|
lines = file_path.read_text(encoding="utf-8").splitlines()
|
||||||
|
return [str(Requirement(line)) for line in lines if not line.startswith("#")]
|
||||||
|
|
||||||
|
|
||||||
requirements = []
|
requirements = []
|
||||||
if sys.platform.startswith("linux") and platform.machine() == "x86_64":
|
if sys.platform.startswith("linux") and platform.machine() == "x86_64":
|
||||||
requirements.append("triton>=2.0.0")
|
requirements.append("triton>=2.0.0")
|
||||||
@ -30,12 +36,7 @@ setup(
|
|||||||
url="https://github.com/openai/whisper",
|
url="https://github.com/openai/whisper",
|
||||||
license="MIT",
|
license="MIT",
|
||||||
packages=find_packages(exclude=["tests*"]),
|
packages=find_packages(exclude=["tests*"]),
|
||||||
install_requires=[
|
install_requires=parse_requirements(Path(__file__).with_name("requirements.txt")),
|
||||||
str(r)
|
|
||||||
for r in pkg_resources.parse_requirements(
|
|
||||||
Path(__file__).with_name("requirements.txt").open()
|
|
||||||
)
|
|
||||||
],
|
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": ["whisper=whisper.transcribe:cli"],
|
"console_scripts": ["whisper=whisper.transcribe:cli"],
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user