Skip to content

Commit c982af9

Browse files
authored
Merge pull request #40 from kif/meson
Use meson-python to package GSAS-II and prototype pixi to manage development environment
2 parents e8f22c1 + e6b23fc commit c982af9

File tree

157 files changed

+23928
-7629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+23928
-7629
lines changed

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@ __pycache__
2929
GSASII/bindist
3030

3131
# Local dev env files
32-
.vscode
32+
.vscode
33+
34+
35+
dist
36+
build
37+
38+
#
39+
*.gpx
40+
*.lst
41+
42+
*~

GSASII/Absorb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
import numpy as np
1414
import sys
1515
import matplotlib as mpl
16-
import GSASIIpath
17-
import GSASIIElem as G2elem
18-
import GSASIIElemGUI as G2elemGUI
19-
import GSASIIctrlGUI as G2G
16+
from . import GSASIIpath
17+
from . import GSASIIElem as G2elem
18+
from . import GSASIIElemGUI as G2elemGUI
19+
from . import GSASIIctrlGUI as G2G
2020

2121
try:
2222
wx.NewIdRef

GSASII/CifFile/meson.build

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
py.install_sources([
2+
'CifFile.py',
3+
'StarFile.py',
4+
'TypeContentsParser.py',
5+
'YappsStarParser_1_0.py',
6+
'YappsStarParser_1_1.py',
7+
'YappsStarParser_2_0.py',
8+
'YappsStarParser_STAR2.py',
9+
'__init__.py',
10+
'parsetab.py',
11+
'yapps3_compiled_rt.py'
12+
],
13+
pure: false, # Will be installed next to binaries
14+
subdir: 'GSASII/CifFile' # Folder relative to site-packages to install to
15+
)

GSASII/G2compare.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
pass
3333
import scipy as sp
3434

35-
import GSASIIpath
36-
import GSASIIfiles as G2fil
37-
import GSASIIplot as G2plt
38-
import GSASIIdataGUI as G2gd
39-
import GSASIIctrlGUI as G2G
40-
import GSASIIobj as G2obj
35+
from . import GSASIIpath
36+
from . import GSASIIfiles as G2fil
37+
from . import GSASIIplot as G2plt
38+
from . import GSASIIdataGUI as G2gd
39+
from . import GSASIIctrlGUI as G2G
40+
from . import GSASIIobj as G2obj
4141

4242
__version__ = '0.0.1'
4343

GSASII/GSASII.py

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,61 @@
22
# -*- coding: utf-8 -*-
33
#GSASII
44
'''
5-
A single class, :class:`G2App`, is defined here to create
6-
an wxPython application. This is only used on
7-
MacOS. For other platforms ``wx.App()`` is called directly.
5+
A single class, :class:`G2App`, is defined here to create
6+
an wxPython application. This is only used on
7+
MacOS. For other platforms ``wx.App()`` is called directly.
88
'''
99

1010
import sys
11-
#import platform
12-
import scipy.optimize # loading here addresses problem with build for wx on Pi
11+
12+
from . import GSASIIpath
13+
14+
__version__ = '2.0.0'
1315
try:
16+
from . import git_verinfo
17+
__version__ = git_verinfo.git_tags[0]
18+
except ImportError:
19+
pass
20+
21+
22+
def main():
23+
import scipy.optimize # loading here addresses problem with build for wx on Pi
1424
import wx
1525
# the next line removes the need for pythonw. Thanks to Matt Newville!
1626
# appears unneeded from wx 4.2.1 on
17-
if sys.platform.lower() == 'darwin': wx.PyApp.IsDisplayAvailable = lambda _: True
18-
# importing the following wx modules at the same time as wx seems to eliminate
19-
# the "Debug: Adding duplicate image handler for 'Windows bitmap file'"
20-
# error message
27+
if sys.platform.lower() == 'darwin':
28+
wx.PyApp.IsDisplayAvailable = lambda _: True
29+
# importing the following wx modules at the same time as wx seems to
30+
# eliminate the "Debug: Adding duplicate image handler for 'Windows bitmap
31+
# file'" error message
2132
import wx.grid as wg
2233
import wx.aui
2334
import wx.lib.scrolledpanel as wxscroll
2435
import wx.lib.mixins.listctrl as listmix
2536
import wx.richtext as wxrt
2637
import wx.lib.filebrowsebutton as wxfilebrowse
2738
wg,wx.aui,wxscroll,listmix,wxrt,wxfilebrowse,scipy.optimize # avoid unused warning
28-
except ImportError:
29-
pass
30-
import GSASIIpath
3139

