Changeset 6ca9d90 in sasview


Ignore:
Timestamp:
Apr 11, 2017 8:08:59 AM (8 years ago)
Author:
GitHub <noreply@…>
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:
97c60f8, 9c23f40
Parents:
a42fb8e (diff), b854587 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Andrew Jackson <andrew.jackson@…> (04/11/17 08:08:59)
git-committer:
GitHub <noreply@…> (04/11/17 08:08:59)
Message:

Merge pull request #86 from SasView?/pytest

URGENT: Logging conf file working! This was breaking master.

Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • run.py

    r64ca561 rf36e01f  
     1# -*- coding: utf-8 -*- 
    12#!/usr/bin/env python 
     3 
    24""" 
    35Run sasview in place.  This allows sasview to use the python 
     
    1416""" 
    1517 
     18import imp 
    1619import os 
    1720import sys 
    18 import imp 
    19 import logging 
    20 import logging.config 
    21  
    2221from contextlib import contextmanager 
    23 from os.path import abspath, dirname, join as joinpath 
     22from os.path import join as joinpath 
     23from os.path import abspath, dirname 
    2424 
    2525 
    26 LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sasview/logging.ini') 
    27 logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=True) 
    28 logger = logging.getLogger(__name__) 
    29  
    30 def update_all_logs_to_debug(logger): 
    31     ''' 
    32     This updates all loggers and respective handlers to DEBUG 
    33     ''' 
    34     for handler in logger.handlers or logger.parent.handlers: 
    35         handler.setLevel(logging.DEBUG) 
    36     for name,_ in logging.Logger.manager.loggerDict.items(): 
    37         logging.getLogger(name).setLevel(logging.DEBUG) 
    38          
    3926def addpath(path): 
    4027    """ 
     
    5037    sys.path.insert(0, path) 
    5138 
     39 
    5240@contextmanager 
    5341def cd(path): 
     
    6048    os.chdir(old_dir) 
    6149 
     50 
    6251def import_package(modname, path): 
    6352    """Import a package into a particular point in the python namespace""" 
    64     mod = imp.load_source(modname, abspath(joinpath(path,'__init__.py'))) 
     53    mod = imp.load_source(modname, abspath(joinpath(path, '__init__.py'))) 
    6554    sys.modules[modname] = mod 
    6655    mod.__path__ = [abspath(path)] 
    6756    return mod 
     57 
    6858 
    6959def import_dll(modname, build_path): 
     
    7262    ext = sysconfig.get_config_var('SO') 
    7363    # build_path comes from context 
    74     path = joinpath(build_path, *modname.split('.'))+ext 
    75     #print "importing", modname, "from", path 
     64    path = joinpath(build_path, *modname.split('.')) + ext 
     65    # print "importing", modname, "from", path 
    7666    return imp.load_dynamic(modname, path) 
     67 
    7768 
    7869def prepare(): 
     
    8677    from distutils.util import get_platform 
    8778    root = abspath(dirname(__file__)) 
    88     platform = '%s-%s'%(get_platform(),sys.version[:3]) 
    89     build_path = joinpath(root, 'build','lib.'+platform) 
     79    platform = '%s-%s' % (get_platform(), sys.version[:3]) 
     80    build_path = joinpath(root, 'build', 'lib.' + platform) 
    9081 
    9182    # Notify the help menu that the Sphinx documentation is in a different 
     
    9889    #if not os.path.exists(mplconfig): os.mkdir(mplconfig) 
    9990    #import matplotlib 
    100     #matplotlib.use('Agg') 
    101     #print matplotlib.__file__ 
     91    # matplotlib.use('Agg') 
     92    # print matplotlib.__file__ 
    10293    #import pylab; pylab.hold(False) 
    10394    # add periodictable to the path 
    104     try: import periodictable 
    105     except: addpath(joinpath(root, '..','periodictable')) 
     95    try: 
     96        import periodictable 
     97    except: 
     98        addpath(joinpath(root, '..', 'periodictable')) 
    10699 
    107     try: import bumps 
    108     except: addpath(joinpath(root, '..','bumps')) 
     100    try: 
     101        import bumps 
     102    except: 
     103        addpath(joinpath(root, '..', 'bumps')) 
    109104 
    110105    # select wx version 
     
    126121    # be better to just store the package in src/sas/sasview. 
    127122    import sas 
    128     sas.sasview = import_package('sas.sasview', joinpath(root,'sasview')) 
     123    sas.sasview = import_package('sas.sasview', joinpath(root, 'sasview')) 
    129124 
    130125    # The sas.models package Compiled Model files should be pulled in from the build directory even though 
     
    135130    import sas.sascalc.pr 
    136131    sas.sascalc.pr.core = import_package('sas.sascalc.pr.core', 
    137                                   joinpath(build_path, 'sas', 'sascalc', 'pr', 'core')) 
     132                                         joinpath(build_path, 'sas', 'sascalc', 'pr', 'core')) 
    138133 
    139134    # Compiled modules need to be pulled from the build directory. 
     
    141136    import sas.sascalc.file_converter 
    142137    sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core', 
    143                                   joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core'))                     
     138                                                     joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core')) 
    144139 
    145140    # Compiled modules need to be pulled from the build directory. 
     
    147142    import sas.sascalc.calculator 
    148143    sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 
    149                                   joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core')) 
     144                                                 joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core')) 
    150145 
    151146    sys.path.append(build_path) 
    152147 
    153     #print "\n".join(sys.path) 
     148    # print "\n".join(sys.path) 
     149 
    154150 
    155151if __name__ == "__main__": 
    156     update_all_logs_to_debug(logger) 
     152    # Need to add absolute path before actual prepare call, 
     153    # so logging can be done during initialization process too 
     154    root = abspath(dirname(__file__)) 
     155    addpath(joinpath(root, 'sasview')) 
     156    from logger_config import SetupLogger 
     157    logger = SetupLogger(__name__).config_development() 
     158 
     159    logger.debug("Starting SASVIEW in debug mode.") 
    157160    prepare() 
    158161    from sas.sasview.sasview import run 
    159162    run() 
    160      
     163    logger.debug("Ending SASVIEW in debug mode.") 
  • sasview/logging.ini

    r64ca561 rfc22533  
    1616 
    1717[formatter_detailed] 
    18 format=%(asctime)s:%(name)s:%(levelname)s: %(lineno)d: %(message)s 
     18#format=%(asctime)s : %(levelname)s : %(name)s: %(lineno)d: %(message)s 
     19format=%(asctime)s : %(levelname)s : %(name)s (%(filename)s:%(lineno)s) :: %(message)s 
    1920 
    2021############################################################################### 
     
    2728class=logging.StreamHandler 
    2829formatter=simple 
    29 level=INFO 
     30level=WARNING 
    3031args=tuple() 
    3132 
    3233[handler_log_file] 
    3334class=logging.FileHandler 
    34 level=INFO 
     35level=DEBUG 
    3536formatter=detailed 
    3637args=(os.path.join(os.path.expanduser("~"),'sasview.log'),"a") 
     
    4344 
    4445[logger_root] 
    45 level=INFO 
     46level=DEBUG 
    4647formatter=default 
    4748handlers=console,log_file 
     
    6061 
    6162[logger_sasgui] 
    62 level=INFO 
     63level=DEBUG 
    6364qualname=sas.sasgui 
    6465handlers=console,log_file 
  • sasview/sasview.py

    r3608cd1 rf36e01f  
     1# -*- coding: utf-8 -*- 
    12""" 
    23Base module for loading and running the main SasView application. 
    34""" 
    45################################################################################ 
    5 #This software was developed by the University of Tennessee as part of the 
    6 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
    7 #project funded by the US National Science Foundation. 
     6# This software was developed by the University of Tennessee as part of the 
     7# Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
     8# project funded by the US National Science Foundation. 
    89# 
    9 #See the license text in license.txt 
     10# See the license text in license.txt 
    1011# 
    11 #copyright 2009, University of Tennessee 
     12# copyright 2009, University of Tennessee 
    1213################################################################################ 
    1314import os 
     15import os.path 
    1416import sys 
    15 import logging 
    16 import logging.config 
    1717import traceback 
    1818 
    19 logger = logging.getLogger(__name__) 
    20 if not logger.root.handlers: 
    21     LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.ini') 
    22     logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=False) 
    23     logging.captureWarnings(True) 
     19from sas.sasview.logger_config import SetupLogger 
     20 
     21logger = SetupLogger(__name__).config_production() 
     22 
    2423 
    2524# Log the start of the session 
     
    5554import wxcruft 
    5655wxcruft.call_later_fix() 
    57 #wxcruft.trace_new_id() 
     56# wxcruft.trace_new_id() 
    5857 
    59 #Always use private .matplotlib setup to avoid conflicts with other 
    60 #uses of matplotlib 
    61 #Have to check if .sasview exists first 
     58# Always use private .matplotlib setup to avoid conflicts with other 
     59# uses of matplotlib 
     60# Have to check if .sasview exists first 
    6261sasdir = os.path.join(os.path.expanduser("~"),'.sasview') 
    6362if not os.path.exists(sasdir): 
     
    7271from sas.sasgui.guiframe.gui_style import GUIFRAME 
    7372from welcome_panel import WelcomePanel 
    74 # For py2exe, import config here 
    75 import local_config 
     73 
    7674PLUGIN_MODEL_DIR = 'plugin_models' 
    7775APP_NAME = 'SasView' 
     
    8785        """ 
    8886        """ 
    89         #from gui_manager import ViewApp 
     87        # from gui_manager import ViewApp 
    9088        self.gui = gui_manager.SasViewApp(0) 
    9189        # Set the application manager for the GUI 
     
    116114            logger.error(traceback.format_exc()) 
    117115 
    118         #Invariant perspective 
     116        # Invariant perspective 
    119117        try: 
    120118            import sas.sasgui.perspectives.invariant as module 
     
    134132            logger.error("Unable to load corfunc module") 
    135133 
    136         #Calculator perspective 
     134        # Calculator perspective 
    137135        try: 
    138136            import sas.sasgui.perspectives.calculator as module 
     
    153151                                                        APP_NAME) 
    154152            logger.error(traceback.format_exc()) 
    155  
    156153 
    157154        # Add welcome page 
     
    174171    if len(sys.argv) > 1: 
    175172        ## Run sasview as an interactive python interpreter 
    176         #if sys.argv[1] == "-i": 
     173        # if sys.argv[1] == "-i": 
    177174        #    sys.argv = ["ipython", "--pylab"] 
    178175        #    from IPython import start_ipython 
     
    188185        SasView() 
    189186 
     187 
    190188if __name__ == "__main__": 
    191189    run() 
  • sasview/setup_exe.py

    r8b645cc rf36e01f  
    6262        sys.argv.remove('--extrapath') 
    6363except: 
    64     print "Error processing extra python path needed to build SasView\n  %s" % \ 
    65                 sys.exc_value 
     64    print("Error processing extra python path needed to build SasView\n  %s" % \ 
     65                sys.exc_value) 
    6666 
    6767 
     
    8383        modulefinder.AddPackagePath(win32_folder, p) 
    8484    for extra in ["win32com.shell", "win32com.adsi", "win32com.axcontrol", 
    85                     "win32com.axscript", "win32com.bits", "win32com.ifilter", 
    86                     "win32com.internet", "win32com.mapi", "win32com.propsys", 
    87                     "win32com.taskscheduler"]: 
    88          
    89             __import__(extra) 
    90             m = sys.modules[extra] 
    91             for p in m.__path__[1:]: 
    92                 modulefinder.AddPackagePath(extra, p) 
     85                  "win32com.axscript", "win32com.bits", "win32com.ifilter", 
     86                  "win32com.internet", "win32com.mapi", "win32com.propsys", 
     87                  "win32com.taskscheduler"]: 
     88        __import__(extra) 
     89        m = sys.modules[extra] 
     90        for p in m.__path__[1:]: 
     91            modulefinder.AddPackagePath(extra, p) 
    9392 
    9493except ImportError: 
     
    167166        self.copyright = "copyright 2009 - 2016" 
    168167        self.name = "SasView" 
    169          
     168 
    170169# 
    171170# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib 
     
    236235    data_files.append(('config', [f])) 
    237236f = 'local_config.py' 
     237if os.path.isfile(f): 
     238    data_files.append(('.', [f])) 
     239 
     240f = 'logging.ini' 
    238241if os.path.isfile(f): 
    239242    data_files.append(('.', [f])) 
     
    337340    ]) 
    338341packages.append('periodictable.core') # not found automatically 
    339 #packages.append('IPython') 
     342# packages.append('IPython') 
    340343includes = ['site', 'lxml._elementpath', 'lxml.etree'] 
    341344 
     
    370373    other_resources = [(24, 1, manifest)], 
    371374    dest_base = "SasView" 
    372     ) 
     375) 
    373376 
    374377# bundle_option = 2 
  • sasview/setup_mac.py

    r235f514 rb854587  
    5050#CANSAxml reader data files 
    5151RESOURCES_FILES.append(os.path.join(sas.sascalc.dataloader.readers.get_data_path(),'defaults.json')) 
     52 
     53DATA_FILES.append('logging.ini') 
    5254 
    5355# Locate libxml2 library 
  • setup.py

    r14bb7a4 rb854587  
     1# -*- coding: utf-8 -*- 
     2#!/usr/bin/env python 
     3 
    14""" 
    25    Setup for SasView 
    3     #TODO: Add checks to see that all the dependencies are on the system 
     6    TODO: Add checks to see that all the dependencies are on the system 
    47""" 
    5 import sys 
     8 
    69import os 
    710import subprocess 
    811import shutil 
    9 from setuptools import setup, Extension 
     12import sys 
    1013from distutils.command.build_ext import build_ext 
    1114from distutils.core import Command 
     15 
    1216import numpy as np 
     17from setuptools import Extension, setup 
    1318 
    1419# Manage version number ###################################### 
    1520import sasview 
     21 
    1622VERSION = sasview.__version__ 
    1723############################################################## 
     
    2632# except when there is no such file 
    2733# Todo : make this list generic 
    28 #plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py', 
     34# plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py', 
    2935#                      'sum_Ap1_1_Ap2.py', 'sum_p1_p2.py', 
    3036#                      'testmodel_2.py', 'testmodel.py', 
     
    3642SASVIEW_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") 
    3743 
    38 sas_dir = os.path.join(os.path.expanduser("~"),'.sasview') 
     44sas_dir = os.path.join(os.path.expanduser("~"), '.sasview') 
    3945if os.path.isdir(sas_dir): 
    4046    f_path = os.path.join(sas_dir, "sasview.log") 
     
    4854        os.remove(f_path) 
    4955    #f_path = os.path.join(sas_dir, 'plugin_models') 
    50     #if os.path.isdir(f_path): 
     56    # if os.path.isdir(f_path): 
    5157    #     for f in os.listdir(f_path): 
    5258    #         if f in plugin_model_list: 
     
    5460    #             os.remove(file_path) 
    5561    if os.path.exists(SASVIEW_BUILD): 
    56         print("Removing existing build directory", SASVIEW_BUILD, "for a clean build") 
     62        print("Removing existing build directory", 
     63              SASVIEW_BUILD, "for a clean build") 
    5764        shutil.rmtree(SASVIEW_BUILD) 
    5865 
     
    6471enable_openmp = False 
    6572 
    66 if sys.platform =='darwin': 
     73if sys.platform == 'darwin': 
    6774    if not is_64bits: 
    6875        # Disable OpenMP 
     
    7885 
    7986# Options to enable OpenMP 
    80 copt =  {'msvc': ['/openmp'], 
    81          'mingw32' : ['-fopenmp'], 
    82          'unix' : ['-fopenmp']} 
    83 lopt =  {'msvc': ['/MANIFEST'], 
    84          'mingw32' : ['-fopenmp'], 
    85          'unix' : ['-lgomp']} 
     87copt = {'msvc': ['/openmp'], 
     88        'mingw32': ['-fopenmp'], 
     89        'unix': ['-fopenmp']} 
     90lopt = {'msvc': ['/MANIFEST'], 
     91        'mingw32': ['-fopenmp'], 
     92        'unix': ['-lgomp']} 
    8693 
    8794# Platform-specific link options 
    88 platform_lopt = {'msvc' : ['/MANIFEST']} 
     95platform_lopt = {'msvc': ['/MANIFEST']} 
    8996platform_copt = {} 
    9097 
    9198# Set copts to get compile working on OS X >= 10.9 using clang 
    92 if sys.platform =='darwin': 
     99if sys.platform == 'darwin': 
    93100    try: 
    94101        darwin_ver = int(os.uname()[2].split('.')[0]) 
    95102        if darwin_ver >= 13 and darwin_ver < 14: 
    96             platform_copt = {'unix' : ['-Wno-error=unused-command-line-argument-hard-error-in-future']} 
     103            platform_copt = { 
     104                'unix': ['-Wno-error=unused-command-line-argument-hard-error-in-future']} 
    97105    except: 
    98106        print("PROBLEM determining Darwin version") 
     107 
    99108 
    100109class DisableOpenMPCommand(Command): 
     
    115124        pass 
    116125 
    117 class build_ext_subclass( build_ext ): 
     126 
     127class build_ext_subclass(build_ext): 
    118128    def build_extensions(self): 
    119129        # Get 64-bitness 
     
    125135            if c in copt: 
    126136                for e in self.extensions: 
    127                     e.extra_compile_args = copt[ c ] 
     137                    e.extra_compile_args = copt[c] 
    128138            if c in lopt: 
    129139                for e in self.extensions: 
    130                     e.extra_link_args = lopt[ c ] 
     140                    e.extra_link_args = lopt[c] 
    131141 
    132142        # Platform-specific build options 
    133143        if c in platform_lopt: 
    134144            for e in self.extensions: 
    135                 e.extra_link_args = platform_lopt[ c ] 
     145                e.extra_link_args = platform_lopt[c] 
    136146 
    137147        if c in platform_copt: 
    138148            for e in self.extensions: 
    139                 e.extra_compile_args = platform_copt[ c ] 
    140  
     149                e.extra_compile_args = platform_copt[c] 
    141150 
    142151        build_ext.build_extensions(self) 
     152 
    143153 
    144154class BuildSphinxCommand(Command): 
     
    174184        build_sphinx.rebuild() 
    175185 
     186 
    176187# sas module 
    177188package_dir["sas"] = os.path.join("src", "sas") 
     
    187198 
    188199# sas.sascalc.invariant 
    189 package_dir["sas.sascalc.invariant"] = os.path.join("src", "sas", "sascalc", "invariant") 
     200package_dir["sas.sascalc.invariant"] = os.path.join( 
     201    "src", "sas", "sascalc", "invariant") 
    190202packages.extend(["sas.sascalc.invariant"]) 
    191203 
     
    193205guiframe_path = os.path.join("src", "sas", "sasgui", "guiframe") 
    194206package_dir["sas.sasgui.guiframe"] = guiframe_path 
    195 package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join(os.path.join(guiframe_path, "local_perspectives")) 
     207package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join( 
     208    os.path.join(guiframe_path, "local_perspectives")) 
    196209package_data["sas.sasgui.guiframe"] = ['images/*', 'media/*'] 
    197 packages.extend(["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"]) 
     210packages.extend( 
     211    ["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"]) 
    198212# build local plugin 
    199213for d in os.listdir(os.path.join(guiframe_path, "local_perspectives")): 
     
    201215        package_name = "sas.sasgui.guiframe.local_perspectives." + d 
    202216        packages.append(package_name) 
    203         package_dir[package_name] = os.path.join(guiframe_path, "local_perspectives", d) 
     217        package_dir[package_name] = os.path.join( 
     218            guiframe_path, "local_perspectives", d) 
    204219 
    205220# sas.sascalc.dataloader 
    206 package_dir["sas.sascalc.dataloader"] = os.path.join("src", "sas", "sascalc", "dataloader") 
    207 package_data["sas.sascalc.dataloader.readers"] = ['defaults.json', 'schema/*.xsd'] 
    208 packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers", "sas.sascalc.dataloader.readers.schema"]) 
     221package_dir["sas.sascalc.dataloader"] = os.path.join( 
     222    "src", "sas", "sascalc", "dataloader") 
     223package_data["sas.sascalc.dataloader.readers"] = [ 
     224    'defaults.json', 'schema/*.xsd'] 
     225packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers", 
     226                 "sas.sascalc.dataloader.readers.schema"]) 
     227 
    209228 
    210229# sas.sascalc.calculator 
    211230gen_dir = os.path.join("src", "sas", "sascalc", "calculator", "c_extensions") 
    212231package_dir["sas.sascalc.calculator.core"] = gen_dir 
    213 package_dir["sas.sascalc.calculator"] = os.path.join("src", "sas", "sascalc", "calculator") 
    214 packages.extend(["sas.sascalc.calculator","sas.sascalc.calculator.core"]) 
    215 ext_modules.append( Extension("sas.sascalc.calculator.core.sld2i", 
    216         sources = [ 
    217             os.path.join(gen_dir, "sld2i_module.cpp"), 
    218             os.path.join(gen_dir, "sld2i.cpp"), 
    219             os.path.join(gen_dir, "libfunc.c"), 
    220             os.path.join(gen_dir, "librefl.c"), 
    221         ], 
    222         include_dirs=[gen_dir], 
    223     ) 
    224 ) 
     232package_dir["sas.sascalc.calculator"] = os.path.join( 
     233    "src", "sas", "sascalc", "calculator") 
     234packages.extend(["sas.sascalc.calculator", "sas.sascalc.calculator.core"]) 
     235ext_modules.append(Extension("sas.sascalc.calculator.core.sld2i", 
     236                             sources=[ 
     237                                 os.path.join(gen_dir, "sld2i_module.cpp"), 
     238                                 os.path.join(gen_dir, "sld2i.cpp"), 
     239                                 os.path.join(gen_dir, "libfunc.c"), 
     240                                 os.path.join(gen_dir, "librefl.c"), 
     241                             ], 
     242                             include_dirs=[gen_dir], 
     243                             ) 
     244                   ) 
    225245 
    226246# sas.sascalc.pr 
    227 srcdir  = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 
     247srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 
    228248package_dir["sas.sascalc.pr.core"] = srcdir 
    229249package_dir["sas.sascalc.pr"] = os.path.join("src", "sas", "sascalc", "pr") 
    230 packages.extend(["sas.sascalc.pr","sas.sascalc.pr.core"]) 
    231 ext_modules.append( Extension("sas.sascalc.pr.core.pr_inversion", 
    232                               sources = [os.path.join(srcdir, "Cinvertor.c"), 
    233                                          os.path.join(srcdir, "invertor.c"), 
    234                                          ], 
    235                               include_dirs=[], 
    236                               ) ) 
     250packages.extend(["sas.sascalc.pr", "sas.sascalc.pr.core"]) 
     251ext_modules.append(Extension("sas.sascalc.pr.core.pr_inversion", 
     252                             sources=[os.path.join(srcdir, "Cinvertor.c"), 
     253                                      os.path.join(srcdir, "invertor.c"), 
     254                                      ], 
     255                             include_dirs=[], 
     256                             )) 
     257 
    237258 
    238259# sas.sascalc.file_converter 
    239260mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 
    240261package_dir["sas.sascalc.file_converter.core"] = mydir 
    241 package_dir["sas.sascalc.file_converter"] = os.path.join("src", "sas", "sascalc", "file_converter") 
    242 packages.extend(["sas.sascalc.file_converter", "sas.sascalc.file_converter.core"]) 
    243 ext_modules.append( Extension("sas.sascalc.file_converter.core.bsl_loader", 
    244                               sources = [os.path.join(mydir, "bsl_loader.c")], 
    245                               include_dirs=[np.get_include()], 
    246                               ) ) 
    247  
    248 #sas.sascalc.corfunc 
    249 package_dir["sas.sascalc.corfunc"] = os.path.join("src", "sas", "sascalc", "corfunc") 
     262package_dir["sas.sascalc.file_converter"] = os.path.join( 
     263    "src", "sas", "sascalc", "file_converter") 
     264packages.extend(["sas.sascalc.file_converter", 
     265                 "sas.sascalc.file_converter.core"]) 
     266ext_modules.append(Extension("sas.sascalc.file_converter.core.bsl_loader", 
     267                             sources=[os.path.join(mydir, "bsl_loader.c")], 
     268                             include_dirs=[np.get_include()], 
     269                             )) 
     270 
     271# sas.sascalc.corfunc 
     272package_dir["sas.sascalc.corfunc"] = os.path.join( 
     273    "src", "sas", "sascalc", "corfunc") 
     274 
    250275packages.extend(["sas.sascalc.corfunc"]) 
    251276 
     
    255280 
    256281# Perspectives 
    257 package_dir["sas.sasgui.perspectives"] = os.path.join("src", "sas", "sasgui", "perspectives") 
    258 package_dir["sas.sasgui.perspectives.pr"] = os.path.join("src", "sas", "sasgui", "perspectives", "pr") 
    259 packages.extend(["sas.sasgui.perspectives","sas.sasgui.perspectives.pr"]) 
     282package_dir["sas.sasgui.perspectives"] = os.path.join( 
     283    "src", "sas", "sasgui", "perspectives") 
     284package_dir["sas.sasgui.perspectives.pr"] = os.path.join( 
     285    "src", "sas", "sasgui", "perspectives", "pr") 
     286packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.pr"]) 
    260287package_data["sas.sasgui.perspectives.pr"] = ['media/*'] 
    261288 
    262 package_dir["sas.sasgui.perspectives.invariant"] = os.path.join("src", "sas", "sasgui", "perspectives", "invariant") 
     289package_dir["sas.sasgui.perspectives.invariant"] = os.path.join( 
     290    "src", "sas", "sasgui", "perspectives", "invariant") 
    263291packages.extend(["sas.sasgui.perspectives.invariant"]) 
    264 package_data['sas.sasgui.perspectives.invariant'] = [os.path.join("media",'*')] 
    265  
    266 package_dir["sas.sasgui.perspectives.fitting"] = os.path.join("src", "sas", "sasgui", "perspectives", "fitting") 
    267 package_dir["sas.sasgui.perspectives.fitting.plugin_models"] = os.path.join("src", "sas", "sasgui", "perspectives", "fitting", "plugin_models") 
    268 packages.extend(["sas.sasgui.perspectives.fitting", "sas.sasgui.perspectives.fitting.plugin_models"]) 
    269 package_data['sas.sasgui.perspectives.fitting'] = ['media/*', 'plugin_models/*'] 
    270  
    271 packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"]) 
     292package_data['sas.sasgui.perspectives.invariant'] = [ 
     293    os.path.join("media", '*')] 
     294 
     295package_dir["sas.sasgui.perspectives.fitting"] = os.path.join( 
     296    "src", "sas", "sasgui", "perspectives", "fitting") 
     297package_dir["sas.sasgui.perspectives.fitting.plugin_models"] = os.path.join( 
     298    "src", "sas", "sasgui", "perspectives", "fitting", "plugin_models") 
     299packages.extend(["sas.sasgui.perspectives.fitting", 
     300                 "sas.sasgui.perspectives.fitting.plugin_models"]) 
     301package_data['sas.sasgui.perspectives.fitting'] = [ 
     302    'media/*', 'plugin_models/*'] 
     303 
     304packages.extend(["sas.sasgui.perspectives", 
     305                 "sas.sasgui.perspectives.calculator"]) 
    272306package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 
    273307 
    274 package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join("src", "sas", "sasgui", "perspectives", "corfunc") 
     308package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join( 
     309    "src", "sas", "sasgui", "perspectives", "corfunc") 
    275310packages.extend(["sas.sasgui.perspectives.corfunc"]) 
    276311package_data['sas.sasgui.perspectives.corfunc'] = ['media/*'] 
    277312 
    278 package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join("src", "sas", "sasgui", "perspectives", "file_converter") 
     313package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join( 
     314    "src", "sas", "sasgui", "perspectives", "file_converter") 
    279315packages.extend(["sas.sasgui.perspectives.file_converter"]) 
    280316package_data['sas.sasgui.perspectives.file_converter'] = ['media/*'] 
    281317 
    282318# Data util 
    283 package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") 
     319package_dir["sas.sascalc.data_util"] = os.path.join( 
     320    "src", "sas", "sascalc", "data_util") 
    284321packages.append("sas.sascalc.data_util") 
    285322 
    286323# Plottools 
    287 package_dir["sas.sasgui.plottools"] = os.path.join("src", "sas", "sasgui", "plottools") 
     324package_dir["sas.sasgui.plottools"] = os.path.join( 
     325    "src", "sas", "sasgui", "plottools") 
    288326packages.append("sas.sasgui.plottools") 
    289327 
     
    293331 
    294332EXTENSIONS = [".c", ".cpp"] 
     333 
    295334 
    296335def append_file(file_list, dir_path): 
     
    312351                        file_list.append(os.path.join(sub_dir, new_f)) 
    313352 
     353 
    314354# Comment out the following to avoid rebuilding all the models 
    315355file_sources = [] 
    316356append_file(file_sources, gen_dir) 
    317357 
    318 #Wojtek's hacky way to add doc files while bundling egg 
    319 #def add_doc_files(directory): 
     358# Wojtek's hacky way to add doc files while bundling egg 
     359# def add_doc_files(directory): 
    320360#    paths = [] 
    321361#    for (path, directories, filenames) in os.walk(directory): 
     
    330370package_data['sas.sasview'] = ['images/*', 
    331371                               'media/*', 
     372                               'logging.ini', 
    332373                               'test/*.txt', 
    333374                               'test/1d_data/*', 
     
    349390    'lxml', 'h5py', 
    350391 
    351     ## The following dependecies won't install automatically, so assume them 
    352     ## The numbers should be bumped up for matplotlib and wxPython as well. 
     392    # The following dependecies won't install automatically, so assume them 
     393    # The numbers should be bumped up for matplotlib and wxPython as well. 
    353394    # 'numpy>=1.4.1', 'scipy>=0.7.2', 'matplotlib>=0.99.1.1', 
    354395    # 'wxPython>=2.8.11', 'pil', 
    355     ] 
    356  
    357 if os.name=='nt': 
     396] 
     397 
     398if os.name == 'nt': 
    358399    required.extend(['html5lib', 'reportlab']) 
    359400else: 
     
    364405setup( 
    365406    name="sasview", 
    366     version = VERSION, 
    367     description = "SasView application", 
    368     author = "SasView Team", 
    369     author_email = "developers@sasview.org", 
    370     url = "http://sasview.org", 
    371     license = "PSF", 
    372     keywords = "small-angle x-ray and neutron scattering analysis", 
    373     download_url = "https://github.com/SasView/sasview.git", 
    374     package_dir = package_dir, 
    375     packages = packages, 
    376     package_data = package_data, 
    377     ext_modules = ext_modules, 
    378     install_requires = required, 
    379     zip_safe = False, 
    380     entry_points = { 
    381                     'console_scripts':[ 
    382                                        "sasview = sas.sasview.sasview:run", 
    383                                        ] 
    384                     }, 
    385     cmdclass = {'build_ext': build_ext_subclass, 
    386                 'docs': BuildSphinxCommand, 
    387                 'disable_openmp': DisableOpenMPCommand} 
    388     ) 
     407    version=VERSION, 
     408    description="SasView application", 
     409    author="SasView Team", 
     410    author_email="developers@sasview.org", 
     411    url="http://sasview.org", 
     412    license="PSF", 
     413    keywords="small-angle x-ray and neutron scattering analysis", 
     414    download_url="https://github.com/SasView/sasview.git", 
     415    package_dir=package_dir, 
     416    packages=packages, 
     417    package_data=package_data, 
     418    ext_modules=ext_modules, 
     419    install_requires=required, 
     420    zip_safe=False, 
     421    entry_points={ 
     422        'console_scripts': [ 
     423            "sasview = sas.sasview.sasview:run", 
     424        ] 
     425    }, 
     426    cmdclass={'build_ext': build_ext_subclass, 
     427              'docs': BuildSphinxCommand, 
     428              'disable_openmp': DisableOpenMPCommand} 
     429) 
  • src/sas/sasgui/guiframe/gui_manager.py

    r49165488 r38beeab  
    7777    # clean all these module variables and put them into a config class 
    7878    # that can be passed by sasview.py. 
    79     logger.info(sys.executable) 
    80     logger.info(str(sys.argv)) 
     79    logger.debug(sys.executable) 
     80    logger.debug(str(sys.argv)) 
    8181    from sas import sasview as sasview 
    8282    app_path = os.path.dirname(sasview.__file__) 
    83     logger.info("Using application path: %s", app_path) 
     83    logger.debug("Using application path: %s", app_path) 
    8484    return app_path 
    8585 
     
    109109        if fObj is not None: 
    110110            fObj.close() 
    111     logger.info("GuiManager loaded %s/%s" % (path, file)) 
     111    logger.debug("GuiManager loaded %s/%s" % (path, file)) 
    112112    return config_module 
    113113 
     
    126126        # Didn't find local config, load the default 
    127127        import sas.sasgui.guiframe.config as config 
    128         logger.info("using default local_config") 
     128        logger.debug("using default local_config") 
    129129    else: 
    130         logger.info("found local_config in %s" % os.getcwd()) 
     130        logger.debug("found local_config in %s" % os.getcwd()) 
    131131else: 
    132     logger.info("found local_config in %s" % PATH_APP) 
     132    logger.debug("found local_config in %s" % PATH_APP) 
    133133 
    134134from sas.sasgui.guiframe.customdir import SetupCustom 
     
    139139    if custom_config is None: 
    140140        msgConfig = "Custom_config file was not imported" 
    141         logger.info(msgConfig) 
     141        logger.debug(msgConfig) 
    142142    else: 
    143         logger.info("using custom_config in %s" % os.getcwd()) 
     143        logger.debug("using custom_config in %s" % os.getcwd()) 
    144144else: 
    145     logger.info("using custom_config from %s" % c_conf_dir) 
     145    logger.debug("using custom_config from %s" % c_conf_dir) 
    146146 
    147147# read some constants from config 
     
    21562156        if response is not None: 
    21572157            try: 
    2158                 #  
    21592158                content = response.read().strip() 
    2160                 logger.info("Connected to www.sasview.org. Latest version: %s" 
    2161                              % (content)) 
     2159                logger.info("Connected to www.sasview.org. Latest version: %s", content) 
    21622160                version_info = json.loads(content) 
    21632161            except: 
Note: See TracChangeset for help on using the changeset viewer.