source: sasview/realSpaceModeling/setup.py @ 0957dbdb

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 0957dbdb was aa61e49, checked in by Mathieu Doucet <doucetm@…>, 17 years ago

Standardized setup.py, installs in sans.simulation

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