source: sasview/sansrealspace_modeling/setup.py @ dffb5b2

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 dffb5b2 was 1f99b25, checked in by Gervaise Alina <gervyh@…>, 13 years ago

add manifest

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