Changeset 5129


Ignore:
Timestamp:
Jan 8, 2022 10:41:19 AM (21 months ago)
Author:
toby
Message:

Raspbian-64 (bullseye) build & fixes

Files:
12 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpath.py

    r5125 r5129  
    798798        print(u'Unknown platform: '+sys.platform)
    799799        raise Exception('Unknown platform')
    800     if 'arm' 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'
    802802    elif 'arm' in platform.machine():
    803803        bits = 'arm32'
  • trunk/fsource/SConstruct

    r5125 r5129  
    3232
    3333def GetBinaryDir():
    34     # format current platform, Python & numpy version
     34    '''Format current platform, Python & numpy version;
     35    note that this must match GSASIIpath.GetBinaryPrefix
     36    '''
    3537    if sys.platform == "win32":
    3638        prefix = 'win'
     
    4244        print(u'Unknown platform: '+sys.platform)
    4345        raise Exception('Unknown platform')
    44     if 'arm' 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'
    4648    elif 'arm' in platform.machine():
    4749        bits = 'arm32'
     
    168170   (../AllBinaries/<X>_NN_pv.v_nv.v) rather than ../bin, where:
    169171     <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)
    171173     pv.v is the Python version (p2.7 or p3.6,...) and
    172174     nv.v is the Numpy version (n1.13,...).
     
    242244    print ('python not found')
    243245    sys.exit()
    244 p = subprocess.Popen(pythonprogram, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
     246p = subprocess.Popen(pythonprogram, stdout=subprocess.PIPE, stdin=subprocess.PIPE, encoding='utf-8')
    245247p.stdin.write("""
    246248import sys,platform;
     
    261263elif 'arm' in platform.machine() and '32' in platform.architecture()[0]:
    262264   PlatformBits = 'arm32'
    263 elif 'arm' in platform.machine():
    264    PlatformBits = 'arm'
     265elif 'aarch' in platform.machine():
     266   PlatformBits = 'arm64'
    265267elif '32' in platform.architecture()[0]:
    266268   PlatformBits = '32bits'
     
    278280    if FORTpath == "": FORTpath = GFORTpath
    279281    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"'
    282288    elif sys.platform.startswith("linux") and 'arm' in platform.machine():
    283289        if FORTflags == "": FORTflags = ' -w -O2 -fPIC'
     
    417423#print (env.Dump())
    418424if 'help' in COMMAND_LINE_TARGETS: sys.exit()
     425import datetime
    419426if not os.path.exists(InstallLoc) and not GetOption('no_exec'):
    420     import datetime
    421427    print('Creating '+InstallLoc)
    422428    os.makedirs(InstallLoc)
  • trunk/makeLinux.py

    r4736 r5129  
    44===================================
    55
    6 This script creates a menu entry for Gnome & KDE desktop managers
    7 and puts it in a place where it can be "indexed."
     6This script creates a menu entry and dektop shortcut for Gnome
     7(and perhaps KDE) desktop managers. Recent testing on Raspbian.
    88
    99This is a work in progress as I learn more about shortcuts in Linux.
     
    2222Type=Application
    2323Terminal=false
    24 Exec=xterm -hold -e bash -c "{} {}"
     24Exec={} bash -c "{} {}"
    2525Name=GSAS-II
    2626Icon={}
     
    5454        print("\nScript "+script+" does not have extension .py")
    5555        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')
    6468    os.chmod(script, # make the .py file executable and readable
    6569             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.