32-
__version__ = '2.0.0'
33-
try:
34-
import git_verinfo
35-
__version__ = git_verinfo.git_tags[0]
36-
except:
37-
pass
38-
39-
class G2App(wx.App):
40-
'''Used to create a wx python application for the GUI for Mac.
41-
Customized to implement drop of GPX files onto app.
42-
'''
43-
startupMode = True
44-
def ClearStartup(self):
45-
'''Call this after app startup complete because a Drop event is posted
46-
when GSAS-II is initially started.
47-
'''
48-
self.startupMode = False
49-
def MacOpenFiles(self, filenames):
50-
if self.startupMode:
51-
return
52-
import GSASIIfiles
53-
for project in filenames:
54-
#print("Start GSAS-II with project file "+str(project))
55-
#GSASIIpath.MacStartGSASII(__file__,project)
56-
GSASIIfiles.openInNewTerm(project)
40+
if sys.platform == "darwin":
41+
class G2App(wx.App):
42+
'''Used to create a wx python application for the GUI for Mac.
43+
Customized to implement drop of GPX files onto app.
44+
'''
45+
startupMode = True
46+
def ClearStartup(self):
47+
'''Call this after app startup complete because a Drop event is posted
48+
when GSAS-II is initially started.
49+
'''
50+
self.startupMode = False
51+
def MacOpenFiles(self, filenames):
52+
if self.startupMode:
53+
return
54+
from . import GSASIIfiles
55+
for project in filenames:
56+
#print("Start GSAS-II with project file "+str(project))
57+
#GSASIIpath.MacStartGSASII(__file__,project)
58+
GSASIIfiles.openInNewTerm(project)
5759

58-
if __name__ == '__main__':
59-
if sys.platform == "darwin":
6060
application = G2App(0) # create the GUI framework
6161
else:
6262
application = wx.App(0) # create the GUI framework
@@ -71,10 +71,10 @@ def MacOpenFiles(self, filenames):
7171
sys.exit()
7272
# print('Unable to run with current setup, do you want to update to the')
7373
# try:
74-
# if '2' in platform.python_version_tuple()[0]:
74+
# if '2' in platform.python_version_tuple()[0]:
7575
# ans = raw_input("latest GSAS-II version? Update ([Yes]/no): ")
7676
# else:
77-
# ans = input("latest GSAS-II version? Update ([Yes]/no): ")
77+
# ans = input("latest GSAS-II version? Update ([Yes]/no): ")
7878
# except:
7979
# ans = 'no'
8080
# if ans.strip().lower() == "no":
@@ -89,9 +89,12 @@ def MacOpenFiles(self, filenames):
8989
# elif GSASIIpath.HowIsG2Installed().startswith('svn'):
9090
# svnCheckUpdates(None)
9191
# else:
92-
import GSASIIdataGUI as G2gd
92+
from . import GSASIIdataGUI as G2gd
9393
G2gd.GSASIImain(application) # start the GUI
94-
if sys.platform == "darwin":
94+
if sys.platform == "darwin":
9595
wx.CallLater(50,application.ClearStartup)
9696
GSASIIpath.InvokeDebugOpts()
9797
application.MainLoop()
98+
99+
if __name__ == '__main__':
100+
main()

0 commit comments

Comments
 (0)