Changeset 952ea1f in sasview for run.py


Ignore:
Timestamp:
Oct 11, 2018 1:33:22 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249
Children:
7ba6470
Parents:
67ed543
git-author:
Paul Kienzle <pkienzle@…> (10/11/18 13:22:07)
git-committer:
Paul Kienzle <pkienzle@…> (10/11/18 13:33:22)
Message:

move c extensions from core/module.so to _module.so

File:
1 edited

Legend:

Unmodified
Added
Removed
  • run.py

    rbc8b8a1 r952ea1f  
    6767 
    6868 
    69 def prepare(): 
     69def prepare(rebuild=True): 
    7070    # Don't create *.pyc files 
    7171    sys.dont_write_bytecode = True 
     
    9595    try: 
    9696        import periodictable 
    97     except: 
     97    except ImportError: 
    9898        addpath(joinpath(root, '..', 'periodictable')) 
    9999 
    100100    try: 
    101101        import bumps 
    102     except: 
     102    except ImportError: 
    103103        addpath(joinpath(root, '..', 'bumps')) 
    104104 
    105105    try: 
    106106        import tinycc 
    107     except: 
     107    except ImportError: 
    108108        addpath(joinpath(root, '../tinycc/build/lib')) 
    109109 
     
    111111    #addpath(os.path.join(root, '..','wxPython-src-3.0.0.0','wxPython')) 
    112112 
    113     # Build project if the build directory does not already exist. 
    114     # PAK: with "update" we can always build since it is fast 
    115     if True or not os.path.exists(build_path): 
     113    # Put the sas source tree on the path 
     114    addpath(joinpath(root, 'src')) 
     115 
     116    # Put sasmodels on the path 
     117    addpath(joinpath(root, '../sasmodels/')) 
     118 
     119    # Check if the C extensions are already built 
     120    try: 
     121        from sas.sascalc.pr import _pr_inversion 
     122        from sas.sascalc.calculator import _sld2i 
     123        from sas.sascalc.file_converter import _bsl_loader 
     124    except ImportError: 
     125        rebuild = True 
     126 
     127    # Build C extensions if necessary.  Do an inplace build to simplify path. 
     128    if rebuild: 
    116129        import subprocess 
    117         build_cmd = [sys.executable, "setup.py", "build", "update"] 
     130        build_cmd = [sys.executable, "setup.py", "build_ext", "--inplace", "update"] 
    118131        if os.name == 'nt': 
    119132            build_cmd.append('--compiler=tinycc') 
     
    122135        with cd(root): 
    123136            subprocess.call(build_cmd, shell=shell) 
    124  
    125     # Put the source trees on the path 
    126     addpath(joinpath(root, 'src')) 
    127  
    128     # sasmodels on the path 
    129     addpath(joinpath(root, '../sasmodels/')) 
    130  
    131     # The sas.models package Compiled Model files should be pulled in from the build directory even though 
    132     # the source is stored in src/sas/models. 
    133  
    134     # Compiled modules need to be pulled from the build directory. 
    135     # Some packages are not where they are needed, so load them explicitly. 
    136     import sas.sascalc.pr 
    137     sas.sascalc.pr.core = import_package('sas.sascalc.pr.core', 
    138                                          joinpath(build_path, 'sas', 'sascalc', 'pr', 'core')) 
    139  
    140     # Compiled modules need to be pulled from the build directory. 
    141     # Some packages are not where they are needed, so load them explicitly. 
    142     import sas.sascalc.file_converter 
    143     sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core', 
    144                                                      joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core')) 
    145  
    146     import sas.sascalc.calculator 
    147     sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 
    148                                                  joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core')) 
    149  
    150     sys.path.append(build_path) 
    151137 
    152138    set_git_tag() 
Note: See TracChangeset for help on using the changeset viewer.