source: sasview/setup.py @ c09ace41

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 c09ace41 was 72af855, checked in by Mathieu Doucet <doucetm@…>, 13 years ago

Re #5 Fixing setup for build server (testing)

  • Property mode set to 100644
File size: 9.1 KB
Line 
1"""
2    Setup for SansView
3    #TODO: Add checks to see that all the dependencies are on the system
4"""
5import sys
6import os
7#from distutils.core import setup, Extension
8from setuptools import setup, Extension, find_packages
9try:
10    from numpy.distutils.misc_util import get_numpy_include_dirs
11    NUMPY_INC = get_numpy_include_dirs()[0]
12except:
13    try:
14        import numpy
15        NUMPY_INC = os.path.join(os.path.split(numpy.__file__)[0],"core","include")
16    except:
17        print "\nNumpy is needed to build SansView. Try easy_install numpy.\n  %s" % str(sys.exc_value)
18        sys.exit(0)
19
20package_dir = {}
21package_data = {}
22packages = []
23ext_modules = []
24
25# TODO check for sans/__init__.py
26
27# sans.invariant
28package_dir["sans.invariant"] = "sansinvariant/src/sans/invariant"
29packages.extend(["sans.invariant"])
30
31# sans.guiframe
32guiframe_path = os.path.join(os.getcwd(), "sansguiframe", "src", "sans", "guiframe")
33package_dir["sans.guiframe"] = guiframe_path
34package_dir["sans.guiframe.local_perspectives"] = os.path.join(guiframe_path, "local_perspectives")
35package_data["sans.guiframe"] = ['images/*', 'media/*']
36packages.extend(["sans.guiframe", "sans.guiframe.local_perspectives"])
37# build local plugin
38for dir in os.listdir(os.path.join(guiframe_path, "local_perspectives")):
39    if dir not in ['.svn','__init__.py', '__init__.pyc']:
40        package_name = "sans.guiframe.local_perspectives." + dir
41        packages.append(package_name)
42        package_dir[package_name] = os.path.join(guiframe_path, "local_perspectives", dir)
43
44# sans.dataloader
45package_dir["sans.dataloader"] = os.path.join("sansdataloader", "src", "sans", "dataloader")
46package_data["sans.dataloader.readers"] = ['defaults.xml']
47packages.extend(["sans.dataloader","sans.dataloader.readers"])
48
49# sans.calculator
50package_dir["sans.calculator"] = "sanscalculator/src/sans/calculator"
51packages.extend(["sans.calculator"])
52   
53# sans.pr
54numpy_incl_path = os.path.join(NUMPY_INC, "numpy")
55srcdir  = os.path.join("pr_inversion", "src", "sans", "pr", "c_extensions")
56
57
58   
59package_dir["sans.pr.core"] = srcdir
60package_dir["sans.pr"] = os.path.join("pr_inversion", "src","sans", "pr")
61packages.extend(["sans.pr","sans.pr.core"])
62ext_modules.append( Extension("sans.pr.core.pr_inversion",
63 sources = [ os.path.join(srcdir, "Cinvertor.c"),
64            os.path.join(srcdir, "invertor.c"),
65            ],
66         include_dirs=[numpy_incl_path]
67 ) )
68       
69# sans.fit (park integration)
70package_dir["sans.fit"] = "park_integration/src/sans/fit"
71packages.append("sans.fit")
72
73# inversion view
74package_dir["sans.perspectives"] = "inversionview/src/sans/perspectives"
75package_dir["sans.perspectives.pr"] = "inversionview/src/sans/perspectives/pr"
76packages.extend(["sans.perspectives","sans.perspectives.pr"])
77package_data["sans.perspectives.pr"] = ['images/*']
78
79# Invariant view
80package_dir["sans.perspectives"] = os.path.join("invariantview", "src", "sans", "perspectives")
81package_dir["sans.perspectives.invariant"] = os.path.join("invariantview", "src", "sans", "perspectives", "invariant")
82               
83package_data['sans.perspectives.invariant'] = [os.path.join("media",'*')]
84packages.extend(["sans.perspectives","sans.perspectives.invariant"]) 
85
86# Fitting view
87package_dir["sans.perspectives"] = os.path.join("fittingview", "src", "sans", "perspectives"),
88package_dir["sans.perspectives.fitting"] = os.path.join("fittingview", "src", "sans", "perspectives", "fitting")
89package_data['sans.perspectives.fitting'] = ['media/*']
90packages.extend(["sans.perspectives", "sans.perspectives.fitting"])
91
92# Calculator view
93package_dir["sans.perspectives"] = "calculatorview/src/sans/perspectives"
94package_dir["sans.perspectives.calculator"] = os.path.join("calculatorview", "src", "sans", "perspectives", "calculator")
95package_data['sans.perspectives.calculator'] = ['images/*', 'media/*']
96packages.extend(["sans.perspectives", "sans.perspectives.calculator"])
97     
98# Data util
99package_dir["data_util"] = "sansutil"
100packages.extend(["data_util"])
101
102# Plottools
103package_dir["danse"] = os.path.join("plottools", "src", "danse")
104package_dir["danse.common"] = os.path.join("plottools", "src", "danse", "common")
105package_dir["danse.common.plottools"] = os.path.join("plottools", "src", "danse", "common", "plottools")
106packages.extend(["danse", "danse.common", "danse.common.plottools"])
107
108# Park 1.2.1
109package_dir["park"]="park-1.2.1/park"
110packages.extend(["park"])
111package_data["park"] = ['park-1.2.1/*.txt', 'park-1.2.1/park.epydoc']
112ext_modules.append( Extension("park._modeling",
113                    sources = [ os.path.join("park-1.2.1", "park", "lib", "modeling.cc"),
114                                os.path.join("park-1.2.1", "park", "lib", "resolution.c"),
115                                ] ) )
116
117# Sans models
118srcdir  = os.path.join("sansmodels", "src", "sans", "models", "c_extensions")
119igordir = os.path.join("sansmodels", "src","sans", "models", "libigor")
120c_model_dir = os.path.join("sansmodels", "src", "sans", "models", "c_models")
121smear_dir  = os.path.join("sansmodels", "src", "sans", "models", "c_smearer")
122
123IGNORED_FILES = ["a.exe",
124                 "__init__.py"
125                 ".svn",
126                   "lineparser.py",
127                   "run.py",
128                   "CGaussian.cpp",
129                   "CLogNormal.cpp",
130                   "CLorentzian.cpp",
131                   "CSchulz.cpp",
132                   "WrapperGenerator.py",
133                   "wrapping.py",
134                   "winFuncs.c"]
135EXTENSIONS = [".c", ".cpp"]
136
137def append_file(file_list, dir_path):
138    """
139    Add sources file to sources
140    """
141    for f in os.listdir(dir_path):
142        if os.path.isfile(os.path.join(dir_path, f)):
143            _, ext = os.path.splitext(f)
144            if ext.lower() in EXTENSIONS and f not in IGNORED_FILES:
145                file_list.append(os.path.join(dir_path, f)) 
146        elif os.path.isdir(os.path.join(dir_path, f)) and \
147                not f.startswith("."):
148            sub_dir = os.path.join(dir_path, f)
149            for new_f in os.listdir(sub_dir):
150                if os.path.isfile(os.path.join(sub_dir, new_f)):
151                    _, ext = os.path.splitext(new_f)
152                    if ext.lower() in EXTENSIONS and\
153                         new_f not in IGNORED_FILES:
154                        file_list.append(os.path.join(sub_dir, new_f)) 
155       
156model_sources = []
157append_file(file_list=model_sources, dir_path=srcdir)
158append_file(file_list=model_sources, dir_path=igordir)
159append_file(file_list=model_sources, dir_path=c_model_dir)
160smear_sources = []
161append_file(file_list=smear_sources, dir_path=smear_dir)
162
163
164package_dir["sans"] = os.path.join("sansmodels", "src", "sans")
165package_dir["sans.models"] = os.path.join("sansmodels", "src", "sans", "models")
166package_dir["sans.models.sans_extension"] = srcdir
167           
168package_data['sans.models'] = [os.path.join('media', "*")]
169packages.extend(["sans","sans.models","sans.models.sans_extension"])
170   
171ext_modules.extend( [ Extension("sans.models.sans_extension.c_models",
172                                sources=model_sources,                 
173                                include_dirs=[igordir, srcdir, c_model_dir, numpy_incl_path]),       
174                    # Smearer extension
175                    Extension("sans.models.sans_extension.smearer",
176                              sources = [os.path.join(smear_dir, "smearer.cpp"),
177                                         os.path.join(smear_dir, "smearer_module.cpp"),],
178                              include_dirs=[smear_dir, numpy_incl_path]),
179                   
180                    Extension("sans.models.sans_extension.smearer2d_helper",
181                              sources = [os.path.join(smear_dir, 
182                                          "smearer2d_helper_module.cpp"),
183                                          os.path.join(smear_dir, "smearer2d_helper.cpp"),],
184                              include_dirs=[smear_dir,numpy_incl_path])
185                    ] )
186       
187# SansView
188package_dir["sans.sansview"] = "sansview"
189package_data['sans.sansview'] = ['images/*', 'media/*', 'plugins/*', 'test/*']
190packages.append("sans.sansview")
191
192#required = ['lxml>=2.2.2', 'numpy>=1.4.1', 'matplotlib>=0.99.1.1', 'wxPython>=2.8.11',
193#            'pil','periodictable>=1.3.0', 'scipy>=0.7.2']
194required = ['lxml>=2.2.2', 'numpy>=1.3.0', 'matplotlib>=0.99.1.1',
195            'pil','periodictable>=1.3.0']
196if sys.platform=='win32':
197    required.extend(['comtypes','pywin32', 'pisa', 'html5lib', 'reportlab'])
198   
199 # Set up SansView   
200setup(
201    name="sansview",
202    version = "2.0.1",
203    description = "SansView application",
204    author = "University of Tennessee",
205    author_email = "sansdanse@gmail.com",
206    url = "http://danse.chem.utk.edu",
207    license = "PSF",
208    keywords = "small-angle neutron scattering analysis",
209    download_url = "https://sourceforge.net/projects/sansviewproject/files/",
210    package_dir = package_dir,
211    packages = packages,
212    package_data = package_data,
213    ext_modules = ext_modules,
214    install_requires = required,
215    entry_points = {
216                    'console_scripts':[
217                                       "sansview = sans.sansview.sansview:run",
218                                       ]
219                    }
220    )   
Note: See TracBrowser for help on using the repository browser.