Changeset 8ab3302 in sasview for setup.py


Ignore:
Timestamp:
Dec 22, 2011 9:55:32 AM (12 years ago)
Author:
Jae Cho <jhjcho@…>
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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
273801b
Parents:
7983000f
Message:

fixed a little bit the setting of .sansview folder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • setup.py

    r5c77050 r8ab3302  
    33    #TODO: Add checks to see that all the dependencies are on the system 
    44""" 
     5# [command] can be any of the following: 
     6#   -nomp: no openmp: Use this flag; C-lib without openmp as well as numpy < 1.6 
     7 
    58import sys 
    6  
    79import os 
    810import platform 
     
    1618    try: 
    1719        import numpy 
    18         NUMPY_INC = os.path.join(os.path.split(numpy.__file__)[0],"core","include") 
     20        NUMPY_INC = os.path.join(os.path.split(numpy.__file__)[0],  
     21                                 "core","include") 
    1922    except: 
    20         print "\nNumpy is needed to build SansView. Try easy_install numpy.\n  %s" % str(sys.exc_value) 
     23        msg = "\nNumpy is needed to build SansView. " 
     24        print msg, "Try easy_install numpy.\n  %s" % str(sys.exc_value) 
    2125        sys.exit(0) 
    2226 
     
    3135ext_modules = [] 
    3236 
     37# Remove all files that should be updated by this setup 
     38# We do this here because application updates these files from .sansview 
     39# except when there is no such file 
     40# Todo : make this list generic 
     41plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py',  
     42                     'sum_Ap1_1_Ap2.py', 'sum_p1_p2.py',  
     43                     'testmodel_2.py', 'testmodel.py'] 
     44sans_dir = os.path.join(os.path.expanduser("~"),'.sansview') 
     45if os.path.isdir(sans_dir): 
     46    f_path = os.path.join(sans_dir, "sansview.log") 
     47    if os.path.isfile(f_path): 
     48        os.remove(f_path) 
     49    f_path = os.path.join(sans_dir, 'config', "custom_config.py") 
     50    if os.path.isfile(f_path): 
     51        os.remove(f_path) 
     52    f_path = os.path.join(sans_dir, 'plugin_models') 
     53    if os.path.isdir(f_path): 
     54        for file in os.listdir(f_path):  
     55            if file in plugin_model_list: 
     56                file_path =  os.path.join(f_path, file) 
     57                os.remove(file_path) 
     58                     
    3359if sys.argv[-1] == "-nomp": 
    3460    # Disable OpenMP 
     
    5682        print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 
    5783         
    58         if not (sys.platform=='darwin' and not is_64bits): 
     84        if not (sys.platform =='darwin' and not is_64bits): 
    5985            if copt.has_key(c): 
    6086               for e in self.extensions: 
     
    74100guiframe_path = os.path.join("sansguiframe", "src", "sans", "guiframe") 
    75101package_dir["sans.guiframe"] = guiframe_path 
    76 package_dir["sans.guiframe.local_perspectives"] = os.path.join(guiframe_path, "local_perspectives") 
     102package_dir["sans.guiframe.local_perspectives"] = os.path.join(guiframe_path,  
     103                                                        "local_perspectives") 
    77104package_data["sans.guiframe"] = ['images/*', 'media/*'] 
    78105packages.extend(["sans.guiframe", "sans.guiframe.local_perspectives"]) 
     
    82109        package_name = "sans.guiframe.local_perspectives." + dir 
    83110        packages.append(package_name) 
    84         package_dir[package_name] = os.path.join(guiframe_path, "local_perspectives", dir) 
     111        package_dir[package_name] = os.path.join(guiframe_path,  
     112                                                 "local_perspectives", dir) 
    85113 
    86114# sans.dataloader 
    87 package_dir["sans.dataloader"] = os.path.join("sansdataloader", "src", "sans", "dataloader") 
     115package_dir["sans.dataloader"] = os.path.join("sansdataloader",  
     116                                              "src", "sans", "dataloader") 
    88117package_data["sans.dataloader.readers"] = ['defaults.xml'] 
    89118packages.extend(["sans.dataloader","sans.dataloader.readers"]) 
     
    120149 
    121150# Invariant view 
    122 package_dir["sans.perspectives"] = os.path.join("invariantview", "src", "sans", "perspectives") 
    123 package_dir["sans.perspectives.invariant"] = os.path.join("invariantview", "src", "sans", "perspectives", "invariant") 
     151package_dir["sans.perspectives"] = os.path.join("invariantview", "src",  
     152                                                "sans", "perspectives") 
     153package_dir["sans.perspectives.invariant"] = os.path.join("invariantview",  
     154                                    "src", "sans", "perspectives", "invariant") 
    124155                 
    125156package_data['sans.perspectives.invariant'] = [os.path.join("media",'*')] 
     
    127158 
    128159# Fitting view 
    129 package_dir["sans.perspectives"] = os.path.join("fittingview", "src", "sans", "perspectives"), 
    130 package_dir["sans.perspectives.fitting"] = os.path.join("fittingview", "src", "sans", "perspectives", "fitting") 
     160fitting_path = os.path.join("fittingview", "src", "sans",  
     161                            "perspectives", "fitting") 
     162package_dir["sans.perspectives"] = os.path.join("fittingview",  
     163                                            "src", "sans", "perspectives"), 
     164package_dir["sans.perspectives.fitting"] = fitting_path 
     165package_dir["sans.perspectives.fitting.plugin_models"] = \ 
     166                                os.path.join(fitting_path, "plugin_models") 
    131167package_data['sans.perspectives.fitting'] = ['media/*','plugin_models/*'] 
    132 packages.extend(["sans.perspectives", "sans.perspectives.fitting"]) 
     168packages.extend(["sans.perspectives", "sans.perspectives.fitting",  
     169                 "sans.perspectives.fitting.plugin_models"]) 
    133170 
    134171# Calculator view 
    135172package_dir["sans.perspectives"] = "calculatorview/src/sans/perspectives" 
    136 package_dir["sans.perspectives.calculator"] = os.path.join("calculatorview", "src", "sans", "perspectives", "calculator") 
     173package_dir["sans.perspectives.calculator"] = os.path.join("calculatorview",  
     174                                "src", "sans", "perspectives", "calculator") 
    137175package_data['sans.perspectives.calculator'] = ['images/*', 'media/*'] 
    138176packages.extend(["sans.perspectives", "sans.perspectives.calculator"]) 
     
    144182# Plottools 
    145183package_dir["danse"] = os.path.join("plottools", "src", "danse") 
    146 package_dir["danse.common"] = os.path.join("plottools", "src", "danse", "common") 
    147 package_dir["danse.common.plottools"] = os.path.join("plottools", "src", "danse", "common", "plottools") 
     184package_dir["danse.common"] = os.path.join("plottools", "src",  
     185                                           "danse", "common") 
     186package_dir["danse.common.plottools"] = os.path.join("plottools",  
     187                                    "src", "danse", "common", "plottools") 
    148188packages.extend(["danse", "danse.common", "danse.common.plottools"]) 
    149189 
     
    153193package_data["park"] = ['park-1.2.1/*.txt', 'park-1.2.1/park.epydoc'] 
    154194ext_modules.append( Extension("park._modeling", 
    155                               sources = [ os.path.join("park-1.2.1", "park", "lib", "modeling.cc"), 
    156                                          os.path.join("park-1.2.1", "park", "lib", "resolution.c"), 
     195                              sources = [ os.path.join("park-1.2.1",  
     196                                                "park", "lib", "modeling.cc"), 
     197                                         os.path.join("park-1.2.1",  
     198                                                "park", "lib", "resolution.c"), 
    157199                                         ], 
    158200                              ) ) 
     
    225267ext_modules.extend( [ Extension("sans.models.sans_extension.c_models", 
    226268                                sources=model_sources,                  
    227                                 include_dirs=[igordir, srcdir, c_model_dir, numpy_incl_path], 
     269                                include_dirs=[igordir, srcdir,  
     270                                              c_model_dir, numpy_incl_path], 
    228271                                ),        
    229272                    # Smearer extension 
    230273                    Extension("sans.models.sans_extension.smearer", 
    231274                              sources = smearer_sources, 
    232                               include_dirs=[igordir, smear_dir, numpy_incl_path], 
     275                              include_dirs=[igordir,  
     276                                            smear_dir, numpy_incl_path], 
    233277                              ), 
    234278                     
    235279                    Extension("sans.models.sans_extension.smearer2d_helper", 
    236280                              sources = [os.path.join(smear_dir,  
    237                                                       "smearer2d_helper_module.cpp"), 
    238                                          os.path.join(smear_dir, "smearer2d_helper.cpp"),], 
     281                                                "smearer2d_helper_module.cpp"), 
     282                                         os.path.join(smear_dir,  
     283                                                "smearer2d_helper.cpp"),], 
    239284                              include_dirs=[smear_dir,numpy_incl_path], 
    240285                              ) 
     
    246291packages.append("sans.sansview") 
    247292 
    248 #required = ['lxml>=2.2.2', 'numpy>=1.4.1', 'matplotlib>=0.99.1.1', 'wxPython>=2.8.11', 
    249 #            'pil','periodictable>=1.3.0', 'scipy>=0.7.2'] 
     293#required = ['lxml>=2.2.2', 'numpy>=1.4.1', 'matplotlib>=0.99.1.1',  
     294#            'wxPython>=2.8.11', 'pil', 
     295#            'periodictable>=1.3.0', 'scipy>=0.7.2'] 
    250296required = ['lxml','periodictable>=1.3.0'] 
    251297""" 
    252298if os.name=='nt': 
    253299    #required.extend(['comtypes', 'pisa', 'html5lib', 'reportlab']) 
    254     required.extend(['pisa', 'html5lib']) 
     300    #required.extend(['pisa', 'html5lib']) 
    255301    if sys.version_info < (2, 7): 
    256302        required.append('comtypes') 
Note: See TracChangeset for help on using the changeset viewer.