source: sasview/sansmodels/src/setup.py @ ff36f31

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 ff36f31 was 42c5acf, checked in by Jae Cho <jhjcho@…>, 16 years ago

Added 2nd virial coeff. func.s

  • Property mode set to 100644
File size: 5.2 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  - To create odb files:
9      python setup.py odb
10
11"""
12import sys
13
14
15
16
17def createODBcontent(class_name):
18    """
19        Return the content of the Pyre odb file for a given class
20        @param class_name: Name of the class to write an odb file for [string]
21        @return: content of the file [string]
22    """
23    content  = "\"\"\"\n"
24    content += "  Facility for SANS model\n\n"
25    content += "  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME\n"
26    content += "           DO NOT MODIFY\n\n"
27    content += "  This code was written as part of the DANSE project\n"
28    content += "  http://danse.us/trac/sans/\n"
29    content += "  @copyright 2007:"
30    content += "  SANS/DANSE Group (University of Tennessee), for the DANSE project\n\n"
31    content += "\"\"\"\n"
32    content += "def model():\n"
33    content += "    from ScatteringIntensityFactory import ScatteringIntensityFactory\n"
34    content += "    from sans.models.%s import %s\n" % (class_name, class_name)
35    content += "    return ScatteringIntensityFactory(%s)('%s')\n"\
36                 % (class_name, class_name)
37
38    return content
39
40def createODBfiles():
41    """
42       Create odb files for all available models
43    """
44    from sans.models.ModelFactory import ModelFactory
45   
46    class_list = ModelFactory().getAllModels()
47    for name in class_list:
48        odb = open("sans/models/pyre/%s.odb" % name, 'w')
49        odb.write(createODBcontent(name))
50        odb.close()
51        print "sans/models/pyre/%s.odb created" % name
52       
53#
54# Proceed with installation
55#
56
57# First, create the odb files
58if len(sys.argv) > 1 and sys.argv[1].lower() == 'odb':
59    print "Creating odb files"
60    try:
61        createODBfiles()
62    except:   
63        print "ERROR: could not create odb files"
64        print sys.exc_value
65    sys.exit()
66
67# Then build and install the modules
68from distutils.core import setup, Extension
69
70
71# Build the module name
72srcdir  = "sans/models/c_extensions"
73igordir = "libigor"
74
75print "Installing SANS models"
76
77
78setup(
79    name="models",
80    version = "0.1",
81    description = "Python module for SANS scattering models",
82    author = "Mathieu Doucet",
83    author_email = "doucet@nist.gov",
84    url = "http://danse.us/trac/sans",
85   
86    # Place this module under the sans package
87    #ext_package = "sans",
88   
89    # Use the pure python modules
90    package_dir = {"sans_extension":"sans/models/c_extensions"},
91   
92    packages = ["sans","sans.models","sans.models.test",
93                "sans_extension","sans.models.pyre"],
94   
95    ext_modules = [ Extension("sans_extension.c_models",
96     sources = [
97        "sans/models/c_models/c_models.cpp",
98        #srcdir+"/CSphereModel.c",
99        #srcdir+"/sphere.c",
100        "sans/models/c_models/CSphereModel.cpp",
101        srcdir+"/SquareWell.c",
102        "sans/models/c_models/CSquareWellStructure.cpp", 
103        "sans/models/c_models/SquareWell.cpp", 
104        srcdir+"/StickyHS.c",         
105        "sans/models/c_models/CStickyHSStructure.cpp", 
106        "sans/models/c_models/StickyHS.cpp",     
107        srcdir+"/Hardsphere.c",         
108        "sans/models/c_models/CHardsphereStructure.cpp", 
109        "sans/models/c_models/Hardsphere.cpp",     
110        srcdir+"/DiamCyl.c",         
111        "sans/models/c_models/CDiamCylFunc.cpp", 
112        "sans/models/c_models/DiamCyl.cpp",   
113        srcdir+"/DiamEllip.c",         
114        "sans/models/c_models/CDiamEllipFunc.cpp", 
115        "sans/models/c_models/DiamEllip.cpp",   
116        srcdir+"/HayterMSA.c",         
117        "sans/models/c_models/CHayterMSAStructure.cpp", 
118        "sans/models/c_models/HayterMSA.cpp",             
119        "sans/models/c_models/sphere.cpp",
120        #srcdir+"/CCylinderModel.c",
121        "sans/models/c_models/CCylinderModel.cpp",
122        "sans/models/c_models/cylinder.cpp",
123        "sans/models/c_models/parameters.cpp",
124        "sans/models/c_models/dispersion_visitor.cpp",
125        srcdir+"/cylinder.c",
126        #srcdir+"/CCoreShellCylinderModel.c",
127        "sans/models/c_models/CCoreShellCylinderModel.cpp",
128        "sans/models/c_models/coreshellcylinder.cpp",
129        srcdir+"/core_shell_cylinder.c",
130        #srcdir+"/CCoreShellModel.c",
131        #srcdir+"/core_shell.c",
132        "sans/models/c_models/CCoreShellModel.cpp",
133        "sans/models/c_models/coreshellsphere.cpp",
134        #srcdir+"/CEllipsoidModel.c",
135        "sans/models/c_models/CEllipsoidModel.cpp",
136        "sans/models/c_models/ellipsoid.cpp",       
137        srcdir+"/ellipsoid.c",
138        #srcdir+"/CEllipticalCylinderModel.c",
139        "sans/models/c_models/CEllipticalCylinderModel.cpp",
140        "sans/models/c_models/ellipticalcylinder.cpp",               
141        srcdir+"/elliptical_cylinder.c",
142        srcdir+"/disperser.c",
143        igordir+"/libCylinder.c",
144        igordir+"/libStructureFactor.c",
145        igordir+"/libSphere.c",
146        srcdir+"/gaussian.c",
147        srcdir+"/CGaussian.c",
148        srcdir+"/lorentzian.c",
149        srcdir+"/CLorentzian.c"
150            ],
151         include_dirs=[igordir,srcdir,"sans/models/c_models"])])
152       
Note: See TracBrowser for help on using the repository browser.