Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build_url(self):
from ai2thor.build import arch_platform_map
import ai2thor.build
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
def build_image():
version = nvidia_version()
tag = ai2thor._builds.BUILDS['Docker']['tag']
image_name = 'ai2thor/ai2thor-nvidia-%s:%s' % (version, tag)
if image_exists(image_name):
return image_name
td = tempfile.mkdtemp()
with open("%s/Dockerfile" % td, "w") as f:
f.write(generate_dockerfile(tag))
subprocess.check_call("docker build --rm -t %s %s" % (image_name, td), shell=True)
shutil.rmtree(td)
return image_name
def build_image():
version = nvidia_version()
tag = ai2thor._builds.BUILDS['Docker']['tag']
image_name = 'ai2thor/ai2thor-nvidia-%s:%s' % (version, tag)
if image_exists(image_name):
return image_name
td = tempfile.mkdtemp()
with open("%s/Dockerfile" % td, "w") as f:
f.write(generate_dockerfile(tag))
subprocess.check_call("docker build --rm -t %s %s" % (image_name, td), shell=True)
shutil.rmtree(td)
return image_name