G2full_ARMmac.sh
                        
                             · 2.1 KiB · Bash
                        
                    
                    
                      
                        Eredeti
                      
                      
                        
                          
                        
                    
                    
                
                
            WORKSPACE=/tmp
condaHome=/tmp/conda311
[email protected]:AdvancedPhotonSource/GSAS-II-buildtools.git
gitCodeRepo=https://github.com/AdvancedPhotonSource/GSAS-II.git
pyver=3.11
numpyver=1.26
packages="python=$pyver wxpython numpy=$numpyver scipy matplotlib pyopengl conda anaconda-client git gitpython requests pillow h5py imageio scons cython seekpath"
env=testG2
miniforge=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
install=True
gitinstall=True
if [ "$install" = "True" ]; then
	rm -rf $condaHome
	if [ ! -e "/tmp/Miniforge-latest.sh" ]; then
		echo Downloading
		curl -L $miniforge -o /tmp/Miniforge-latest.sh
	else
		echo "skipping miniconda download"
	fi
	if [ ! -d "$condaHome" ]; then
		echo creating conda installation
		bash /tmp/Miniforge-latest.sh -b -p $condaHome
	else
		echo "skip miniconda install"
	fi
fi
echo source $condaHome/bin/activate
source $condaHome/bin/activate
if [ "$install" = "True" ]; then
	conda create -y -n $env $packages
fi
set +x
echo source $condaHome/bin/activate $env
source $condaHome/bin/activate $env
if [ "$gitinstall" = "True" ]; then
	set -x
	rm -rf $WORKSPACE/GSAS2-code
	mkdir $WORKSPACE/GSAS2-code
	git clone -b develop $gitCodeRepo $WORKSPACE/GSAS2-code --depth 50
fi
directory="$WORKSPACE/GSAS2-code/GSASII/bindist"
if [ ! -d "$directory" ]; then
	mkdir "$directory"
	echo "Directory $directory created."
else
	echo "Directory $directory already exists."
fi
download_binaries() {
	python3 - <<END
def download_binaries():
    import urllib.request
    import tarfile
    import os
    import sys
    ssl._create_default_https_context = ssl._create_unverified_context
    
    thetarfile = "https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.11_n1.26.tgz"
    
    os.chdir("${WORKSPACE}/GSAS2-code/GSASII/bindist")
    
    ftpstream = urllib.request.urlopen(thetarfile)
    thetarfile = tarfile.open(fileobj=ftpstream, mode="r|gz")
    thetarfile.extractall()
download_binaries()
END
}
download_binaries
python $WORKSPACE/GSAS2-code/GSASII/GSASII.py
exit
                | 1 | WORKSPACE=/tmp | 
| 2 | condaHome=/tmp/conda311 | 
| 3 | |
| 4 | gitInstallRepo=[email protected]:AdvancedPhotonSource/GSAS-II-buildtools.git | 
| 5 | gitCodeRepo=https://github.com/AdvancedPhotonSource/GSAS-II.git | 
| 6 | |
| 7 | pyver=3.11 | 
| 8 | numpyver=1.26 | 
| 9 | |
| 10 | packages="python=$pyver wxpython numpy=$numpyver scipy matplotlib pyopengl conda anaconda-client git gitpython requests pillow h5py imageio scons cython seekpath" | 
| 11 | |
| 12 | env=testG2 | 
| 13 | miniforge=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh | 
| 14 | |
| 15 | install=True | 
| 16 | gitinstall=True | 
| 17 | |
| 18 | if [ "$install" = "True" ]; then | 
| 19 | rm -rf $condaHome | 
| 20 | if [ ! -e "/tmp/Miniforge-latest.sh" ]; then | 
| 21 | echo Downloading | 
| 22 | curl -L $miniforge -o /tmp/Miniforge-latest.sh | 
| 23 | else | 
| 24 | echo "skipping miniconda download" | 
| 25 | fi | 
| 26 | if [ ! -d "$condaHome" ]; then | 
| 27 | echo creating conda installation | 
| 28 | bash /tmp/Miniforge-latest.sh -b -p $condaHome | 
| 29 | else | 
| 30 | echo "skip miniconda install" | 
| 31 | fi | 
| 32 | fi | 
| 33 | |
| 34 | echo source $condaHome/bin/activate | 
| 35 | source $condaHome/bin/activate | 
| 36 | |
| 37 | if [ "$install" = "True" ]; then | 
| 38 | conda create -y -n $env $packages | 
| 39 | fi | 
| 40 | |
| 41 | set +x | 
| 42 | echo source $condaHome/bin/activate $env | 
| 43 | source $condaHome/bin/activate $env | 
| 44 | |
| 45 | if [ "$gitinstall" = "True" ]; then | 
| 46 | set -x | 
| 47 | rm -rf $WORKSPACE/GSAS2-code | 
| 48 | mkdir $WORKSPACE/GSAS2-code | 
| 49 | git clone -b develop $gitCodeRepo $WORKSPACE/GSAS2-code --depth 50 | 
| 50 | fi | 
| 51 | |
| 52 | directory="$WORKSPACE/GSAS2-code/GSASII/bindist" | 
| 53 | |
| 54 | if [ ! -d "$directory" ]; then | 
| 55 | mkdir "$directory" | 
| 56 | echo "Directory $directory created." | 
| 57 | else | 
| 58 | echo "Directory $directory already exists." | 
| 59 | fi | 
| 60 | |
| 61 | download_binaries() { | 
| 62 | python3 - <<END | 
| 63 | def download_binaries(): | 
| 64 | import urllib.request | 
| 65 | import tarfile | 
| 66 | import os | 
| 67 | import sys | 
| 68 | |
| 69 | ssl._create_default_https_context = ssl._create_unverified_context | 
| 70 | |
| 71 | thetarfile = "https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.11_n1.26.tgz" | 
| 72 | |
| 73 | os.chdir("${WORKSPACE}/GSAS2-code/GSASII/bindist") | 
| 74 | |
| 75 | ftpstream = urllib.request.urlopen(thetarfile) | 
| 76 | thetarfile = tarfile.open(fileobj=ftpstream, mode="r|gz") | 
| 77 | thetarfile.extractall() | 
| 78 | |
| 79 | download_binaries() | 
| 80 | END | 
| 81 | } | 
| 82 | |
| 83 | download_binaries | 
| 84 | |
| 85 | python $WORKSPACE/GSAS2-code/GSASII/GSASII.py | 
| 86 | |
| 87 | exit |