Skip to content

Commit

Permalink
Switch requirements to PEP440 direct references
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelange committed Jun 24, 2023
1 parent c89ff0e commit f8d16ac
Showing 1 changed file with 37 additions and 15 deletions.
52 changes: 37 additions & 15 deletions python/packaging/frontend_sdist/setup.py
Expand Up @@ -14,30 +14,51 @@
# 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##"

# 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 = "https://pypi.nvidia.com/{}-libs/{}_libs-{}-py2.py3-none-{}_{}.whl".format(
tensorrt_module,
tensorrt_module,
tensorrt_version,
platform_marker,
machine_marker,
)
bindings_wheel = "https://pypi.nvidia.com/{}-bindings/{}_bindings-{}-{}-none-{}_{}.whl".format(
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
To install, please execute the following:
```
pip install tensorrt --extra-index-url https://pypi.nvidia.com
```
Or put the index URL in the (comma-separated) PIP_EXTRA_INDEX_URL environment variable:
```
export PIP_EXTRA_INDEX_URL=https://pypi.nvidia.com
pip install tensorrt
```
""",
long_description_content_type="text/markdown",
long_description="A high performance deep learning inference library",
author="NVIDIA Corporation",
license="Proprietary",
classifiers=[
Expand All @@ -47,9 +68,10 @@
],
packages=[tensorrt_module],
install_requires=[
"{}_libs=={}".format(tensorrt_module, tensorrt_version),
"{}_bindings=={}".format(tensorrt_module, tensorrt_version),
"{}_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,
Expand Down

0 comments on commit f8d16ac

Please sign in to comment.