parent
feeac01083
commit
65265931c3
1
.gitignore
vendored
1
.gitignore
vendored
@ -112,6 +112,7 @@ data
|
|||||||
*.pkl.json
|
*.pkl.json
|
||||||
*.log.json
|
*.log.json
|
||||||
work_dirs/
|
work_dirs/
|
||||||
|
mmseg/.mim
|
||||||
|
|
||||||
# Pytorch
|
# Pytorch
|
||||||
*.pth
|
*.pth
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
include requirements/*.txt
|
include requirements/*.txt
|
||||||
include mmseg/model-index.yml
|
include mmseg/.mim/model-index.yml
|
||||||
recursive-include mmseg/configs *.py *.yml
|
recursive-include mmseg/.mim/configs *.py *.yml
|
||||||
recursive-include mmseg/tools *.sh *.py
|
recursive-include mmseg/.mim/tools *.py *.sh
|
||||||
|
|||||||
@ -142,3 +142,4 @@ and develop their own new semantic segmentation methods.
|
|||||||
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
|
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
|
||||||
- [MMOCR](https://github.com/open-mmlab/mmocr): A Comprehensive Toolbox for Text Detection, Recognition and Understanding.
|
- [MMOCR](https://github.com/open-mmlab/mmocr): A Comprehensive Toolbox for Text Detection, Recognition and Understanding.
|
||||||
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): A powerful toolkit for generative models.
|
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): A powerful toolkit for generative models.
|
||||||
|
- [MIM](https://github.com/open-mmlab/mim): MIM Installs OpenMMLab Packages.
|
||||||
|
|||||||
54
setup.py
54
setup.py
@ -1,3 +1,8 @@
|
|||||||
|
import os
|
||||||
|
import os.path as osp
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
import warnings
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +97,56 @@ def parse_requirements(fname='requirements.txt', with_version=True):
|
|||||||
return packages
|
return packages
|
||||||
|
|
||||||
|
|
||||||
|
def add_mim_extention():
|
||||||
|
"""Add extra files that are required to support MIM into the package.
|
||||||
|
|
||||||
|
These files will be added by creating a symlink to the originals if the
|
||||||
|
package is installed in `editable` mode (e.g. pip install -e .), or by
|
||||||
|
copying from the originals otherwise.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# parse installment mode
|
||||||
|
if 'develop' in sys.argv:
|
||||||
|
# installed by `pip install -e .`
|
||||||
|
mode = 'symlink'
|
||||||
|
elif 'sdist' in sys.argv or 'bdist_wheel' in sys.argv:
|
||||||
|
# installed by `pip install .`
|
||||||
|
# or create source distribution by `python setup.py sdist`
|
||||||
|
mode = 'copy'
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
filenames = ['tools', 'configs', 'model-index.yml']
|
||||||
|
repo_path = osp.dirname(__file__)
|
||||||
|
mim_path = osp.join(repo_path, 'mmseg', '.mim')
|
||||||
|
os.makedirs(mim_path, exist_ok=True)
|
||||||
|
|
||||||
|
for filename in filenames:
|
||||||
|
if osp.exists(filename):
|
||||||
|
src_path = osp.join(repo_path, filename)
|
||||||
|
tar_path = osp.join(mim_path, filename)
|
||||||
|
|
||||||
|
if osp.isfile(tar_path) or osp.islink(tar_path):
|
||||||
|
os.remove(tar_path)
|
||||||
|
elif osp.isdir(tar_path):
|
||||||
|
shutil.rmtree(tar_path)
|
||||||
|
|
||||||
|
if mode == 'symlink':
|
||||||
|
src_relpath = osp.relpath(src_path, osp.dirname(tar_path))
|
||||||
|
os.symlink(src_relpath, tar_path)
|
||||||
|
elif mode == 'copy':
|
||||||
|
if osp.isfile(src_path):
|
||||||
|
shutil.copyfile(src_path, tar_path)
|
||||||
|
elif osp.isdir(src_path):
|
||||||
|
shutil.copytree(src_path, tar_path)
|
||||||
|
else:
|
||||||
|
warnings.warn(f'Cannot copy file {src_path}.')
|
||||||
|
else:
|
||||||
|
raise ValueError(f'Invalid mode {mode}')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
add_mim_extention()
|
||||||
setup(
|
setup(
|
||||||
name='mmsegmentation',
|
name='mmsegmentation',
|
||||||
version=get_version(),
|
version=get_version(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user