source: sasview/sansmodels/setup.py @ f489b9d

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since f489b9d was 0abf7bf, checked in by Mathieu Doucet <doucetm@…>, 13 years ago

Re #5 Get rid of pyre models, odb creation, and modelfactory, all of which haven't been used since 2007.

  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[ae3ce4e]1"""
2 Installation script for SANS models
3"""
[d7a2531]4
[f88624d]5import sys
6import os
[b72b595]7from numpy.distutils.misc_util import get_numpy_include_dirs
[6c13861]8numpy_incl_path = os.path.join(get_numpy_include_dirs()[0], "numpy")
[0abf7bf]9   
[ae3ce4e]10# Then build and install the modules
[87615a48]11from distutils.core import Extension, setup
12#from setuptools import setup#, find_packages
[ae3ce4e]13
14# Build the module name
[0a51f0d8]15srcdir  = os.path.join("src", "sans", "models", "c_extensions")
16igordir = os.path.join("src","sans", "models", "libigor")
17c_model_dir = os.path.join("src", "sans", "models", "c_models")
18smear_dir  = os.path.join("src", "sans", "models", "c_smearer")
[ae3ce4e]19print "Installing SANS models"
20
21
[0a51f0d8]22IGNORED_FILES = ["a.exe",
23                 "__init__.py"
24                 ".svn",
25                   "lineparser.py",
26                   "run.py",
27                   "CGaussian.cpp",
28                   "CLogNormal.cpp",
29                   "CLorentzian.cpp",
30                   "CSchulz.cpp",
31                   "WrapperGenerator.py",
32                   "wrapping.py",
33                   "winFuncs.c"]
[0f282a5]34EXTENSIONS = [".c", ".cpp"]
[0a51f0d8]35
36def append_file(file_list, dir_path):
37    """
38    Add sources file to sources
39    """
40    for f in os.listdir(dir_path):
41        if os.path.isfile(os.path.join(dir_path, f)):
42            _, ext = os.path.splitext(f)
[0f282a5]43            if ext.lower() in EXTENSIONS and f not in IGNORED_FILES:
[0a51f0d8]44                file_list.append(os.path.join(dir_path, f)) 
45        elif os.path.isdir(os.path.join(dir_path, f)) and \
46                not f.startswith("."):
47            sub_dir = os.path.join(dir_path, f)
48            for new_f in os.listdir(sub_dir):
49                if os.path.isfile(os.path.join(sub_dir, new_f)):
50                    _, ext = os.path.splitext(new_f)
[0f282a5]51                    if ext.lower() in EXTENSIONS and\
[0a51f0d8]52                         new_f not in IGNORED_FILES:
53                        file_list.append(os.path.join(sub_dir, new_f)) 
54       
55model_sources = []
56append_file(file_list=model_sources, dir_path=srcdir)
57append_file(file_list=model_sources, dir_path=igordir)
58append_file(file_list=model_sources, dir_path=c_model_dir)
59smear_sources = []
60append_file(file_list=smear_sources, dir_path=smear_dir)
61
62
[87615a48]63dist = setup(
[5953b77]64    name="sansmodels",
[a2898df]65    version = "1.0.0",
[ae3ce4e]66    description = "Python module for SANS scattering models",
[87615a48]67    author = "SANS/DANSE",
68    author_email = "sansdanse@gmail.gov",
[ae3ce4e]69    url = "http://danse.us/trac/sans",
70   
71    # Place this module under the sans package
72    #ext_package = "sans",
73   
74    # Use the pure python modules
[0a51f0d8]75    package_dir = {"sans":os.path.join("src", "sans"),
76                   "sans.models":os.path.join("src", "sans", "models"),
77                   "sans.models.sans_extension":srcdir,
[42c974f]78                  },
79    package_data={'sans.models': [os.path.join('media', "*")]},
80    packages = ["sans","sans.models",
[0abf7bf]81                "sans.models.sans_extension",],
[ae3ce4e]82   
[c089120]83    ext_modules = [ Extension("sans.models.sans_extension.c_models",
[0a51f0d8]84             sources=model_sources,                 
85     
86        include_dirs=[igordir, srcdir, c_model_dir, numpy_incl_path]),       
[87615a48]87        # Smearer extension
[c089120]88        Extension("sans.models.sans_extension.smearer",
[0a51f0d8]89                   sources = [os.path.join(smear_dir, 
90                                          "smearer.cpp"),
91                             os.path.join(smear_dir, "smearer_module.cpp"),],
92        include_dirs=[smear_dir, numpy_incl_path]),
[c089120]93        Extension("sans.models.sans_extension.smearer2d_helper",
[0a51f0d8]94                  sources = [os.path.join(smear_dir, 
95                                          "smearer2d_helper_module.cpp"),
96                             os.path.join(smear_dir, "smearer2d_helper.cpp"),],
97        include_dirs=[smear_dir,numpy_incl_path]
[87615a48]98        )
99        ]
100    )
[b72b595]101       
Note: See TracBrowser for help on using the repository browser.