Skip to content

Commit 491fc85

Browse files
committed
fix package install code; importer cleanups
1 parent 1003b0a commit 491fc85

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

GSASII/GSASIIctrlGUI.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10458,25 +10458,34 @@ def SelectPkgInstall(event):
1045810458
if sel is None: return
1045910459
if not any(sel): return
1046010460
pkgs = [choices[i][0] for i,f in enumerate(sel) if f]
10461+
wx.BeginBusyCursor()
10462+
pdlg = wx.ProgressDialog('Updating','Installing Python packages; this can take a while',
10463+
parent=G2frame)
1046110464
if GSASIIpath.condaTest():
1046210465
patch_condarc()
1046310466
if not GSASIIpath.condaTest(True):
1046410467
GSASIIpath.addCondaPkg()
1046510468
err = GSASIIpath.condaInstall(pkgs)
1046610469
if err:
1046710470
print(f'Error from conda: {err}')
10471+
wx.EndBusyCursor()
10472+
pdlg.Destroy()
1046810473
return
1046910474
else:
1047010475
err = GSASIIpath.pipInstall(pkgs)
1047110476
if err:
1047210477
print(f'Error from pip: {err}')
10478+
wx.EndBusyCursor()
10479+
pdlg.Destroy()
1047310480
return
10481+
wx.EndBusyCursor()
10482+
pdlg.Destroy()
1047410483
msg = '''You must restart GSAS-II to access the importer(s)
10475-
requiring the installed package(s).
10484+
requiring the package(s) just installed.
1047610485
10477-
Select "Yes" to save, "No" to skip the save, or "Cancel"
10478-
to discontinue the restart process and continue GSAS-II
10479-
without the importer(s).
10486+
Select "Yes" to save and restart, "No" to restart without
10487+
the save, or "Cancel" to discontinue the restart process
10488+
and continue use of GSAS-II without the importer(s).
1048010489
1048110490
If "Yes", GSAS-II will reopen the project after the update.
1048210491
'''

GSASII/GSASIIpath.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2265,9 +2265,14 @@ def condaInstall(packageList):
22652265
'\nConsider using the "conda install conda" command')
22662266
return None
22672267
try:
2268+
print(f'preparing to install {packageList}'+
2269+
'\nThis can take a while')
2270+
# the next line works, but the subsequent cli is considered more stable
2271+
#conda.cli.main('install', '-y', *packageList)
2272+
# this is considered to be supported in the long term
22682273
(out, err, rc) = conda.cli.python_api.run_command(
22692274
conda.cli.python_api.Commands.INSTALL,packageList,
2270-
search_path=('conda-forge'),
2275+
# search_path=('conda-forge'), # broken!
22712276
# use_exception_handler=True#, stdout=sys.stdout,
22722277
stderr=sys.stderr)
22732278
#print('rc=',rc)

GSASII/imports/G2pwd_BrukerBRML.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
try:
99
import xmltodict as xml
1010
except Exception as msg:
11-
if GSASIIpath.GetConfigValue('debug'): print(f'Debug: xmltodict error = {msg}')
11+
#if GSASIIpath.GetConfigValue('debug'): print(f'Debug: xmltodict error = {msg}')
1212
xml = None
1313
import GSASIIobj as G2obj
1414
import GSASIIfiles as G2fil

GSASII/imports/G2pwd_MIDAS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def ContentsValidator(self, filename):
5858
'''
5959
fp = None
6060
try:
61-
fp = zarr.open(filename, 'r')
61+
fp = zarr.open(filename, mode='r')
6262
if all([(i in fp) for i in self.midassections]): # are expected MIDAS sections present?
6363
self.mode = 'midas'
6464
return True # must be present for Midas output

0 commit comments

Comments
 (0)