yuanpeng revisó este gist . Ir a la revisión
1 file changed, 87 insertions
G2full_ARMmac.sh(archivo creado)
@@ -0,0 +1,87 @@ | |||
1 | + | WORKSPACE=/tmp | |
2 | + | condaHome=/tmp/conda311 | |
3 | + | ||
4 | + | [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 |
Siguiente
Anterior