Skip to content

Commit

Permalink
Further updates for 2.4.2 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitBM committed Apr 1, 2021
1 parent 64b952f commit 292f4e3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Build/CMake
Build/Windows
Build/Linux
Core/DX10ASM/Lib/VS2015/Win32/Release*
Core/DX10ASM/Lib/VS2015/x64
Core/DX12/DXC/dxcompiler.dll
Core/LC/Disassembler
Core/Vulkan/tools/Win64/lib/Debug
Core/VulkanOffline
Output
.vscode
Output_Test
Expand Down
48 changes: 37 additions & 11 deletions Build/fetch_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import argparse
import os
import platform
import stat
import subprocess
import sys
import tarfile
Expand Down Expand Up @@ -66,6 +67,35 @@ def parse_arguments():
return (parser.parse_args())


def get_os():
# detect the OS
MACHINE_OS = ""
if "windows" in platform.system().lower():
MACHINE_OS = "Windows"
elif "cygwin" in platform.system().lower():
MACHINE_OS = "Windows"
elif "linux" in platform.system().lower():
MACHINE_OS = "Linux"
else:
print("Operating system not recognized correctly")
sys.exit(1)
return MACHINE_OS


def make_executable(file_path):
# chmod +x the Ubuntu binaries.
cur_dir = os.getcwd()
os.chdir(file_path)
bin_files = subprocess.getoutput('find . -type f -print0 | xargs -0 -n 10 file -i | grep "application/x-executable"')
if len(bin_files) > 0:
bin_files_list = bin_files.split('\n')
for bin_file in bin_files_list:
file_name = bin_file.split(':')
target_bin_file = file_name[0]
os.chmod(target_bin_file, stat.S_IRWXU|stat.S_IRWXG|stat.S_IROTH|stat.S_IXOTH)
os.chdir(cur_dir)


def downloadandunzip(key, value):
# convert targetPath to OS specific format
tmppath = os.path.join(script_root, value)
Expand Down Expand Up @@ -128,6 +158,8 @@ def artifactoryDownload(file_path, value):
artifactory_download.DownloadFile(artifactory_path)
if os.path.splitext(zip_file_name)[1] == ".zip":
zipfile.ZipFile(zip_file_name).extractall(target_path)
if (get_os() == "Linux"):
make_executable(target_path)
os.remove(zip_file_name)
else:
os.rename(zip_file_name, os.path.join(target_path, zip_file_name))
Expand Down Expand Up @@ -253,20 +285,11 @@ def do_fetch_dependencies(arguments):
fetch_github_map(arguments, git_branch)

# detect the OS
MACHINE_OS = ""
if "windows" in platform.system().lower():
MACHINE_OS = "Windows"
elif "cygwin" in platform.system().lower():
MACHINE_OS = "Windows"
elif "linux" in platform.system().lower():
MACHINE_OS = "Linux"
else:
print("Operating system not recognized correctly")
sys.exit(1)
machine_os = get_os()

# reference the correct archive path
download_mapping = None
if MACHINE_OS == "Linux":
if machine_os == "Linux":
download_mapping = download_mapping_linux
else:
download_mapping = download_mapping_windows
Expand All @@ -291,6 +314,9 @@ def do_fetch_dependencies(arguments):
target_path = os.path.normpath(os.path.join(rga_root, zip_files[key]))
if os.path.splitext(zip_file_path)[1] == ".zip":
zipfile.ZipFile(zip_file_path).extractall(target_path)
# extractall doesn't retain execute permissions on Linux binaries.
if (machine_os == "Linux"):
make_executable(target_path)
os.remove(zip_file_path)
else:
# Support file dxcompiler.dll.
Expand Down

0 comments on commit 292f4e3

Please sign in to comment.