Changeset 0abf7bf in sasview for sansmodels/setup.py
- Timestamp:
- Nov 23, 2011 1:16:37 PM (13 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 26da93f
- Parents:
- 953fe92
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/setup.py
rd7a2531 r0abf7bf 1 1 """ 2 2 Installation script for SANS models 3 4 - To compile and install:5 python setup.py install6 - To create distribution:7 python setup.py bdist_wininst8 - To create odb files:9 python setup.py odb10 11 3 """ 12 4 13 5 import sys 14 6 import os 15 16 17 7 from numpy.distutils.misc_util import get_numpy_include_dirs 18 8 numpy_incl_path = os.path.join(get_numpy_include_dirs()[0], "numpy") 19 20 def createODBcontent(class_name): 21 """ 22 Return the content of the Pyre odb file for a given class 23 @param class_name: Name of the class to write an odb file for [string] 24 @return: content of the file [string] 25 """ 26 content = "\"\"\"\n" 27 content += " Facility for SANS model\n\n" 28 content += " WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME\n" 29 content += " DO NOT MODIFY\n\n" 30 content += " This code was written as part of the DANSE project\n" 31 content += " http://danse.us/trac/sans/\n" 32 content += " @copyright 2007:" 33 content += " SANS/DANSE Group (University of Tennessee), for the DANSE project\n\n" 34 content += "\"\"\"\n" 35 content += "def model():\n" 36 content += " from ScatteringIntensityFactory import ScatteringIntensityFactory\n" 37 content += " from sans.models.%s import %s\n" % (class_name, class_name) 38 content += " return ScatteringIntensityFactory(%s)('%s')\n"\ 39 % (class_name, class_name) 40 41 return content 42 43 def createODBfiles(): 44 """ 45 Create odb files for all available models 46 """ 47 from sans.models.ModelFactory import ModelFactory 48 49 class_list = ModelFactory().getAllModels() 50 for name in class_list: 51 odb = open("src/sans/models/pyre/%s.odb" % name, 'w') 52 odb.write(createODBcontent(name)) 53 odb.close() 54 print "src/sans/models/pyre/%s.odb created" % name 55 56 # 57 # Proceed with installation 58 # 59 60 # First, create the odb files 61 if len(sys.argv) > 1 and sys.argv[1].lower() == 'odb': 62 print "Creating odb files" 63 try: 64 createODBfiles() 65 except: 66 print "ERROR: could not create odb files" 67 print sys.exc_value 68 sys.exit() 69 9 70 10 # Then build and install the modules 71 11 from distutils.core import Extension, setup … … 139 79 package_data={'sans.models': [os.path.join('media', "*")]}, 140 80 packages = ["sans","sans.models", 141 "sans.models.sans_extension", "sans.models.pyre",],81 "sans.models.sans_extension",], 142 82 143 83 ext_modules = [ Extension("sans.models.sans_extension.c_models",
Note: See TracChangeset
for help on using the changeset viewer.