source: sasview/sansmodels/src/setup.py @ 6b4decc

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 6b4decc was 6b4decc, checked in by Mathieu Doucet <doucetm@…>, 15 years ago

sansmodel: remove non-standard default for setup.py

  • Property mode set to 100644
File size: 7.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+"/CParallelepiped.c",
127        "sans/models/c_models/CParallelepipedModel.cpp",
128        "sans/models/c_models/parallelepiped.cpp",
129        srcdir+"/parallelepiped.c",
130        #srcdir+"/CCoreShellCylinderModel.c",
131        "sans/models/c_models/CCoreShellCylinderModel.cpp",
132        "sans/models/c_models/coreshellcylinder.cpp",
133        srcdir+"/core_shell_cylinder.c",
134        #srcdir+"/CCoreShellModel.c",
135        #srcdir+"/core_shell.c",
136        "sans/models/c_models/CCoreShellModel.cpp",
137        "sans/models/c_models/coreshellsphere.cpp",
138        #srcdir+"/CEllipsoidModel.c",
139        "sans/models/c_models/CEllipsoidModel.cpp",
140        "sans/models/c_models/ellipsoid.cpp",       
141        srcdir+"/ellipsoid.c",
142        #srcdir+"/CEllipticalCylinderModel.c",
143        "sans/models/c_models/CEllipticalCylinderModel.cpp",
144        "sans/models/c_models/ellipticalcylinder.cpp",               
145        srcdir+"/elliptical_cylinder.c",
146        #srcdir+"/CTriaxialEllipsoidModel.c",
147        "sans/models/c_models/CTriaxialEllipsoidModel.cpp",
148        "sans/models/c_models/triaxialellipsoid.cpp",               
149        srcdir+"/triaxial_ellipsoid.c",
150        #srcdir+"/CFlexibleCylinderModel.c",
151        "sans/models/c_models/CFlexibleCylinderModel.cpp",
152        "sans/models/c_models/flexiblecylinder.cpp",               
153        srcdir+"/flexible_cylinder.c",
154        #srcdir+"/CStakedDisksModel.c",
155        "sans/models/c_models/CStackedDisksModel.cpp",
156        "sans/models/c_models/stackeddisks.cpp",               
157        srcdir+"/stacked_disks.c",
158        #srcdir+"/CLamellarModel.c",
159        "sans/models/c_models/CLamellarModel.cpp",
160        "sans/models/c_models/lamellar.cpp",               
161        srcdir+"/lamellar.c",
162        #srcdir+"/CLamellarFFHGModel.c",
163        "sans/models/c_models/CLamellarFFHGModel.cpp",
164        "sans/models/c_models/lamellarFF_HG.cpp",               
165        srcdir+"/lamellarFF_HG.c",
166        #srcdir+"/CLamellarPSModel.c",
167        "sans/models/c_models/CLamellarPSModel.cpp",
168        "sans/models/c_models/lamellarPS.cpp",               
169        srcdir+"/lamellarPS.c",
170        #srcdir+"/CLamellarPSHGModel.c",
171        "sans/models/c_models/CLamellarPSHGModel.cpp",
172        "sans/models/c_models/lamellarPS_HG.cpp",               
173        srcdir+"/lamellarPS_HG.c",
174        #srcdir+"/COblateModel.c",
175        "sans/models/c_models/COblateModel.cpp",
176        "sans/models/c_models/oblate.cpp",               
177        srcdir+"/oblate.c",
178        #srcdir+"/CProlateModel.c",
179        "sans/models/c_models/CProlateModel.cpp",
180        "sans/models/c_models/prolate.cpp",               
181        srcdir+"/prolate.c",
182        srcdir+"/disperser.c",
183        igordir+"/libCylinder.c",
184        igordir+"/libStructureFactor.c",
185        igordir+"/libSphere.c",
186        srcdir+"/gaussian.c",
187        srcdir+"/CGaussian.c",
188        srcdir+"/lorentzian.c",
189        srcdir+"/CLorentzian.c"
190            ],
191         include_dirs=[igordir,srcdir,"sans/models/c_models"])])
192       
Note: See TracBrowser for help on using the repository browser.