Changeset f4d571b in sasview


Ignore:
Timestamp:
Apr 11, 2017 5:38:17 AM (8 years ago)
Author:
ajj
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
21bba86
Parents:
6c7e4cc1
Message:

Fixing print statements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/build_sphinx.py

    r115eb7e rf4d571b  
    5656 
    5757#if os.path.exists(SASMODELS_SOURCE_PROLOG): 
    58 #    print "Found models prolog folder at ", SASMODELS_SOURCE_PROLOG 
     58#    print "Found models prolog folder at", SASMODELS_SOURCE_PROLOG 
    5959#if os.path.exists(SASMODELS_SOURCE_REF_MODELS): 
    60 #    print "Found models ref folder at ", SASMODELS_SOURCE_REF_MODELS 
     60#    print "Found models ref folder at", SASMODELS_SOURCE_REF_MODELS 
    6161#if os.path.exists(SASMODELS_SOURCE_MODELS): 
    62 #    print "Found models folder at ", SASMODELS_SOURCE_MODELS 
     62#    print "Found models folder at", SASMODELS_SOURCE_MODELS 
    6363#if os.path.exists(SASMODELS_SOURCE_IMG): 
    64 #    print "Found img folder at ", SASMODELS_SOURCE_IMG 
     64#    print "Found img folder at", SASMODELS_SOURCE_IMG 
    6565#if os.path.exists(SASMODELS_DEST_REF_MODELS): 
    66 #    print "Found models ref folder at ", SASMODELS_DEST_REF_MODELS 
     66#    print "Found models ref folder at", SASMODELS_DEST_REF_MODELS 
    6767#if os.path.exists(SASMODELS_DEST_MODELS): 
    68 #    print "Found models folder at ", SASMODELS_DEST_MODELS 
     68#    print "Found models folder at", SASMODELS_DEST_MODELS 
    6969#if os.path.exists(SASMODELS_DEST_IMG): 
    70 #    print "Found img folder at ", SASMODELS_DEST_IMG 
     70#    print "Found img folder at", SASMODELS_DEST_IMG 
    7171#sys.exit() 
    7272 
     
    107107    Clean the sphinx build directory. 
    108108    """ 
    109     print "=== Cleaning Sphinx Build ===" 
     109    print("=== Cleaning Sphinx Build ===") 
    110110    _remove_dir(SASVIEW_DOCS) 
    111111    _remove_dir(SPHINX_BUILD) 
     
    120120    Copy the source toctrees to new folder for assembling the sphinx-docs 
    121121    """ 
    122     print "=== Copying Source toctrees ===" 
     122    print("=== Copying Source toctrees ===") 
    123123    if os.path.exists(SASVIEW_TOC_SOURCE): 
    124        print "Found docs folder at ", SASVIEW_TOC_SOURCE 
     124       print("Found docs folder at", SASVIEW_TOC_SOURCE) 
    125125       shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE) 
    126126 
     
    141141    so that Sphinx may pick it up when generating the documentation. 
    142142    """ 
    143     print "=== Retrieve User Docs ===" 
     143    print("=== Retrieve User Docs ===") 
    144144 
    145145    # Copy documentation files from their "source" to their "destination". 
     
    148148 
    149149            docs = os.path.abspath(os.path.join(root, dirname)) 
    150             print "Found docs folder at \"%s\"." % docs 
     150            print("Found docs folder at \"%s\"." % docs) 
    151151 
    152152            dest_dir_part = os.path.dirname(os.path.relpath(docs, SASVIEW_SRC)) 
     
    158158 
    159159    # Now pickup testdata_help.rst 
    160 #    print os.path.abspath(SASVIEW_TEST) 
    161 #    print os.path.abspath(SPHINX_SOURCE_TEST) 
    162     print "=== Including Test Data Docs ===" 
     160    print("=== Including Test Data Docs ===") 
    163161    if os.path.exists(SASVIEW_TEST): 
    164        print "Found docs folder at ", SASVIEW_TEST 
     162       print("Found docs folder at", SASVIEW_TEST) 
    165163       shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST) 
    166164 
    167     print "=== And the Sasmodels Docs ===" 
     165    print("=== And the Sasmodels Docs ===") 
    168166    # Make sure we have the relevant images for the new sasmodels documentation 
    169167    # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build) 
    170168    if os.path.exists(SASMODELS_SOURCE_IMG): 
    171         print "Found img  folder SASMODELS_SOURCE_IMG    at ", SASMODELS_SOURCE_IMG 
     169        print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG) 
    172170        if not os.path.exists(SASMODELS_DEST_IMG): 
    173             print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG 
     171            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 
    174172            os.makedirs(SASMODELS_DEST_IMG) 
    175             print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG 
    176         else: print "Found img  folder SASMODELS_DEST_IMG      at ", SASMODELS_DEST_IMG 
    177         print "Copying sasmodels model image files..." 
     173            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG) 
     174        else: 
     175            print("Found img folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 
     176        print("Copying sasmodels model image files...") 
    178177        for files in os.listdir(SASMODELS_SOURCE_IMG): 
    179178            fromhere=os.path.join(SASMODELS_SOURCE_IMG,files) 
    180179            tohere=os.path.join(SASMODELS_DEST_IMG,files) 
    181180            shutil.copy(fromhere,tohere) 
    182     else: print "cannot find SASMODELS_SOURCE_IMG", SASMODELS_SOURCE_IMG 
     181    else: 
     182        print("no source directory",SASMODELS_SOURCE_IMG,"was found") 
    183183 
    184184    if os.path.exists(SASMODELS_SOURCE_AUTOIMG): 
    185         print "Found img  folder SASMODELS_SOURCE_AUTOIMG    at ", SASMODELS_SOURCE_AUTOIMG 
     185        print("Found img folder SASMODELS_SOURCE_AUTOIMG at", SASMODELS_SOURCE_AUTOIMG) 
    186186        if not os.path.exists(SASMODELS_DEST_IMG): 
    187             print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG 
     187            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 
    188188            os.makedirs(SASMODELS_DEST_BUILDIMG) 
    189             print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG 
    190         print "Copying sasmodels model auto-generated image files..." 
     189            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG) 
     190        print("Copying sasmodels model auto-generated image files...") 
    191191        for files in os.listdir(SASMODELS_SOURCE_AUTOIMG): 
    192192            fromhere=os.path.join(SASMODELS_SOURCE_AUTOIMG,files) 
    193193            tohere=os.path.join(SASMODELS_DEST_IMG,files) 
    194194            shutil.copy(fromhere,tohere) 
    195     else: print "no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found" 
     195    else: 
     196        print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found") 
    196197 
    197198    # And the rst prolog with the unit substitutions 
    198199    if os.path.exists(SASMODELS_SOURCE_PROLOG): 
    199         print "Found prolog folder SASMODELS_SOURCE_PROLOG at ", SASMODELS_SOURCE_PROLOG 
     200        print("Found prolog folder SASMODELS_SOURCE_PROLOG at", SASMODELS_SOURCE_PROLOG) 
    200201        if os.path.exists(SASMODELS_DEST_PROLOG): 
    201             print "Found docs folder SASMODELS_DEST_PROLOG   at ", SASMODELS_DEST_PROLOG 
    202             print "Copying sasmodels rst_prolog file..." 
     202            print("Found docs folder SASMODELS_DEST_PROLOG at", SASMODELS_DEST_PROLOG) 
     203            print("Copying sasmodels rst_prolog file...") 
    203204            for files in os.listdir(SASMODELS_SOURCE_PROLOG): 
    204205                if files.startswith("rst"): 
     
    206207                    tohere=os.path.join(SASMODELS_DEST_PROLOG,files) 
    207208                    shutil.copy(fromhere,tohere) 
    208     else: print "no source directory",SASMODELS_SOURCE_PROLOG, "was found" 
     209    else: 
     210        print "no source directory",SASMODELS_SOURCE_PROLOG, "was found" 
    209211 
    210212    if os.path.exists(SASMODELS_SOURCE_GPU): 
    211         print "Found docs folder SASMODELS_SOURCE_GPU at ", SASMODELS_SOURCE_GPU 
     213        print("Found docs folder SASMODELS_SOURCE_GPU at", SASMODELS_SOURCE_GPU) 
    212214        if os.path.exists(SPHINX_SOURCE_USER): 
    213             print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER 
    214             print "Copying sasmodels gpu files..." 
     215            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER) 
     216            print("Copying sasmodels gpu files...") 
    215217            for files in os.listdir(SASMODELS_SOURCE_GPU): 
    216218                if files.endswith(".rst"): 
     
    218220                    tohere=os.path.join(SPHINX_SOURCE_USER,files) 
    219221                    shutil.copy(fromhere,tohere) 
    220     else: print "no source directory",SASMODELS_SOURCE_GPU," was found" 
     222    else: 
     223        print "no source directory",SASMODELS_SOURCE_GPU,"was found" 
    221224 
    222225    if os.path.exists(SASMODELS_SOURCE_SESANS): 
    223         print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS 
     226        print("Found docs folder SASMODELS_SOURCE_SESANS at", SASMODELS_SOURCE_SESANS) 
    224227        if os.path.exists(SPHINX_SOURCE_USER): 
    225             print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER 
    226             print "Copying sasmodels sesans files..." 
     228            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER) 
     229            print("Copying sasmodels sesans files...") 
    227230            for files in os.listdir(SASMODELS_SOURCE_SESANS): 
    228231                if files.endswith(".rst"): 
     
    230233                    tohere=os.path.join(SPHINX_SOURCE_USER,files) 
    231234                    shutil.copy(fromhere,tohere) 
    232     else: print "no source directory",SASMODELS_SOURCE_SESANS," was found" 
     235    else: 
     236        print("no source directory",SASMODELS_SOURCE_SESANS,"was found") 
    233237 
    234238    if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 
    235         print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM 
     239        print("Found docs folder SASMODELS_SOURCE_MAGNETISM at", SASMODELS_SOURCE_MAGNETISM) 
    236240        if os.path.exists(SASMODELS_DEST_REF_MODELS): 
    237             print "Found docs folder SASMODELS_DEST_REF_MODELS   at ", SASMODELS_DEST_REF_MODELS 
    238             print "Copying sasmodels model toctree files..." 
     241            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS) 
     242            print("Copying sasmodels model toctree files...") 
    239243            for files in os.listdir(SASMODELS_SOURCE_MAGNETISM): 
    240244                if files.endswith(".rst"): 
     
    242246                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 
    243247                    shutil.copy(fromhere,tohere) 
    244     else: print "no source directory",SASMODELS_SOURCE_MAGNETISM," was found" 
     248    else: 
     249        print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found") 
    245250 
    246251    if os.path.exists(SASMODELS_SOURCE_MAGIMG): 
    247         print "Found img folder SASMODELS_SOURCE_MAGIMG   at ", SASMODELS_SOURCE_MAGIMG 
     252        print("Found img folder SASMODELS_SOURCE_MAGIMG   at", SASMODELS_SOURCE_MAGIMG) 
    248253        if not os.path.exists(SASMODELS_DEST_MAGIMG): 
    249             print "Missing img folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG 
     254            print("Missing img folder SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG) 
    250255            os.makedirs(SASMODELS_DEST_MAGIMG) 
    251             print "created SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG 
    252         print "Copying sasmodels mag image files..." 
     256            print("created SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG) 
     257        print("Copying sasmodels mag image files...") 
    253258        for files in os.listdir(SASMODELS_SOURCE_MAGIMG): 
    254259            fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files) 
    255260            tohere=os.path.join(SASMODELS_DEST_MAGIMG,files) 
    256261            shutil.copy(fromhere,tohere) 
    257     else: print "no source directory",SASMODELS_SOURCE_MAGIMG ,"was found" 
     262    else: 
     263        print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found") 
    258264 
    259265    if os.path.exists(SASMODELS_SOURCE_SESANSIMG): 
    260         print "Found img folder SASMODELS_SOURCE_SESANSIMG   at ", SASMODELS_SOURCE_SESANSIMG 
     266        print("Found img folder SASMODELS_SOURCE_SESANSIMG at", SASMODELS_SOURCE_SESANSIMG) 
    261267        if not os.path.exists(SASMODELS_DEST_SESANSIMG): 
    262             print "Missing img folder SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG 
     268            print("Missing img folder SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG) 
    263269            os.makedirs(SASMODELS_DEST_SESANSIMG) 
    264             print "created SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG 
    265         print "Copying sasmodels sesans image files..." 
     270            print("created SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG) 
     271        print("Copying sasmodels sesans image files...") 
    266272        for files in os.listdir(SASMODELS_SOURCE_SESANSIMG): 
    267273            fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files) 
    268274            tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files) 
    269275            shutil.copy(fromhere,tohere) 
    270     else: print "no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found" 
     276    else: 
     277        print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found") 
    271278 
    272279    if os.path.exists(SASMODELS_SOURCE_REF_MODELS): 
    273         print "Found docs folder SASMODELS_SOURCE_REF_MODELS at ", SASMODELS_SOURCE_REF_MODELS 
     280        print("Found docs folder SASMODELS_SOURCE_REF_MODELS at", SASMODELS_SOURCE_REF_MODELS) 
    274281        if os.path.exists(SASMODELS_DEST_REF_MODELS): 
    275             print "Found docs folder SASMODELS_DEST_REF_MODELS   at ", SASMODELS_DEST_REF_MODELS 
    276             print "Copying sasmodels model toctree files..." 
     282            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS) 
     283            print("Copying sasmodels model toctree files...") 
    277284            for files in os.listdir(SASMODELS_SOURCE_REF_MODELS): 
    278285                if files.endswith(".rst"): 
     
    284291        #        print files 
    285292                if files.startswith("shape"): 
    286                     print "Changing toc paths in", files 
     293                    print("Changing toc paths in", files) 
    287294                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
    288295                if files.startswith("sphere"): 
    289                     print "Changing toc paths in", files 
     296                    print("Changing toc paths in", files) 
    290297                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
    291298                if files.startswith("custom"): 
    292                     print "Changing toc paths in", files 
     299                    print("Changing toc paths in", files) 
    293300                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
    294301                if files.startswith("structure"): 
    295                     print "Changing toc paths in", files 
     302                    print("Changing toc paths in", files) 
    296303                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
    297     else: print "no source directory",SASMODELS_SOURCE_REF_MODELS," was found" 
     304    else: 
     305        print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found") 
    298306 
    299307    if os.path.exists(SASMODELS_SOURCE_MODELS): 
    300         print "Found docs folder SASMODELS_SOURCE_MODELS at ", SASMODELS_SOURCE_MODELS 
     308        print("Found docs folder SASMODELS_SOURCE_MODELS at", SASMODELS_SOURCE_MODELS) 
    301309        if os.path.exists(SASMODELS_DEST_MODELS): 
    302             print "Found docs folder SASMODELS_DEST_MODELS   at ", SASMODELS_DEST_MODELS 
    303             print "Copying sasmodels model files..." 
     310            print("Found docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 
     311            print("Copying sasmodels model files...") 
    304312            for files in os.listdir(SASMODELS_SOURCE_MODELS): 
    305313                if files.endswith(".rst"): 
     
    308316                    shutil.copy(fromhere,tohere) 
    309317        else: 
    310             print "Missing docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS 
     318            print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 
    311319            os.makedirs(SASMODELS_DEST_MODELS) 
    312320            if not os.path.exists(SASMODELS_DEST_BUILDIMG): 
    313321                os.makedirs(SASMODELS_DEST_BUILDIMG) 
    314             print "Created docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS 
    315             print "Copying model files for build..." 
     322            print("Created docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 
     323            print("Copying model files for build...") 
    316324            for files in os.listdir(SASMODELS_SOURCE_MODELS): 
    317325                if files.endswith(".rst"): 
     
    320328                    shutil.copy(fromhere,tohere) 
    321329            # No choice but to do this because model files are all coded for images in /models/img 
    322             print "Copying image files for build..." 
     330            print("Copying image files for build...") 
    323331            for files in os.listdir(SASMODELS_DEST_IMG): 
    324332                fromhere=os.path.join(SASMODELS_DEST_IMG,files) 
    325333                tohere=os.path.join(SASMODELS_DEST_BUILDIMG,files) 
    326334                shutil.copy(fromhere,tohere) 
    327     else: print "no source directory",SASMODELS_SOURCE_MODELS," was found.\n !!!!NO MODEL DOCS WILL BE BUILT!!!!" 
     335    else: 
     336        print("no source directory",SASMODELS_SOURCE_MODELS,"was found.") 
     337        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 
    328338 
    329339 
     
    333343    """ 
    334344    if os.path.exists(BUMPS_DOCS): 
    335         print "=== Retrieve BUMPS Docs ===" 
     345        print("=== Retrieve BUMPS Docs ===") 
    336346        filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")] 
    337347        filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png")) 
    338348        filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png")) 
    339349        for f in filenames: 
    340             print "Copying file", f 
     350            print("Copying file", f) 
    341351            shutil.copy(f, BUMPS_TARGET) 
    342352    else: 
    343         print """ 
     353        print(""" 
    344354*** Error *** missing directory %s 
    345355The documentation will not include the optimizer selection section. 
     
    347357 
    348358 
    349 """ % BUMPS_DOCS 
     359""" % BUMPS_DOCS) 
    350360 
    351361def apidoc(): 
     
    354364    in the SasView build directory. 
    355365    """ 
    356     print "=== Generate API Rest Files ===" 
     366    print("=== Generate API Rest Files ===") 
    357367 
    358368    # Clean directory before generating a new version. 
     
    368378    Runs sphinx-build.  Reads in all .rst files and spits out the final html. 
    369379    """ 
    370     print "=== Build HTML Docs from Rest Files ===" 
     380    print("=== Build HTML Docs from Rest Files ===") 
    371381    subprocess.call(["sphinx-build", 
    372382                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
     
    375385                     os.path.join(SPHINX_BUILD, "html")]) 
    376386 
    377     print "=== Copy HTML Docs to Build Directory ===" 
     387    print("=== Copy HTML Docs to Build Directory ===") 
    378388    html = os.path.join(SPHINX_BUILD, "html") 
    379389    copy_tree(html, SASVIEW_DOCS) 
     
    387397    build() 
    388398 
    389     print "=== Done ===" 
     399    print("=== Done ===") 
    390400 
    391401if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.