Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if platform.system() in BUILDS:
return (BUILDS[platform.system()]['url'], BUILDS[platform.system()]['sha256'])
else:
url = None
sha256_build = None
git_dir = os.path.normpath(os.path.dirname(os.path.realpath(__file__)) + "/../.git")
for commit_id in subprocess.check_output('git --git-dir=' + git_dir + ' log -n 10 --format=%H', shell=True).decode('ascii').strip().split("\n"):
arch = arch_platform_map[platform.system()]
try:
u = ai2thor.downloader.commit_build_url(arch, commit_id)
if os.path.isfile(self.executable_path(url=u)):
# don't need sha256 since we aren't going to download
url = u
break
elif ai2thor.downloader.commit_build_exists(arch, commit_id):
sha256_build = ai2thor.downloader.commit_build_sha256(arch, commit_id)
url = u
break
except Exception:
pass
if url is None:
raise Exception("Couldn't find a suitable build url for platform: %s" % platform.system())
# print("Got build for %s: " % (url))
return (url, sha256_build)
def ci_build_arch(arch, branch):
from multiprocessing import Process
import subprocess
import boto3
import ai2thor.downloader
github_url = "https://github.com/allenai/ai2thor"
commit_id = (
subprocess.check_output("git log -n 1 --format=%H", shell=True)
.decode("ascii")
.strip()
)
if ai2thor.downloader.commit_build_exists(arch, commit_id):
print("found build for commit %s %s" % (commit_id, arch))
return
build_url_base = "http://s3-us-west-2.amazonaws.com/%s/" % S3_BUCKET
unity_path = "unity"
build_name = "thor-%s-%s" % (arch, commit_id)
build_dir = os.path.join("builds", build_name)
build_path = build_dir + ".zip"
build_info = {}
build_info["url"] = build_url_base + build_path
build_info["build_exception"] = ""
proc = None
try:
build_info["log"] = "%s.log" % (build_name,)
)
for i in range(360):
missing = False
for arch in platform_map.keys():
if (i % 5) == 0:
print("checking %s for commit id %s" % (arch, commit_id))
if ai2thor.downloader.commit_build_log_exists(arch, commit_id):
print("log exists %s" % commit_id)
else:
missing = True
if not missing:
break
time.sleep(10)
for arch in platform_map.keys():
if not ai2thor.downloader.commit_build_exists(arch, commit_id):
print(
"Build log url: %s"
% ai2thor.downloader.commit_build_log_url(arch, commit_id)
)
raise Exception("Failed to build %s for commit: %s " % (arch, commit_id))