[Fix] Do not depend on setuptools>=52 (#1235)

* use packaging instead

* update

* update

* update

* update
pull/1254/head
Haodong Duan 2021-08-10 16:17:59 +08:00 committed by GitHub
parent dfb48c87ae
commit 93418560d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 23 deletions

View File

@ -41,8 +41,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Validate the installation
@ -77,8 +75,6 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Validate the installation
@ -122,8 +118,6 @@ jobs:
if: ${{matrix.torchvision == '0.4.2'}}
- name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Validate the installation
@ -194,8 +188,6 @@ jobs:
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Validate the installation
@ -266,8 +258,6 @@ jobs:
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Validate the installation
@ -320,8 +310,6 @@ jobs:
if: ${{matrix.torchvision == '0.4.2'}}
- name: Install PyTorch
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} --no-cache-dir
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install
run: |
rm -rf .eggs

View File

@ -2,7 +2,8 @@
import os
import subprocess
import warnings
from pkg_resources import parse_version
from packaging.version import parse
def digit_version(version_str: str, length: int = 4):
@ -19,7 +20,7 @@ def digit_version(version_str: str, length: int = 4):
tuple[int]: The version info in digits (integers).
"""
assert 'parrots' not in version_str
version = parse_version(version_str)
version = parse(version_str)
assert version.release, f'failed to parse version {version_str}'
release = list(version.release)
release = release[:length]

View File

@ -1,7 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
from pkg_resources import parse_version
__version__ = '1.3.10'
@ -17,7 +14,8 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple:
(1, 3, 0, 0, 0, 0), and "2.0.0rc1" is parsed into
(2, 0, 0, 0, 'rc', 1) (when length is set to 4).
"""
version = parse_version(version_str)
from packaging.version import parse
version = parse(version_str)
assert version.release, f'failed to parse version {version_str}'
release = list(version.release)
release = release[:length]
@ -32,6 +30,6 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple:
return tuple(release)
version_info = parse_version_info(__version__)
version_info = tuple(int(x) for x in __version__.split('.')[:3])
__all__ = ['__version__', 'version_info', 'parse_version_info']

View File

@ -1,7 +1,7 @@
addict
numpy
packaging
Pillow
pyyaml
regex;sys_platform=='win32'
setuptools>=52
yapf

View File

@ -6,5 +6,4 @@ onnxruntime==1.4.0
pytest
PyTurboJPEG
scipy
setuptools>=52
tiffile

View File

@ -1,7 +1,7 @@
import glob
import os
import re
from pkg_resources import DistributionNotFound, get_distribution, parse_version
from pkg_resources import DistributionNotFound, get_distribution
from setuptools import find_packages, setup
EXT_TYPE = ''
@ -220,10 +220,12 @@ def get_extensions():
include_dirs = []
is_rocm_pytorch = False
if parse_version(torch.__version__) >= parse_version('1.5'):
try:
from torch.utils.cpp_extension import ROCM_HOME
is_rocm_pytorch = True if ((torch.version.hip is not None) and
(ROCM_HOME is not None)) else False
except ImportError:
pass
project_dir = 'mmcv/ops/csrc/'
if is_rocm_pytorch: