最后活跃于 1712670276

G2full_ARMmac.sh 原始文件
1WORKSPACE=/tmp
2condaHome=/tmp/conda311
3
4gitInstallRepo=[email protected]:AdvancedPhotonSource/GSAS-II-buildtools.git
5gitCodeRepo=https://github.com/AdvancedPhotonSource/GSAS-II.git
6
7pyver=3.11
8numpyver=1.26
9
10packages="python=$pyver wxpython numpy=$numpyver scipy matplotlib pyopengl conda anaconda-client git gitpython requests pillow h5py imageio scons cython seekpath"
11
12env=testG2
13miniforge=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
14
15install=True
16gitinstall=True
17
18if [ "$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
32fi
33
34echo source $condaHome/bin/activate
35source $condaHome/bin/activate
36
37if [ "$install" = "True" ]; then
38 conda create -y -n $env $packages
39fi
40
41set +x
42echo source $condaHome/bin/activate $env
43source $condaHome/bin/activate $env
44
45if [ "$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
50fi
51
52directory="$WORKSPACE/GSAS2-code/GSASII/bindist"
53
54if [ ! -d "$directory" ]; then
55 mkdir "$directory"
56 echo "Directory $directory created."
57else
58 echo "Directory $directory already exists."
59fi
60
61download_binaries() {
62 python3 - <<END
63def 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
79download_binaries()
80END
81}
82
83download_binaries
84
85python $WORKSPACE/GSAS2-code/GSASII/GSASII.py
86
87exit