File tree Expand file tree Collapse file tree 6 files changed +35
-902
lines changed Expand file tree Collapse file tree 6 files changed +35
-902
lines changed Original file line number Diff line number Diff line change 1+ # Starts GSAS-II from clone of GitHub repo when contents is not
2+ # installed into current Python.
3+ #
4+ # This can be used when GSAS-II is installed, but why bother as the command:
5+ # python -c "from GSASII.GSASIIGUI import main; main()"
6+ # will do just as well.
7+ import os
8+ import sys
9+ import importlib
10+ try :
11+ pkginfo = importlib .util .find_spec ('GSASII.GSASIIGUI' )
12+ except ModuleNotFoundError :
13+ pkginfo = None
14+
15+ if pkginfo is None : # fixup path if GSASII not installed into Python
16+ os .environ ["GSASII_YOLO_PATH" ] = "True"
17+ #print('GSAS-II not installed in Python: Hacking sys.path')
18+ sys .path .insert (0 ,os .path .dirname (os .path .dirname (__file__ )))
19+
20+ from GSASII .GSASIIGUI import main
21+
22+ if __name__ == '__main__' :
23+ if pkginfo is None : # fixup path if GSASII not installed into Python
24+ print ('GSAS-II not installed in Python: Hacking sys.path' )
25+ main ()
Original file line number Diff line number Diff line change 2525import sys
2626import random as ran
2727import subprocess as subp
28+ import platform
29+ import shutil
2830
31+ import numpy as np
32+ import numpy.linalg as nl
33+ import numpy.ma as ma
2934import scipy.optimize as so
3035from . import GSASIIpath
3136from . import GSASIIlattice as G2lat
4954from . import GSASIIctrlGUI as G2G
5055from . import GSASIIfiles as G2fl
5156from . import GSASIIconstrGUI as G2cnstG
52- import numpy as np
53- import numpy.linalg as nl
54- import numpy.ma as ma
5557from . import atmdata
5658from . import ISODISTORT as ISO
57- import platform
58- from ._utils import _copy_file
5959
6060# XXX I suspect this is Unix-specific -- need porting help!
6161
@@ -6053,7 +6053,9 @@ def OnFileSel(event):
60536053 if os.path.exists(fName): # is there a file by this name in the current directory?
60546054 RMCPdict['files'][fil][0] = fName
60556055 else: # nope, copy it
6056- _copy_file(dlg.GetPath(), os.path.join(G2frame.LastGPXdir,fName))
6056+ # TODO: is G2frame.LastGPXdir the right choice here or
6057+ # do I want the current working directory (same?)
6058+ shutil.copy(dlg.GetPath(), os.path.join(G2frame.LastGPXdir,fName))
60576059 if not os.path.exists(fName): # sanity check
60586060 print(f'Error: file {fName} not found in .gpx directory ({G2frame.LastGPXdir})')
60596061 return
@@ -7948,7 +7950,6 @@ def Runfullrmc(event):
79487950 finally:
79497951 dlg.Destroy()
79507952 if result == wx.ID_YES:
7951- import shutil
79527953 shutil.rmtree(rmcname)
79537954 else:
79547955 return
Original file line number Diff line number Diff line change 1414import time
1515import math
1616import random as rand
17+ import shutil
1718import copy
1819import pickle as cPickle
1920import numpy as np
2728from . import GSASIImath as G2mth
2829from . import GSASIIstrMath as G2stMth
2930from . import GSASIIfiles as G2fil
30- from ._utils import _copy_file
3131
3232sind = lambda x : np .sin (x * np .pi / 180. )
3333cosd = lambda x : np .cos (x * np .pi / 180. )
@@ -632,7 +632,7 @@ def GPXBackup(GPXfile,makeBack=True):
632632 tries = 0
633633 while True :
634634 try :
635- _copy_file (GPXfile ,GPXback )
635+ shutil . copy (GPXfile ,GPXback )
636636 break
637637 except :
638638 tries += 1
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments