source: sasview/realSpaceModeling/setup_noadpt.py @ 41e8114

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 41e8114 was f2d6445, checked in by Mathieu Doucet <doucetm@…>, 17 years ago

moving realSpaceModeling to trunk

  • Property mode set to 100755
File size: 2.7 KB
Line 
1"""
2 Installation script for SANS models
3
4  - To compile and install:
5      python setup.py install
6  - To create distribution:
7      python setup.py bdist_wininst
8
9"""
10import sys, os
11from distutils.core import setup, Extension
12from distutils import util
13from distutils import sysconfig
14
15def get_c_files(path):
16    """
17        Utility function to return all files
18        to be compiled in a directory
19    """
20    clist = []
21    for file in os.listdir(path):
22        if file.endswith(".cc") or file.endswith(".c"):
23            clist.append("%s/%s" % (path, file))
24    return clist
25
26# The temp directory that the compiled files will be put in
27tempdir = "build/temp."+util.get_platform()+'-'+sysconfig.get_python_version()
28if os.name=='nt':
29    tempdir += "/Release"
30
31# List of sub modules
32mod_list = ["iqPy", "geoshapespy", "pointsmodelpy", "analmodelpy"]
33
34# Define package directors, will be extended below
35pck_dirs = {"sansModeling":"."}
36
37# List of modules to install, will be extende below
38pck_list = ["sansModeling"]
39
40# List of python extensions, will be extended below
41exts = []
42
43# List of include dirs, will be extended below
44incl_dirs = ["iqPy/libiqPy/tnt"]
45
46# List of files to compile, per module, will be extended below
47file_list = {}
48
49# List of dependencies
50deps = {}
51deps["iqPy"] = []
52deps["geoshapespy"] = ["iqPy"]
53deps["analmodelpy"] = ["iqPy", "geoshapespy"]
54deps["pointsmodelpy"] = ["iqPy", "geoshapespy"]
55
56# List of extra objects to link with, per module, will be extended below
57libs = {}
58
59for module in mod_list:
60    pck_dirs["sansModeling.%s" % module] = "%s/%s" % (module, module)
61    pck_list.append("sansModeling.%s" % module)
62
63    src_m = "%s/%smodule" % (module, module)
64    src_l = "%s/lib%s" % (module, module)
65
66    files = get_c_files(src_m)
67    list_lib = get_c_files(src_l)
68
69    libs[module] = []   
70    for dep in deps[module]:
71       
72        for f in get_c_files("%s/lib%s" % (dep, dep)):
73            index = f.rindex('.')
74            if os.name=='nt':
75                fo = f[:index]+'.obj'
76            else:
77                fo = f[:index]+'.o'
78            libs[module].append("%s/%s" %(tempdir,fo))
79       
80    files.extend(list_lib)
81    file_list[module] = files
82   
83    incl_dirs.append(src_m)
84    incl_dirs.append(src_l)
85   
86for module in mod_list:
87    exts.append( Extension("sansModeling.%s.%s" % (module, module),
88        sources = file_list[module],
89        extra_objects=libs[module],
90        include_dirs=incl_dirs) )
91
92setup(
93    name="realspacesimulation",
94    version = "0.2",
95    description = "Python module for SANS simulation",
96    author = "University of Tennessee",
97    url = "http://danse.us/trac/sans",
98   
99    package_dir = pck_dirs,
100    packages    = pck_list,
101   
102    ext_modules = exts)
103
104
105       
Note: See TracBrowser for help on using the repository browser.