source: sasview/sansmodels/setup.py @ 6a2c931

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 6a2c931 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
Line 
1"""
2 Installation script for SANS models
3"""
4
5import sys
6import os
7from numpy.distutils.misc_util import get_numpy_include_dirs
8numpy_incl_path = os.path.join(get_numpy_include_dirs()[0], "numpy")
9   
10# Then build and install the modules
11from distutils.core import Extension, setup
12#from setuptools import setup#, find_packages
13
14# Build the module name
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")
19print "Installing SANS models"
20
21
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"]
34EXTENSIONS = [".c", ".cpp"]
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)
43            if ext.lower() in EXTENSIONS and f not in IGNORED_FILES:
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)
51                    if ext.lower() in EXTENSIONS and\
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
63dist = setup(
64    name="sansmodels",
65    version = "1.0.0",
66    description = "Python module for SANS scattering models",
67    author = "SANS/DANSE",
68    author_email = "sansdanse@gmail.gov",
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
75    package_dir = {"sans":os.path.join("src", "sans"),
76                   "sans.models":os.path.join("src", "sans", "models"),
77                   "sans.models.sans_extension":srcdir,
78                  },
79    package_data={'sans.models': [os.path.join('media', "*")]},
80    packages = ["sans","sans.models",
81                "sans.models.sans_extension",],
82   
83    ext_modules = [ Extension("sans.models.sans_extension.c_models",
84             sources=model_sources,                 
85     
86        include_dirs=[igordir, srcdir, c_model_dir, numpy_incl_path]),       
87        # Smearer extension
88        Extension("sans.models.sans_extension.smearer",
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]),
93        Extension("sans.models.sans_extension.smearer2d_helper",
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]
98        )
99        ]
100    )
101       
Note: See TracBrowser for help on using the repository browser.