Changeset 92df9cbd in sasview for installers


Ignore:
Timestamp:
Sep 20, 2017 5:27:53 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
488f3a5
Parents:
1693141
Message:

bundler resources by directory

Location:
installers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • installers/setup_exe.py

    r460d3a1 r92df9cbd  
    2525from distutils.filelist import findall 
    2626from distutils.sysconfig import get_python_lib 
    27 import py2exe 
    2827 
    2928#from idlelib.PyShell import warning_stream 
    3029 
     30# Need the installer dir on the python path to find helper modules 
     31installer_dir = os.path.abspath(os.path.dirname(__file__)) 
     32if installer_dir != os.path.abspath(os.getcwd()): 
     33    raise RuntimeError("Must run setup_exe from the installers directory") 
     34sys.path.append(installer_dir) 
     35 
     36# Need the installer dir on the python path to find helper modules 
    3137if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 
    3238    raise RuntimeError("Must run setup_exe from the installers directory") 
     39sys.path.append(installer_dir) 
    3340 
    3441# put the build directory at the front of the path 
     
    159166        self.name = "SasView" 
    160167 
    161 # 
    162 # Adapted from http://www.py2exe.org/index.cgi/MatPlotLib 
    163 # to use the MatPlotLib. 
    164 # 
    165 matplotlibdatadir = matplotlib.get_data_path() 
    166 matplotlibdata = findall(matplotlibdatadir) 
    167  
    168168data_files = [] 
    169169 
     
    175175data_files += periodictable.data_files() 
    176176 
    177 for f in matplotlibdata: 
    178     dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:]) 
    179     data_files.append((os.path.split(dirname)[0], [f])) 
     177# 
     178# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib 
     179# to use the MatPlotLib. 
     180# 
     181mpl_dir = matplotlib.get_data_path() 
     182for dirpath, dirnames, filenames in os.walk(mpl_dir): 
     183    target_dir = os.path.join("mpl-data", os.path.relpath(dirpath, mpl_dir)) 
     184    source_files = [os.path.join(dirpath, f) for f in filenames] 
     185    data_files.append((target_dir, source_files)) 
    180186 
    181187import sasmodels 
     
    219225 
    220226# Copying the images directory to the distribution directory. 
    221 images_dir = local_config.icon_path 
    222 for f in findall(images_dir): 
    223     data_files.append(("images", [f])) 
     227data_files.append(("images", findall(local_config.icon_path))) 
    224228 
    225229# Copying the HTML help docs 
    226 media_dir = local_config.media_path 
    227 for f in findall(media_dir): 
    228     data_files.append(("media", [f])) 
     230data_files.append(("media", findall(local_config.media_path))) 
    229231 
    230232# Copying the sample data user data 
    231233test_dir = local_config.test_path 
    232 for f in findall(os.path.join(test_dir, "1d_data")): 
    233     data_files.append((os.path.join("test", "1d_data"), [f])) 
    234 for f in findall(os.path.join(test_dir, "2d_data")): 
    235     data_files.append((os.path.join("test", "2d_data"), [f])) 
    236 for f in findall(os.path.join(test_dir, "save_states")): 
    237     data_files.append((os.path.join("test", "save_states"), [f])) 
    238 for f in findall(os.path.join(test_dir, "upcoming_formats")): 
    239     data_files.append((os.path.join("test", "upcoming_formats"), [f])) 
     234for dirpath, dirnames, filenames in os.walk(test_dir): 
     235    target_dir = os.path.join("test", os.path.relpath(dirpath, test_dir)) 
     236    source_files = [os.path.join(dirpath, f) for f in filenames] 
     237    data_files.append((target_dir, source_files)) 
    240238 
    241239# See if the documentation has been built, and if so include it. 
    242240if os.path.exists(doc_path): 
    243241    for dirpath, dirnames, filenames in os.walk(doc_path): 
    244         for filename in filenames: 
    245             sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
    246             data_files.append((sub_dir, [os.path.join(dirpath, filename)])) 
     242        target_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
     243        source_files = [os.path.join(dirpath, f) for f in filenames] 
     244        data_files.append((target_dir, source_files)) 
    247245else: 
    248246    raise Exception("You must first build the documentation before creating an installer.") 
    249247 
    250248# Copying opencl include files 
    251 site_loc = get_python_lib() 
    252 opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 
    253 for f in findall(opencl_include_dir): 
    254     data_files.append((os.path.join("includes", "pyopencl"), [f])) 
     249opencl_source = os.path.join(get_python_lib(), "pyopencl", "cl") 
     250opencl_target = os.path.join("includes", "pyopencl") 
     251data_files.append((opencl_target, findall(opencl_source))) 
    255252 
    256253# Numerical libraries 
     
    357354#CategoryInstaller.check_install(s) 
    358355 
     356#import pprint; pprint.pprint(data_files); sys.exit() 
     357 
     358import py2exe 
    359359setup( 
    360360    windows=[target_wx_client], 
  • installers/setup_mac.py

    r0ccbd36 r92df9cbd  
    2424from setuptools import setup 
    2525 
    26 import macholib_patch 
    27  
    28 if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 
     26# Need the installer dir on the python path to find helper modules 
     27installer_dir = os.path.abspath(os.path.dirname(__file__)) 
     28if installer_dir != os.path.abspath(os.getcwd()): 
    2929    raise RuntimeError("Must run setup_exe from the installers directory") 
     30sys.path.append(installer_dir) 
    3031 
    3132# put the build directory at the front of the path 
     
    3940#Extending recursion limit 
    4041sys.setrecursionlimit(10000) 
     42 
     43import macholib_patch 
    4144 
    4245from sas.sasview import local_config 
     
    7982 
    8083# Copying the images directory to the distribution directory. 
    81 images_dir = local_config.icon_path 
    82 for f in findall(images_dir): 
    83     data_files.append(("images", [f])) 
     84data_files.append(("images", findall(local_config.icon_path))) 
    8485 
    8586# Copying the HTML help docs 
    86 media_dir = local_config.media_path 
    87 for f in findall(media_dir): 
    88     data_files.append(("media", [f])) 
     87data_files.append(("media", findall(local_config.media_path))) 
    8988 
    9089# Copying the sample data user data 
    9190test_dir = local_config.test_path 
    92 for f in findall(os.path.join(test_dir, "1d_data")): 
    93     data_files.append((os.path.join("test", "1d_data"), [f])) 
    94 for f in findall(os.path.join(test_dir, "2d_data")): 
    95     data_files.append((os.path.join("test", "2d_data"), [f])) 
    96 for f in findall(os.path.join(test_dir, "save_states")): 
    97     data_files.append((os.path.join("test", "save_states"), [f])) 
    98 for f in findall(os.path.join(test_dir, "upcoming_formats")): 
    99     data_files.append((os.path.join("test", "upcoming_formats"), [f])) 
     91for dirpath, dirnames, filenames in os.walk(test_dir): 
     92    target_dir = os.path.join("test", os.path.relpath(dirpath, test_dir)) 
     93    source_files = [os.path.join(dirpath, f) for f in filenames] 
     94    data_files.append((target_dir, source_files)) 
    10095 
    10196# See if the documentation has been built, and if so include it. 
    10297if os.path.exists(doc_path): 
    10398    for dirpath, dirnames, filenames in os.walk(doc_path): 
    104         for filename in filenames: 
    105             sub_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
    106             data_files.append((sub_dir, [os.path.join(dirpath, filename)])) 
     99        target_dir = os.path.join("doc", os.path.relpath(dirpath, doc_path)) 
     100        source_files = [os.path.join(dirpath, f) for f in filenames] 
     101        data_files.append((target_dir, source_files)) 
    107102else: 
    108103    raise Exception("You must first build the documentation before creating an installer.") 
    109104 
    110105# Copying opencl include files 
    111 site_loc = get_python_lib() 
    112 opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 
    113 for f in findall(opencl_include_dir): 
    114     data_files.append((os.path.join("includes", "pyopencl"), [f])) 
     106opencl_source = os.path.join(get_python_lib(), "pyopencl", "cl") 
     107opencl_target = os.path.join("includes", "pyopencl") 
     108data_files.append((opencl_target, findall(opencl_source))) 
    115109 
    116110# Locate libxml2 library 
     
    186180           'excludes' : EXCLUDES, 
    187181          } 
     182 
     183#import pprint; pprint.pprint(data_files); sys.exit() 
    188184setup( 
    189185    name=APPNAME, 
Note: See TracChangeset for help on using the changeset viewer.