mesaport.Installer.prerequisites

 1import os
 2import shlex
 3import subprocess
 4
 5from . import mesaurls
 6
 7def install_prerequisites(directory, ostype, cleanAfter, logfile):
 8        """Install the pre-requisites for MESA.
 9
10        Args:
11            logfile (file): File to write the output of the installation to.
12        """        
13        if ostype == "Linux":
14            subprocess.Popen(shlex.split("sudo apt-get update"), stdout=logfile, stderr=logfile).wait()
15            try:
16                subprocess.Popen(shlex.split("sudo apt-get install -yq build-essential wget curl binutils make perl libx11-6 \
17                    libx11-dev zlib1g zlib1g-dev tcsh"), stdout=logfile, stderr=logfile).wait()
18            except:
19                try:
20                    subprocess.Popen(shlex.split("sudo apt-get install -yq binutils make perl libx11-6 libx11-dev zlib1g zlib1g-dev tcsh"),
21                                stdout=logfile, stderr=logfile).wait()
22                except:
23                    try:
24                        subprocess.Popen(shlex.split("sudo apt-get install -yq binutils make perl libx11 zlib tcsh glibc"),
25                                    stdout=logfile, stderr=logfile).wait()
26                    except:
27                        pass           
28        if "macOS" in ostype:
29            # print("[green]Installing XCode Command Line Tools...")
30            subprocess.Popen(shlex.split("sudo xcode-select --install"), stdout=logfile, stderr=logfile).wait()
31            
32            if not os.path.exists("/Applications/Utilities/XQuartz.app"):
33                xquartz = os.path.join(directory, mesaurls.url_xquartz.split('/')[-1])   
34
35                # print("[green]Installing XQuartz...")
36                subprocess.Popen(shlex.split(f"sudo installer -pkg {xquartz} -target /"), stdout=logfile, stderr=logfile).wait()
37                if cleanAfter:
38                    os.remove(xquartz)
39                    
def install_prerequisites(directory, ostype, cleanAfter, logfile):
 8def install_prerequisites(directory, ostype, cleanAfter, logfile):
 9        """Install the pre-requisites for MESA.
10
11        Args:
12            logfile (file): File to write the output of the installation to.
13        """        
14        if ostype == "Linux":
15            subprocess.Popen(shlex.split("sudo apt-get update"), stdout=logfile, stderr=logfile).wait()
16            try:
17                subprocess.Popen(shlex.split("sudo apt-get install -yq build-essential wget curl binutils make perl libx11-6 \
18                    libx11-dev zlib1g zlib1g-dev tcsh"), stdout=logfile, stderr=logfile).wait()
19            except:
20                try:
21                    subprocess.Popen(shlex.split("sudo apt-get install -yq binutils make perl libx11-6 libx11-dev zlib1g zlib1g-dev tcsh"),
22                                stdout=logfile, stderr=logfile).wait()
23                except:
24                    try:
25                        subprocess.Popen(shlex.split("sudo apt-get install -yq binutils make perl libx11 zlib tcsh glibc"),
26                                    stdout=logfile, stderr=logfile).wait()
27                    except:
28                        pass           
29        if "macOS" in ostype:
30            # print("[green]Installing XCode Command Line Tools...")
31            subprocess.Popen(shlex.split("sudo xcode-select --install"), stdout=logfile, stderr=logfile).wait()
32            
33            if not os.path.exists("/Applications/Utilities/XQuartz.app"):
34                xquartz = os.path.join(directory, mesaurls.url_xquartz.split('/')[-1])   
35
36                # print("[green]Installing XQuartz...")
37                subprocess.Popen(shlex.split(f"sudo installer -pkg {xquartz} -target /"), stdout=logfile, stderr=logfile).wait()
38                if cleanAfter:
39                    os.remove(xquartz)

Install the pre-requisites for MESA.

Arguments:
  • logfile (file): File to write the output of the installation to.