Changeset 4213 for trunk


Ignore:
Timestamp:
Dec 19, 2019 11:04:03 PM (3 years ago)
Author:
toby
Message:

multiple small changes to allow docs build under 3.x

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r4201 r4213  
    168168    VERY_LIGHT_GREY = wx.Colour(235,235,235)
    169169    WACV = wx.ALIGN_CENTER_VERTICAL
    170 except:
    171     # Don't depend on GUI
    172     pass
     170    wxaui_NB_TOPSCROLL = wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_SCROLL_BUTTONS
     171except:     # Don't depend on GUI
     172    wxaui_NB_TOPSCROLL = None
    173173
    174174try:
     
    41344134    '''Notebook used in various locations; implemented with wx.aui extension
    41354135    '''
    4136     def __init__(self, parent, name='',size = None,style=wx.aui.AUI_NB_TOP |
    4137         wx.aui.AUI_NB_SCROLL_BUTTONS):
     4136    def __init__(self, parent, name='',size = None,style=wxaui_NB_TOPSCROLL):
    41384137        wx.aui.AuiNotebook.__init__(self, parent, style=style)
    41394138        if size: self.SetSize(size)
  • trunk/GSASIIdataGUI.py

    r4201 r4213  
    49334933    where the functions to be called are defined.
    49344934
    4935     Use of the dataWindow scrolled panel
    4936     ====================================
     4935    Use of the dataWindow scrolled panel:
    49374936   
    49384937    dataWindow has a “master” vertical BoxSizer: find it with
     
    49724971    that are called repeatedly to update the entire contents of dataWindow
    49734972    themselves, it is important to add calls to
     4973
    49744974        G2frame.dataWindow.ClearData()
     4975
    49754976    and
     4977
    49764978         G2frame.dataWindow.SetDataSize()
     4979
    49774980    at the beginning and end respectively to clear and refresh. This is not
    49784981    needed for GSNoteBook repaints, which seem to be working mostly
    49794982    automatically. If there is a problem, a call like
     4983
    49804984         wx.CallAfter(G2frame.phaseDisplay.SendSizeEvent)
     4985
    49814986    might be needed. There are some calls to G2frame.dataWindow.SendSizeEvent()
    49824987    that may be doing the same thing.
  • trunk/GSASIIindex.py

    r4028 r4213  
    4545npatand = lambda x: 180.*np.arctan(x)/np.pi
    4646npatan2d = lambda y,x: 180.*np.arctan2(y,x)/np.pi
    47 rpd = np.pi/180.
     47try:  # fails on doc build
     48    rpd = np.pi/180.
     49except TypeError:
     50    pass
    4851   
    4952def scaleAbyV(A,V):
  • trunk/GSASIIlattice.py

    r4195 r4213  
    5151acosd = lambda x: 180.*np.arccos(x)/np.pi
    5252rdsq2d = lambda x,p: round(1.0/np.sqrt(x),p)
    53 rpd = np.pi/180.
    54 RSQ2PI = 1./np.sqrt(2.*np.pi)
    55 SQ2 = np.sqrt(2.)
    56 RSQPI = 1./np.sqrt(np.pi)
    57 R2pisq = 1./(2.*np.pi**2)
     53try:  # fails on doc build
     54    rpd = np.pi/180.
     55    RSQ2PI = 1./np.sqrt(2.*np.pi)
     56    SQ2 = np.sqrt(2.)
     57    RSQPI = 1./np.sqrt(np.pi)
     58    R2pisq = 1./(2.*np.pi**2)
     59except TypeError:
     60    pass
    5861nxs = np.newaxis
    5962
  • trunk/GSASIImath.py

    r4185 r4213  
    4444atand = lambda x: 180.*np.arctan(x)/np.pi
    4545atan2d = lambda y,x: 180.*np.arctan2(y,x)/np.pi
    46 twopi = 2.0*np.pi
    47 twopisq = 2.0*np.pi**2
     46try:  # fails on doc build
     47    twopi = 2.0*np.pi
     48    twopisq = 2.0*np.pi**2
     49    _double_min = np.finfo(float).min
     50    _double_max = np.finfo(float).max
     51except TypeError:
     52    pass
    4853nxs = np.newaxis
    4954   
     
    41074112#__all__ = ['anneal']
    41084113
    4109 _double_min = numpy.finfo(float).min
    4110 _double_max = numpy.finfo(float).max
    41114114class base_schedule(object):
    41124115    def __init__(self):
  • trunk/GSASIIpath.py

    r4155 r4213  
    859859    try:
    860860        inpver = intver(np.__version__)
    861     except AttributeError: # happens on building docs
     861    except (AttributeError,TypeError): # happens on building docs
    862862        return
    863863    binpath = None
  • trunk/GSASIIplot.py

    r4196 r4213  
    145145import GSASIIctrlGUI as G2G
    146146import GSASIIobj as G2obj
    147 import pytexture as ptx
     147try:
     148    import pytexture as ptx
     149except ImportError:
     150    print('binary load error: pytexture not found')
    148151#from  OpenGL.GL import *
    149152import OpenGL.GL as GL
     
    182185npatand = lambda x: 180.*np.arctan(x)/np.pi
    183186npatan2d = lambda x,y: 180.*np.arctan2(x,y)/np.pi
    184 sq8ln2 = np.sqrt(8.0*np.log(2.0))
     187try:  # fails on doc build
     188    sq8ln2 = np.sqrt(8.0*np.log(2.0))
     189except TypeError:
     190    pass
    185191if '2' in platform.python_version_tuple()[0]:
    186192    GkDelta = unichr(0x0394)
  • trunk/GSASIIspc.py

    r4175 r4213  
    2929npcosd = lambda x: np.cos(x*np.pi/180.)
    3030nxs = np.newaxis
    31 twopi = 2.0*np.pi
    3231DEBUG = False
    3332   
     
    22612260    Mag = np.array([nl.det(opm) for opm in OpM])*Spn
    22622261    DHKL = np.reshape(np.inner(HKL,OpM),(-1,3))
    2263     PHKL = np.reshape(np.cos(twopi*np.inner(HKL,OpT))*Mag,(-1,))[:,nxs,nxs]*OpM     #compute T(R,theta) eq(7)
     2262    PHKL = np.reshape(np.cos(2.0*np.pi*np.inner(HKL,OpT))*Mag,(-1,))[:,nxs,nxs]*OpM     #compute T(R,theta) eq(7)
    22642263    Ftest = np.random.rand(3)       #random magnetic moment
    22652264    Psum = np.zeros(3)
  • trunk/GSASIIstrMath.py

    r4185 r4213  
    3838atan2d = lambda y,x: 180.*np.arctan2(y,x)/np.pi
    3939   
    40 ateln2 = 8.0*np.log(2.0)
    41 twopi = 2.0*np.pi
    42 twopisq = 2.0*np.pi**2
     40try:  # fails on doc build
     41    ateln2 = 8.0*np.log(2.0)
     42    twopi = 2.0*np.pi
     43    twopisq = 2.0*np.pi**2
     44except TypeError:
     45    pass
    4346nxs = np.newaxis
    4447
  • trunk/docs/Makefile

    r2027 r4213  
    1 # Makefile for Sphinx documentation
     1# Minimal makefile for Sphinx documentation
    22#
    33
    4 # You can set these variables from the command line.
    5 SPHINXOPTS    =
    6 SPHINXBUILD   = sphinx-build
    7 PAPER         =
     4# You can set these variables from the command line, and also
     5# from the environment for the first two.
     6SPHINXOPTS    ?=
     7SPHINXBUILD   ?= sphinx-build
     8SOURCEDIR     = source
    89BUILDDIR      = build
    910
    10 # Internal variables.
    11 PAPEROPT_a4     = -D latex_paper_size=a4
    12 PAPEROPT_letter = -D latex_paper_size=letter
    13 ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
    14 # the i18n builder cannot share the environment and doctrees with the others
    15 I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
     11# Put it first so that "make" without argument is like "make help".
     12help:
     13        @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
    1614
    17 .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
     15.PHONY: help Makefile
    1816
    19 help:
    20         @echo "Please use \`make <target>' where <target> is one of"
    21         @echo "  html       to make standalone HTML files"
    22         @echo "  dirhtml    to make HTML files named index.html in directories"
    23         @echo "  singlehtml to make a single large HTML file"
    24         @echo "  pickle     to make pickle files"
    25         @echo "  json       to make JSON files"
    26         @echo "  htmlhelp   to make HTML files and a HTML help project"
    27         @echo "  qthelp     to make HTML files and a qthelp project"
    28         @echo "  devhelp    to make HTML files and a Devhelp project"
    29         @echo "  epub       to make an epub"
    30         @echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
    31         @echo "  latexpdf   to make LaTeX files and run them through pdflatex"
    32         @echo "  text       to make text files"
    33         @echo "  man        to make manual pages"
    34         @echo "  texinfo    to make Texinfo files"
    35         @echo "  info       to make Texinfo files and run them through makeinfo"
    36         @echo "  gettext    to make PO message catalogs"
    37         @echo "  changes    to make an overview of all changed/added/deprecated items"
    38         @echo "  linkcheck  to check all external links for integrity"
    39         @echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
    40 
    41 clean:
    42         #-rm -rf $(BUILDDIR)/*
    43         rm $(BUILDDIR)/doctrees/* $(BUILDDIR)/html/*.html $(BUILDDIR)/html/*.js $(BUILDDIR)/html/*/*.html
    44 
    45 html:
    46         $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
    47         @echo
    48         @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
    49 
    50 dirhtml:
    51         $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
    52         @echo
    53         @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
    54 
    55 singlehtml:
    56         $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
    57         @echo
    58         @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
    59 
    60 pickle:
    61         $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
    62         @echo
    63         @echo "Build finished; now you can process the pickle files."
    64 
    65 json:
    66         $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
    67         @echo
    68         @echo "Build finished; now you can process the JSON files."
    69 
    70 htmlhelp:
    71         $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
    72         @echo
    73         @echo "Build finished; now you can run HTML Help Workshop with the" \
    74               ".hhp project file in $(BUILDDIR)/htmlhelp."
    75 
    76 qthelp:
    77         $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
    78         @echo
    79         @echo "Build finished; now you can run "qcollectiongenerator" with the" \
    80               ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
    81         @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/EPICSPythonSPECmotor.qhcp"
    82         @echo "To view the help file:"
    83         @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/EPICSPythonSPECmotor.qhc"
    84 
    85 devhelp:
    86         $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
    87         @echo
    88         @echo "Build finished."
    89         @echo "To view the help file:"
    90         @echo "# mkdir -p $$HOME/.local/share/devhelp/EPICSPythonSPECmotor"
    91         @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/EPICSPythonSPECmotor"
    92         @echo "# devhelp"
    93 
    94 epub:
    95         $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
    96         @echo
    97         @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
    98 
    99 latex:
    100         $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
    101         @echo
    102         @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
    103         @echo "Run \`make' in that directory to run these through (pdf)latex" \
    104               "(use \`make latexpdf' here to do that automatically)."
    105 
    106 latexpdf:
    107         $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
    108         @echo "Running LaTeX files through pdflatex..."
    109         $(MAKE) -C $(BUILDDIR)/latex all-pdf
    110         @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
    111 
    112 text:
    113         $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
    114         @echo
    115         @echo "Build finished. The text files are in $(BUILDDIR)/text."
    116 
    117 man:
    118         $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
    119         @echo
    120         @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
    121 
    122 texinfo:
    123         $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
    124         @echo
    125         @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
    126         @echo "Run \`make' in that directory to run these through makeinfo" \
    127               "(use \`make info' here to do that automatically)."
    128 
    129 info:
    130         $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
    131         @echo "Running Texinfo files through makeinfo..."
    132         make -C $(BUILDDIR)/texinfo info
    133         @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
    134 
    135 gettext:
    136         $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
    137         @echo
    138         @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
    139 
    140 changes:
    141         $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
    142         @echo
    143         @echo "The overview file is in $(BUILDDIR)/changes."
    144 
    145 linkcheck:
    146         $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
    147         @echo
    148         @echo "Link check complete; look for any errors in the above output " \
    149               "or in $(BUILDDIR)/linkcheck/output.txt."
    150 
    151 doctest:
    152         $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
    153         @echo "Testing of doctests in the sources finished, look at the " \
    154               "results in $(BUILDDIR)/doctest/output.txt."
     17# Catch-all target: route all unknown targets to Sphinx using the new
     18# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
     19%: Makefile
     20        @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
  • trunk/docs/make.bat

    r2027 r4213  
    11@ECHO OFF
     2
     3pushd %~dp0
    24
    35REM Command file for Sphinx documentation
     
    68        set SPHINXBUILD=sphinx-build
    79)
     10set SOURCEDIR=source
    811set BUILDDIR=build
    9 set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
    10 if NOT "%PAPER%" == "" (
    11         set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
    12 )
    1312
    1413if "%1" == "" goto help
    1514
    16 if "%1" == "help" (
    17         :help
    18         echo.Please use `make ^<target^>` where ^<target^> is one of
    19         echo.  html       to make standalone HTML files
    20         echo.  dirhtml    to make HTML files named index.html in directories
    21         echo.  singlehtml to make a single large HTML file
    22         echo.  pickle     to make pickle files
    23         echo.  json       to make JSON files
    24         echo.  htmlhelp   to make HTML files and a HTML help project
    25         echo.  qthelp     to make HTML files and a qthelp project
    26         echo.  devhelp    to make HTML files and a Devhelp project
    27         echo.  epub       to make an epub
    28         echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
    29         echo.  text       to make text files
    30         echo.  man        to make manual pages
    31         echo.  changes    to make an overview over all changed/added/deprecated items
    32         echo.  linkcheck  to check all external links for integrity
    33         echo.  doctest    to run all doctests embedded in the documentation if enabled
    34         goto end
     15%SPHINXBUILD% >NUL 2>NUL
     16if errorlevel 9009 (
     17        echo.
     18        echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
     19        echo.installed, then set the SPHINXBUILD environment variable to point
     20        echo.to the full path of the 'sphinx-build' executable. Alternatively you
     21        echo.may add the Sphinx directory to PATH.
     22        echo.
     23        echo.If you don't have Sphinx installed, grab it from
     24        echo.http://sphinx-doc.org/
     25        exit /b 1
    3526)
    3627
    37 if "%1" == "clean" (
    38         for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
    39         del /q /s %BUILDDIR%\*
    40         goto end
    41 )
     28%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
     29goto end
    4230
    43 if "%1" == "html" (
    44         %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
    45         echo.
    46         echo.Build finished. The HTML pages are in %BUILDDIR%/html.
    47         goto end
    48 )
    49 
    50 if "%1" == "dirhtml" (
    51         %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
    52         echo.
    53         echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
    54         goto end
    55 )
    56 
    57 if "%1" == "singlehtml" (
    58         %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
    59         echo.
    60         echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
    61         goto end
    62 )
    63 
    64 if "%1" == "pickle" (
    65         %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
    66         echo.
    67         echo.Build finished; now you can process the pickle files.
    68         goto end
    69 )
    70 
    71 if "%1" == "json" (
    72         %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
    73         echo.
    74         echo.Build finished; now you can process the JSON files.
    75         goto end
    76 )
    77 
    78 if "%1" == "htmlhelp" (
    79         %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
    80         echo.
    81         echo.Build finished; now you can run HTML Help Workshop with the ^
    82 .hhp project file in %BUILDDIR%/htmlhelp.
    83         goto end
    84 )
    85 
    86 if "%1" == "qthelp" (
    87         %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
    88         echo.
    89         echo.Build finished; now you can run "qcollectiongenerator" with the ^
    90 .qhcp project file in %BUILDDIR%/qthelp, like this:
    91         echo.^> qcollectiongenerator %BUILDDIR%\qthelp\GeneralStructureAnalysisSystem-II.qhcp
    92         echo.To view the help file:
    93         echo.^> assistant -collectionFile %BUILDDIR%\qthelp\GeneralStructureAnalysisSystem-II.ghc
    94         goto end
    95 )
    96 
    97 if "%1" == "devhelp" (
    98         %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
    99         echo.
    100         echo.Build finished.
    101         goto end
    102 )
    103 
    104 if "%1" == "epub" (
    105         %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
    106         echo.
    107         echo.Build finished. The epub file is in %BUILDDIR%/epub.
    108         goto end
    109 )
    110 
    111 if "%1" == "latex" (
    112         %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
    113         echo.
    114         echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
    115         goto end
    116 )
    117 
    118 if "%1" == "text" (
    119         %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
    120         echo.
    121         echo.Build finished. The text files are in %BUILDDIR%/text.
    122         goto end
    123 )
    124 
    125 if "%1" == "man" (
    126         %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
    127         echo.
    128         echo.Build finished. The manual pages are in %BUILDDIR%/man.
    129         goto end
    130 )
    131 
    132 if "%1" == "changes" (
    133         %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
    134         echo.
    135         echo.The overview file is in %BUILDDIR%/changes.
    136         goto end
    137 )
    138 
    139 if "%1" == "linkcheck" (
    140         %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
    141         echo.
    142         echo.Link check complete; look for any errors in the above output ^
    143 or in %BUILDDIR%/linkcheck/output.txt.
    144         goto end
    145 )
    146 
    147 if "%1" == "doctest" (
    148         %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
    149         echo.
    150         echo.Testing of doctests in the sources finished, look at the ^
    151 results in %BUILDDIR%/doctest/output.txt.
    152         goto end
    153 )
     31:help
     32%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
    15433
    15534:end
     35popd
  • trunk/docs/source/conf.py

    r4205 r4213  
    1212
    1313import sys, os
    14 # set up dummy packages for misc imports not on readthedocs
    15 from mock import Mock as MagicMock
    16 class wx(MagicMock):
    17     #@classmethod
    18     #def __getattr__(cls, name):
    19     #    return wx()
    20     Frame = Menu = Panel = Dialog = CheckBox = Choice = ComboBox = object
    21     Button = PyValidator = TextCtrl = TreeCtrl = object
    22     DEFAULT_DIALOG_STYLE = RESIZE_BORDER = CENTRE = OK = CANCEL = True
    23     ID_ANY = -1
    24     def __getitem__(self,*args):
    25         return '3.0.0'
    26     class grid(object):
    27         PyGridTableBase = PyGridCellEditor = Grid = object
    28     class html(object):
    29         HtmlWindow = object
    30     class aui(MagicMock):
    31         AuiNotebook = HtmlWindow = object
    32     class lib(MagicMock):
    33         class scrolledpanel(MagicMock):
    34             ScrolledPanel = object
    35         class gridmovers(MagicMock): pass
    36         class colourselect(MagicMock): pass
    37         class resizewidget(MagicMock): pass
    38         class mixins(MagicMock):
    39             class listctrl(MagicMock):
    40                 ListCtrlAutoWidthMixin = object
    41                 TextEditMixin = object
    42 
    43 sys.modules.update({'wx':wx(),
    44     'wx.aui':wx.aui(),
    45     'wx.html':wx.html(),
    46         'wx.grid':wx.grid(),
    47         'wx.lib':wx.lib(),
    48         'wx.wizard':wx.grid(),
    49         'wx.glcanvas':wx.lib(),
    50         'wx.lib.scrolledpanel':wx.lib.scrolledpanel(),
    51         'wx.lib.gridmovers':wx.lib.gridmovers(),
    52         'wx.lib.colourselect':wx.lib.gridmovers(),
    53         'wx.lib.resizewidget':wx.lib.resizewidget(),
    54         'wx.lib.mixins':wx.lib.mixins(),
    55         'wx.lib.mixins.listctrl':wx.lib.mixins.listctrl()})
    56 wx.aui.AUI_NB_TOP = 0
    57 wx.aui.AUI_NB_SCROLL_BUTTONS = 0
    58 
    59 class numpy(MagicMock):
    60     pi = 3.0
    61     def log(self,*args): return 0
    62     def sqrt(self,*args): return 1
    63     class ma(MagicMock):pass
    64     class linalg(MagicMock):pass
    65 sys.modules.update({'numpy':numpy()})
    66 sys.modules.update({'numpy.ma':numpy.ma()})
    67 sys.modules.update({'numpy.linalg':numpy.linalg()})
    68 sys.modules.update({'numpy.fft':numpy.linalg()})
    69 
    70 class scipy(MagicMock):
    71     class optimize(MagicMock):pass
    72 sys.modules.update({'scipy':scipy()})
    73 sys.modules.update({'scipy.optimize':scipy.optimize()})
    74 sys.modules.update({'scipy.stats':scipy.optimize()})
    75 sys.modules.update({'scipy.interpolate':scipy.optimize()})
    76 sys.modules.update({'scipy.special':scipy.optimize()})
    77 sys.modules.update({'scipy.misc':scipy.optimize()})
    78 sys.modules.update({'scipy.signal':scipy.optimize()})
    79 sys.modules.update({'scipy.cluster':scipy.optimize()})
    80 sys.modules.update({'scipy.cluster.vq':scipy.optimize()})
    81 
    82 class OpenGL(MagicMock):
    83     class GL(MagicMock):pass
    84     class GLU(MagicMock):pass
    85 sys.modules.update({'OpenGL':OpenGL()})
    86 sys.modules.update({'OpenGL.GL':OpenGL.GL()})
    87 sys.modules.update({'OpenGL.GLU':OpenGL.GLU()})
    88 sys.modules.update({'OpenGL.GLE':OpenGL.GL()})
    89 
    90 class Mock(MagicMock):
    91     @classmethod
    92     def __getattr__(cls, name):
    93         return Mock()
    94 
    95 MOCK_MODULES = [
    96                 'pypowder', 'pyspg', 'pytexture', 'polymask', 'fellipse',
    97                 'matplotlib', 'matplotlib.backends', 'matplotlib.backends.backend_wx',
    98                 'matplotlib.colors',
    99                 'matplotlib.backends.backend_wxagg','pylab','matplotlib.collections',
    100                 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.mplot3d.axes3d',
    101                 'winreg','unpack_cbf','h5py'
    102                 ]
    103 sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
    10414
    10515# If extensions (or modules to document with autodoc) are in another directory,
     
    11121sys.path.insert(1, os.path.abspath(os.path.join('..', '..','imports')))
    11222#print(sys.path)
    113 # import all files to set version number
     23# scan all files to get version number
    11424import glob
    115 for fil in glob.glob(os.path.abspath(os.path.join('..', '..','*.py'))):
    116     pkg = os.path.splitext(os.path.split(fil)[1])[0]
     25version = 0
     26for fil in (glob.glob(os.path.abspath(os.path.join('..', '..','*.py')))+
     27    glob.glob(os.path.abspath(os.path.join('..', '..','exports','*.py')))+
     28    glob.glob(os.path.abspath(os.path.join('..', '..','imports','*.py')))):
     29    fp = open(fil,'r')
     30    c = fp.read()
     31    fp.close()
     32    s = c.find('SetVersionNumber')
     33    if s<0: continue
     34    if c.find('$Revision:',s,s+50)<0: continue
    11735    try:
    118         exec('import '+pkg)
     36        v = int(c[c.find('(',s,s+40):c.find(')',s,s+50)].split()[1])
     37        version = max(version,v)
    11938    except:
    12039        pass
    121 import GSASIIpath
    122 version = GSASIIpath.GetVersionNumber()
    12340print('Found highest version as {}'.format(version))
    12441# -- General configuration -----------------------------------------------------
     
    351268# How to display URL addresses: 'footnote', 'no', or 'inline'.
    352269#texinfo_show_urls = 'footnote'
     270
     271# set up dummy packages for misc imports not on readthedocs
     272autodoc_mock_imports = "wx numpy scipy matplotlib pillow OpenGL h5py".split()
  • trunk/imports/G2img_CBF.py

    r3207 r4213  
    1919import struct as st
    2020import numpy as np
    21 import unpack_cbf as cbf
    2221GSASIIpath.SetVersionNumber("$Revision$")
    2322class CBF_ReaderClass(G2obj.ImportImage):
     
    5049    'Read cif binarydetector data cbf file'
    5150   
     51    import unpack_cbf as cbf
    5252    if GSASIIpath.GetConfigValue('debug'):
    5353        print ('Read cif binary detector data cbf file: '+filename)
  • trunk/imports/G2phase.py

    r4076 r4213  
    3232import GSASIIpath
    3333GSASIIpath.SetVersionNumber("$Revision$")
    34 R2pisq = 1./(2.*np.pi**2)
     34try:  # fails on doc build
     35    R2pisq = 1./(2.*np.pi**2)
     36except TypeError:
     37    pass
    3538
    3639class PDB_ReaderClass(G2obj.ImportPhase):
  • trunk/imports/G2rfd_xye.py

    r3136 r4213  
    2424npasind = lambda x: 180.*np.arcsin(x)/np.pi
    2525npsind = lambda x: np.sin(np.pi*x/180.)
    26 fourpi = 4.0*np.pi
     26try:  # fails on doc build
     27    fourpi = 4.0*np.pi
     28    _double_min = np.finfo(float).min
     29    _double_max = np.finfo(float).max
     30except TypeError:
     31    pass
    2732
    2833class txt_XRayReaderClass(G2obj.ImportReflectometryData):
  • trunk/makeBat.py

    r3940 r4213  
    2121import datetime
    2222import wx
    23 try:
    24     import _winreg as winreg
    25 except ImportError:
    26     import winreg
    2723
    2824Script = '''@echo ========================================================================
     
    4844
    4945if __name__ == '__main__':
     46    try:
     47        import _winreg as winreg
     48    except ImportError:
     49        import winreg
    5050    app = wx.App()
    5151    app.MainLoop()
  • trunk/testDeriv.py

    r4081 r4213  
    3838import GSASIItestplot as plot
    3939import GSASIImapvars as G2mv
    40 import pytexture as ptx
    41 ptx.pyqlmninit()            #initialize fortran arrays for spherical harmonics
     40try:  # fails on doc build
     41    import pytexture as ptx
     42    ptx.pyqlmninit()            #initialize fortran arrays for spherical harmonics
     43except ImportError:
     44    pass
    4245
    4346try:
Note: See TracChangeset for help on using the changeset viewer.