Skip to content

Commit 4d6b50d

Browse files
authored
[Fix] Fix symlink failure on Windows (open-mmlab#1038)
* fix symlink failure on Windows * fix develop mode on windows
1 parent c23e902 commit 4d6b50d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

setup.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) OpenMMLab. All rights reserved.
22
import os
33
import os.path as osp
4+
import platform
45
import shutil
56
import sys
67
import warnings
@@ -109,10 +110,16 @@ def add_mim_extension():
109110
# parse installment mode
110111
if 'develop' in sys.argv:
111112
# installed by `pip install -e .`
112-
mode = 'symlink'
113-
elif 'sdist' in sys.argv or 'bdist_wheel' in sys.argv:
113+
if platform.system() == 'Windows':
114+
# set `copy` mode here since symlink fails on Windows.
115+
mode = 'copy'
116+
else:
117+
mode = 'symlink'
118+
elif 'sdist' in sys.argv or 'bdist_wheel' in sys.argv or \
119+
platform.system() == 'Windows':
114120
# installed by `pip install .`
115121
# or create source distribution by `python setup.py sdist`
122+
# set `copy` mode here since symlink fails with WinError on Windows.
116123
mode = 'copy'
117124
else:
118125
return

0 commit comments

Comments
 (0)