Changeset 5129
- Timestamp:
- Jan 8, 2022 10:41:19 AM (17 months ago)
- Files:
-
- 12 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpath.py
r5125 r5129 798 798 print(u'Unknown platform: '+sys.platform) 799 799 raise Exception('Unknown platform') 800 if 'a rm' in platform.machine() and platform.architecture()[0] == '64bit':801 bits = 'arm '800 if 'aarch' in platform.machine() and platform.architecture()[0] == '64bit': 801 bits = 'arm64' 802 802 elif 'arm' in platform.machine(): 803 803 bits = 'arm32' -
trunk/fsource/SConstruct
r5125 r5129 32 32 33 33 def GetBinaryDir(): 34 # format current platform, Python & numpy version 34 '''Format current platform, Python & numpy version; 35 note that this must match GSASIIpath.GetBinaryPrefix 36 ''' 35 37 if sys.platform == "win32": 36 38 prefix = 'win' … … 42 44 print(u'Unknown platform: '+sys.platform) 43 45 raise Exception('Unknown platform') 44 if 'a rm' in platform.machine() and platform.architecture()[0] == '64bit':45 bits = 'arm '46 if 'aarch' in platform.machine() and platform.architecture()[0] == '64bit': 47 bits = 'arm64' 46 48 elif 'arm' in platform.machine(): 47 49 bits = 'arm32' … … 168 170 (../AllBinaries/<X>_NN_pv.v_nv.v) rather than ../bin, where: 169 171 <X> is mac, win or linux; 170 NN is 64 or 32 ;172 NN is 64 or 32 for Intel; arm64 or arm32 for ARM (aarch or arm) 171 173 pv.v is the Python version (p2.7 or p3.6,...) and 172 174 nv.v is the Numpy version (n1.13,...). … … 242 244 print ('python not found') 243 245 sys.exit() 244 p = subprocess.Popen(pythonprogram, stdout=subprocess.PIPE, stdin=subprocess.PIPE )246 p = subprocess.Popen(pythonprogram, stdout=subprocess.PIPE, stdin=subprocess.PIPE, encoding='utf-8') 245 247 p.stdin.write(""" 246 248 import sys,platform; … … 261 263 elif 'arm' in platform.machine() and '32' in platform.architecture()[0]: 262 264 PlatformBits = 'arm32' 263 elif 'a rm' in platform.machine():264 PlatformBits = 'arm '265 elif 'aarch' in platform.machine(): 266 PlatformBits = 'arm64' 265 267 elif '32' in platform.architecture()[0]: 266 268 PlatformBits = '32bits' … … 278 280 if FORTpath == "": FORTpath = GFORTpath 279 281 if sys.platform.startswith("linux") and "64" in PlatformBits: 280 if FORTflags == "": FORTflags = ' -w -O2 -fPIC -m64' 281 if F2PYflags == "": F2PYflags = '--fcompiler=gnu95 --f77exec=gfortran --f77flags="-fno-range-check -m64"' # --arch="-arch x86_64"' 282 if 'aarch' in platform.machine(): 283 if FORTflags == "": FORTflags = ' -w -O2 -fPIC' 284 if F2PYflags == "": F2PYflags = '--fcompiler=gnu95 --f77exec=gfortran --f77flags="-fno-range-check"' 285 else: 286 if FORTflags == "": FORTflags = ' -w -O2 -fPIC -m64' 287 if F2PYflags == "": F2PYflags = '--fcompiler=gnu95 --f77exec=gfortran --f77flags="-fno-range-check -m64"' # --arch="-arch x86_64"' 282 288 elif sys.platform.startswith("linux") and 'arm' in platform.machine(): 283 289 if FORTflags == "": FORTflags = ' -w -O2 -fPIC' … … 417 423 #print (env.Dump()) 418 424 if 'help' in COMMAND_LINE_TARGETS: sys.exit() 425 import datetime 419 426 if not os.path.exists(InstallLoc) and not GetOption('no_exec'): 420 import datetime421 427 print('Creating '+InstallLoc) 422 428 os.makedirs(InstallLoc) -
trunk/makeLinux.py
r4736 r5129 4 4 =================================== 5 5 6 This script creates a menu entry for Gnome & KDE desktop managers7 and puts it in a place where it can be "indexed." 6 This script creates a menu entry and dektop shortcut for Gnome 7 (and perhaps KDE) desktop managers. Recent testing on Raspbian. 8 8 9 9 This is a work in progress as I learn more about shortcuts in Linux. … … 22 22 Type=Application 23 23 Terminal=false 24 Exec= xterm -hold -ebash -c "{} {}"24 Exec={} bash -c "{} {}" 25 25 Name=GSAS-II 26 26 Icon={} … … 54 54 print("\nScript "+script+" does not have extension .py") 55 55 Usage() 56 loc = os.path.expanduser('~/Desktop/') 57 if "XDG_DATA_HOME" in os.environ and os.path.exists(os.path.join(os.environ.get("XDG_DATA_HOME"),"applications")): 58 loc = os.path.join(os.environ.get("XDG_DATA_HOME"),"applications") 59 elif "HOME" in os.environ and os.path.exists(os.path.join(os.environ.get("HOME"),".local/share/applications")): 60 loc = os.path.join(os.environ.get("HOME"),".local/share/applications") 61 elif not os.path.exists(loc): 62 loc = os.path.expanduser('~/') 63 dfile = os.path.join(loc,'GSASII.desktop') 56 mfile = None # menu file 57 if "XDG_DATA_HOME" in os.environ and os.path.exists( 58 os.path.join(os.environ.get("XDG_DATA_HOME"),"applications")): 59 mfile = os.path.join(os.environ.get("XDG_DATA_HOME"),"applications", 60 'GSASII.desktop') 61 elif "HOME" in os.environ and os.path.exists( 62 os.path.join(os.environ.get("HOME"),".local/share/applications")): 63 mfile = os.path.join(os.environ.get("HOME"),".local/share/applications", 64 'GSASII.desktop') 65 dfile = None # desktop file 66 if os.path.exists(os.path.expanduser('~/Desktop/')): 67 dfile = os.path.join(os.path.expanduser('~/Desktop'),'GSASII.desktop') 64 68 os.chmod(script, # make the .py file executable and readable 65 69 stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH) 66 try: 67 open(dfile,'w').write(desktop_template.format(sys.executable,script,icon)) 68 os.chmod( 69 dfile, 70 stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH) 71 print("created GNOME/KDE desktop shortcut "+dfile) 72 except: 73 print("creation of file failed: "+dfile) 70 import shutil 71 for term in ("lxterminal", "gnome-terminal", "xterm"): 72 try: 73 found = shutil.which(term) 74 except AttributeError: 75 print(' shutil.which() failed (Python 2.7?); assuming',term) 76 found = True 77 if not found: continue 78 if term == "gnome-terminal": 79 terminal = 'gnome-terminal -t "GSAS-II console" --' 80 script += "; echo Press Enter to close window; read line" 81 break 82 elif term == "lxterminal": 83 terminal = 'lxterminal -t "GSAS-II console" -e' 84 script += "; echo Press Enter to close window; read line" 85 break 86 elif term == "xterm": 87 terminal = 'xterm -title "GSAS-II console" -hold -e' 88 break 89 else: 90 print("unknown terminal",term) 91 sys.exit() 92 else: 93 print("No terminal found -- no shortcuts created") 94 sys.exit() 95 for f,t in zip((dfile,mfile),('Desktop','Menu')): 96 if f is None: continue 97 try: 98 open(f,'w').write(desktop_template.format( 99 terminal, 100 sys.executable,script,icon)) 101 os.chmod( 102 dfile, 103 stat.S_IWUSR | stat.S_IXUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IXOTH) 104 print("Created {} shortcut calling {} as file\n\t{}".format( 105 t,term,f)) 106 except Exception as msg: 107 print("creation of file failed: "+f) 108 print(msg)
Note: See TracChangeset
for help on using the changeset viewer.