-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
setup.py
85 lines (78 loc) · 2.94 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import platform
import sys
from setuptools import setup
tensorrt_module = "##TENSORRT_MODULE##"
tensorrt_version = "##TENSORRT_PYTHON_VERSION##"
index_url = "https://pypi.nvidia.com"
# cherry-pick information from `packaging.markers.default_environment()` needed to find the right wheel
# https://github.com/pypa/packaging/blob/23.1/src/packaging/markers.py#L175-L190
if sys.platform == "linux":
platform_marker = "manylinux_2_17"
else:
raise RuntimeError("TensorRT currently only builds wheels for linux")
if sys.implementation.name == "cpython":
implementation_marker = "cp{}".format("".join(platform.python_version_tuple()[:2]))
else:
raise RuntimeError("TensorRT currently only builds wheels for CPython")
machine_marker = platform.machine()
if machine_marker != "x86_64":
raise RuntimeError("TensorRT currently only builds wheels for x86_64 processors")
libs_wheel = "{}/{}-libs/{}_libs-{}-py2.py3-none-{}_{}.whl".format(
index_url,
tensorrt_module,
tensorrt_module,
tensorrt_version,
platform_marker,
machine_marker,
)
bindings_wheel = "{}/{}-bindings/{}_bindings-{}-{}-none-{}_{}.whl".format(
index_url,
tensorrt_module,
tensorrt_module,
tensorrt_version,
implementation_marker,
platform_marker,
machine_marker,
)
setup(
name=tensorrt_module,
version=tensorrt_version,
description="A high performance deep learning inference library",
long_description="A high performance deep learning inference library",
author="NVIDIA Corporation",
license="Proprietary",
classifiers=[
"License :: Other/Proprietary License",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
],
packages=[tensorrt_module],
install_requires=[
"{}_libs @ {}".format(tensorrt_module, libs_wheel),
"{}_bindings @ {}".format(tensorrt_module, bindings_wheel),
],
python_requires=">=3.6", # ref https://pypi.nvidia.com/tensorrt-bindings/
extras_require={"numpy": "numpy"},
package_data={tensorrt_module: ["*.so*", "*.pyd", "*.pdb"]},
include_package_data=True,
zip_safe=True,
keywords="nvidia tensorrt deeplearning inference",
url="https://developer.nvidia.com/tensorrt",
download_url="https://github.com/nvidia/tensorrt/tags",
)