Changeset 7c105e8 in sasview


Ignore:
Timestamp:
May 2, 2017 8:32:16 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
c6bdb3b
Parents:
ed03b99
Message:

make run.py work again

Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • run.py

    red03b99 r7c105e8  
    139139    sys.path.append(build_path) 
    140140 
     141    set_git_tag() 
    141142    # print "\n".join(sys.path) 
     143 
     144def set_git_tag(): 
     145    try: 
     146        import subprocess 
     147        import os 
     148        import platform 
     149        FNULL = open(os.devnull, 'w') 
     150        if platform.system() == "Windows": 
     151            args = ['git', 'describe', '--tags'] 
     152        else: 
     153            args = ['git describe --tags'] 
     154        git_revision = subprocess.check_output(args, stderr=FNULL, shell=True) 
     155        import sas.sasview 
     156        sas.sasview.__build__ = str(git_revision).strip() 
     157    except subprocess.CalledProcessError as cpe: 
     158        logger.warning("Error while determining build number\n  Using command:\n %s \n Output:\n %s"% (cpe.cmd,cpe.output)) 
    142159 
    143160 
  • src/sas/sasview/__init__.py

    r914ba0a r7c105e8  
    11__version__ = "4.1" 
    22__build__ = "GIT_COMMIT" 
    3  
    4 import logging 
    5 logger = logging.getLogger(__name__) 
    6  
    7 try: 
    8     import subprocess 
    9     import os 
    10     import platform 
    11     FNULL = open(os.devnull, 'w') 
    12     if platform.system() == "Windows": 
    13         args = ['git', 'describe', '--tags'] 
    14     else: 
    15         args = ['git describe --tags'] 
    16     git_revision = subprocess.check_output(args, 
    17                     stderr=FNULL, 
    18                     shell=True) 
    19     __build__ = str(git_revision).strip() 
    20 except subprocess.CalledProcessError as cpe: 
    21     logger.warning("Error while determining build number\n  Using command:\n %s \n Output:\n %s"% (cpe.cmd,cpe.output)) 
  • src/sas/sasview/sasview.py

    r914ba0a r7c105e8  
    1616import sys 
    1717import traceback 
    18  
    19 from sas.sasview.logger_config import SetupLogger 
     18import logging 
    2019 
    2120reload(sys) 
    2221sys.setdefaultencoding("iso-8859-1") 
    23  
    24 logger = SetupLogger(__name__).config_production() 
    25 # Log the start of the session 
    26 logger.info(" --- SasView session started ---") 
    27 # Log the python version 
    28 logger.info("Python: %s" % sys.version) 
    29  
    3022 
    3123PLUGIN_MODEL_DIR = 'plugin_models' 
     
    3931        """ 
    4032        """ 
     33        logger = logging.getLogger(__name__) 
     34 
    4135        from sas.sasgui.guiframe.gui_manager import SasViewApp 
    4236        self.gui = SasViewApp(0) 
     
    119113 
    120114def setup_logging(): 
    121     log_file = os.path.join(os.path.expanduser("~"), 'sasview.log') 
    122     logging.basicConfig(level=logging.INFO, 
    123                         format='%(asctime)s %(levelname)s %(message)s', 
    124                         filename=log_file, 
    125                         ) 
    126     logging.captureWarnings(True) 
    127  
    128     stderr_logger = logging.getLogger('STDERR') 
    129     sl = StreamToLogger(stderr_logger, logging.ERROR) 
    130     sys.stderr = sl 
    131  
     115    from sas.logger_config import SetupLogger 
     116 
     117    logger = SetupLogger(__name__).config_production() 
    132118    # Log the start of the session 
    133     logging.info(" --- SasView session started ---") 
    134  
     119    logger.info(" --- SasView session started ---") 
    135120    # Log the python version 
    136     logging.info("Python: %s" % sys.version) 
     121    logger.info("Python: %s" % sys.version) 
     122    return logger 
    137123 
    138124 
     
    143129    # probably not be, but this can make things a little easier when upgrading to a 
    144130    # new version of wx. 
     131    logger = logging.getLogger(__name__) 
    145132    WX_ENV_VAR = "SASVIEW_WX_VERSION" 
    146133    if WX_ENV_VAR in os.environ: 
     
    200187 
    201188def run_cli(): 
     189    setup_logging() 
    202190    setup_mpl() 
    203191    if len(sys.argv) == 1: 
Note: See TracChangeset for help on using the changeset viewer.