@@ -20,9 +20,10 @@ def get_version():
2020 version_line = [l .strip () for l in init_py if l .startswith ("__version__" )][0 ]
2121 version = version_line .split ("=" )[- 1 ].strip ().strip ("'\" " )
2222
23- # Used by CI to build nightly packages. Users should never use it.
24- # To build a nightly wheel, run:
25- # FORCE_CUDA=1 BUILD_NIGHTLY=1 TORCH_CUDA_ARCH_LIST=All python setup.py bdist_wheel
23+ # The following is used to build release packages.
24+ # Users should never use it.
25+ suffix = os .getenv ("D2_VERSION_SUFFIX" , "" )
26+ version = version + suffix
2627 if os .getenv ("BUILD_NIGHTLY" , "0" ) == "1" :
2728 from datetime import datetime
2829
@@ -52,7 +53,9 @@ def get_extensions():
5253 extra_compile_args = {"cxx" : []}
5354 define_macros = []
5455
55- if (torch .cuda .is_available () and CUDA_HOME is not None ) or os .getenv ("FORCE_CUDA" , "0" ) == "1" :
56+ if (
57+ torch .cuda .is_available () and CUDA_HOME is not None and os .path .isdir (CUDA_HOME )
58+ ) or os .getenv ("FORCE_CUDA" , "0" ) == "1" :
5659 extension = CUDAExtension
5760 sources += source_cuda
5861 define_macros += [("WITH_CUDA" , None )]
@@ -95,18 +98,20 @@ def get_model_zoo_configs() -> List[str]:
9598 path .dirname (path .realpath (__file__ )), "detectron2" , "model_zoo" , "configs"
9699 )
97100 # Symlink the config directory inside package to have a cleaner pip install.
98- if path .exists (destination ):
99- # Remove stale symlink/directory from a previous build.
101+
102+ # Remove stale symlink/directory from a previous build.
103+ if path .exists (source_configs_dir ):
100104 if path .islink (destination ):
101105 os .unlink (destination )
102- else :
106+ elif path . isdir ( destination ) :
103107 shutil .rmtree (destination )
104108
105- try :
106- os .symlink (source_configs_dir , destination )
107- except OSError :
108- # Fall back to copying if symlink fails: ex. on Windows.
109- shutil .copytree (source_configs_dir , destination )
109+ if not path .exists (destination ):
110+ try :
111+ os .symlink (source_configs_dir , destination )
112+ except OSError :
113+ # Fall back to copying if symlink fails: ex. on Windows.
114+ shutil .copytree (source_configs_dir , destination )
110115
111116 config_paths = glob .glob ("configs/**/*.yaml" , recursive = True )
112117 return config_paths
@@ -124,7 +129,7 @@ def get_model_zoo_configs() -> List[str]:
124129 python_requires = ">=3.6" ,
125130 install_requires = [
126131 "termcolor>=1.1" ,
127- "Pillow==6.2.2 " , # torchvision currently does not work with Pillow 7
132+ "Pillow" , # you can also use pillow-simd for better performance
128133 "yacs>=0.1.6" ,
129134 "tabulate" ,
130135 "cloudpickle" ,
0 commit comments