diff --git a/setup.py b/setup.py index 119eacd7328..5967f458918 100644 --- a/setup.py +++ b/setup.py @@ -254,17 +254,19 @@ def bazel_build(self, ext): # package BladeDISC distribution files # please note, TorchBlade also create some symbolic links to 'torch_blade' dir - disc_ral_so_name = 'libral_base_context.so' - bazel_bin_path = 'build/temp.linux-x86_64-cpython-310/bazel-bin/external/disc_compiler' - shutil.copyfile( - os.path.join(bazel_bin_path, disc_ral_so_name), - '/'.join([ext_dest_dir, disc_ral_so_name])) - - disc_customop_so_name = 'libdisc_custom_ops.so' - bazel_bin_path = 'build/temp.linux-x86_64-cpython-38/bazel-bin/external/disc_compiler' - shutil.copyfile( - os.path.join(bazel_bin_path, disc_customop_so_name), - '/'.join([ext_dest_dir, disc_customop_so_name])) + + if build_util.check_env_flag('ENABLE_DISC', 'true'): + disc_ral_so_name = 'libral_base_context.so' + bazel_bin_path = 'build/temp.linux-x86_64-cpython-310/bazel-bin/external/disc_compiler' + shutil.copyfile( + os.path.join(bazel_bin_path, disc_ral_so_name), + '/'.join([ext_dest_dir, disc_ral_so_name])) + + disc_customop_so_name = 'libdisc_custom_ops.so' + bazel_bin_path = 'build/temp.linux-x86_64-cpython-310/bazel-bin/external/disc_compiler' + shutil.copyfile( + os.path.join(bazel_bin_path, disc_customop_so_name), + '/'.join([ext_dest_dir, disc_customop_so_name])) class Develop(develop.develop):