Skip to content

Commit

Permalink
Merge pull request #411 from jjfumero/enhance/windows/installer
Browse files Browse the repository at this point in the history
[windows] Windows installer improved
  • Loading branch information
jjfumero authored May 10, 2024
2 parents 44eea1e + fec923c commit 6f0f055
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 11 deletions.
12 changes: 7 additions & 5 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import subprocess
import sys

import install_python_modules as tornadoReq

tornadoReq.check_python_dependencies()

import config_utils as cutils

import update_paths as updp
import pull_graal_jars

Expand Down Expand Up @@ -315,10 +316,7 @@ def copy_jars(graal_jars_src_dir, graal_jars_dst_dir):
if os.path.isfile(source_file):
shutil.copy(source_file, destination_file)


def post_installation_actions(
backend_profiles, mvn_build_result, jdk, graal_jars_status
):
def post_installation_actions(backend_profiles, mvn_build_result, jdk, graal_jars_status):
"""
Performs post-installation actions.
Expand All @@ -342,6 +340,10 @@ def post_installation_actions(
graal_jars_dst_dir = os.path.join(f"{os.environ['TORNADO_SDK']}", "share", "java", "graalJars")
os.makedirs(graal_jars_dst_dir, exist_ok=True)
copy_jars(graal_jars_src_dir, graal_jars_dst_dir)

if os.name == 'nt':
cutils.runPyInstaller(os.getcwd(), os.environ['TORNADO_SDK'])

else:
print("\nCompilation failed\n")
sys.exit(-1)
Expand Down
33 changes: 33 additions & 0 deletions bin/config_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3

#
# Copyright (c) 2013-2024, APT Group, Department of Computer Science,
# The University of Manchester.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os

def runPyInstaller(currentDirectory, tornadoSDKPath):
path = os.path.join(tornadoSDKPath, "bin")
os.chdir(path)

## List of scripts to compile
scripts = ["tornado", "tornado-test", "tornado-benchmarks.py"]
for s in scripts:
print("creating " + s + " binary .... "),
command = "pyinstaller " + s + " --onefile"
os.system(command)
print("ok ")

os.chdir(currentDirectory)
17 changes: 14 additions & 3 deletions bin/install_python_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,33 @@


def check_python_dependencies():
"""
Check the required dependencies for the installation of TornadoVM.
"""

try:
import requests
except:
subprocess.call(["pip3", "install", "requests"], stderr=subprocess.DEVNULL)

import requests

try:
import tqdm
except:
subprocess.call(["pip3", "install", "tqdm"], stderr=subprocess.DEVNULL)

import tqdm

try:
import urllib3
except:
subprocess.call(["pip3", "install", "urllib3"], stderr=subprocess.DEVNULL)

import urllib3

try:
import wget
except:
subprocess.call(["pip3", "install", "wget"], stderr=subprocess.DEVNULL)
import wget

return 0

3 changes: 2 additions & 1 deletion bin/softwareDevDependencies.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Requests
requests
tqdm
urllib3
wget
black
rstcheck
pre-commit
pyinstaller
3 changes: 2 additions & 1 deletion bin/tornadoDepModules.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Requests
requests
tqdm
urllib3
wget
black
sphinx_rtd_theme
pyinstaller
5 changes: 4 additions & 1 deletion bin/tornadovm-installer
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import tarfile
import zipfile

import install_python_modules as tornadoReq
import config_utils as cutils

tornadoReq.check_python_dependencies()

Expand Down Expand Up @@ -245,9 +246,11 @@ class TornadoInstaller:
allPaths = allPaths + p + os.pathsep

if os.name == 'nt':
binariesDistribution = os.path.join(os.environ["TORNADO_SDK"], "bin", "dist")
cutils.runPyInstaller(os.getcwd(), os.environ["TORNADO_SDK"])
fileContent = "set JAVA_HOME=" + os.environ["JAVA_HOME"] + "\n"
levelZeroPath = os.path.join(os.getcwd(), "level-zero", "build", "bin", "Release")
fileContent = fileContent + "set PATH=" + allPaths + levelZeroPath + os.pathsep + "%PATH%" + "\n"
fileContent = fileContent + "set PATH=" + allPaths + levelZeroPath + os.pathsep + binariesDistribution + os.pathsep + "%PATH%" + "\n"
fileContent = (
fileContent + "set TORNADO_SDK=" + os.environ["TORNADO_SDK"] + "\n"
)
Expand Down
1 change: 1 addition & 0 deletions bin/windowsMicrosoftStudioTools2022.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmd.exe /k "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -startdir=none -arch=x64 -host_arch=x64

0 comments on commit 6f0f055

Please sign in to comment.