src/tools/sdk_files.py
changeset 0 ca70ae20a155
equal deleted inserted replaced
-1:000000000000 0:ca70ae20a155
       
     1 # Copyright (c) 2005-2009 Nokia Corporation
       
     2 #
       
     3 # Licensed under the Apache License, Version 2.0 (the "License");
       
     4 # you may not use this file except in compliance with the License.
       
     5 # You may obtain a copy of the License at
       
     6 #
       
     7 #     http://www.apache.org/licenses/LICENSE-2.0
       
     8 #
       
     9 # Unless required by applicable law or agreed to in writing, software
       
    10 # distributed under the License is distributed on an "AS IS" BASIS,
       
    11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    12 # See the License for the specific language governing permissions and
       
    13 # limitations under the License.
       
    14 
       
    15 import os.path
       
    16 import sys
       
    17 import re
       
    18 import glob
       
    19 from shellutil import *
       
    20 
       
    21 sys.path.append(os.path.join(os.getcwd(), 'tools'))
       
    22 
       
    23 emu_release_from = '\\epoc32\\release\\' + EMU_PLATFORM + '\\' + EMU_BUILD
       
    24 emu_release_to = 'epoc32\\release\\' + EMU_PLATFORM + '\\' + EMU_BUILD
       
    25 rsc_files = '\\z\\private\\10003A3F\\apps'
       
    26 dev_release_from = '\\epoc32\\release\\' + DEVICE_PLATFORM + '\\'
       
    27 dev_release_to = 'epoc32\\release\\' + DEVICE_PLATFORM + '\\'
       
    28 pyd_mmp_files = []
       
    29 SDK_FILES = []
       
    30 pyd_mmp_path = ['newcore\\Symbian\\group']
       
    31 if INCLUDE_INTERNAL_SRC and S60_VERSION != 30:
       
    32     pyd_mmp_path.append('..\\internal-src\scriptext\\group')
       
    33 
       
    34 skipped_mmp_files = ['python25', 'appui', 'python_ui', 'Python_launcher',
       
    35                      'start_exe_testapp', '_sensorfw', '_sensor']
       
    36 
       
    37 for r, p, f in os.walk("ext\\amaretto\\"):
       
    38     for dirs in p:
       
    39         pathname = os.path.join(r, dirs)
       
    40         if re.search("group$", pathname):
       
    41             pyd_mmp_path.append(pathname)
       
    42 
       
    43 for entry in (
       
    44     {'from': emu_release_from,
       
    45      'to': emu_release_to,
       
    46      'files': ['python25.dll', 'python25.lib', 'testapp.exe',
       
    47                 PREFIX + 'Python_appui.dll', 'Python_ui.exe',
       
    48                 PREFIX + 'Python_launcher.exe', 'start_exe_testapp.exe']},
       
    49     {'from': emu_release_from + rsc_files,
       
    50      'to': emu_release_to + rsc_files,
       
    51      'files': ['testapp_reg.RSC']},
       
    52     {'from': dev_release_from + DEVICE_BUILD,
       
    53      'to': dev_release_to + DEVICE_BUILD,
       
    54      'files': ['python25.dll', 'testapp.exe', PREFIX + 'Python_launcher.exe',
       
    55                'start_exe_testapp.exe', PREFIX + 'Python_appui.dll']},
       
    56     {'from': dev_release_from + 'LIB',
       
    57      'to': dev_release_to + 'LIB',
       
    58      'files': [PREFIX + 'Python_appui.dso',
       
    59                PREFIX + 'Python_appui{000a0000}.dso', 'python25.dso',
       
    60                'python25{000a0000}.dso', PREFIX + 'Python_appui.lib',
       
    61                PREFIX + 'Python_appui{000a0000}.lib', 'python25.lib',
       
    62                'python25{000a0000}.lib']},
       
    63     {'from': '\\epoc32\\release\\winscw\\udeb\\' + rsc_files,
       
    64      'to': 'epoc32\\release\\winscw\\udeb\\' + rsc_files,
       
    65      'files': ['testapp_reg.RSC', 'Python_ui_reg.rsc']},
       
    66     {'from': '\\epoc32\\release\\winscw\\udeb\\z\\resource\\apps',
       
    67      'to': 'epoc32\\release\\winscw\\udeb\\\z\\resource\\apps',
       
    68      'files': ['Python_ui.rsc', PREFIX + 'appuifwmodule.rsc',
       
    69                'Python_ui_aif.mif', 'Python_ui_loc.rsc']},
       
    70     {'from': '\\epoc32\\data\\z\\resource\\apps',
       
    71      'to': 'epoc32\\data\\z\\resource\\apps',
       
    72      'files': [PREFIX + 'appuifwmodule.rsc']},
       
    73     {'from': '\\epoc32\\include',
       
    74      'to': 'epoc32\\include',
       
    75      'files': ['Python_ui.rsg', PREFIX + 'appuifwmodule.rsg']}):
       
    76     for f in entry['files']:
       
    77         SDK_FILES.append((os.path.normpath(entry['from'] + '\\' + f),
       
    78                           os.path.normpath(entry['to'] + '\\' +
       
    79                                            os.path.basename(f))))
       
    80 
       
    81 for folders in pyd_mmp_path:
       
    82     pyd_mmp_files += files_matching_regex(folders, '(.*\.mmp$)')
       
    83 
       
    84 for mmp_file in pyd_mmp_files:
       
    85     file_name, ext = os.path.basename(mmp_file).split('.')
       
    86     pyd_file = None
       
    87     if file_name == 'gps':
       
    88         pyd_file = PREFIX + "_locationacq.pyd"
       
    89     elif file_name not in skipped_mmp_files:
       
    90         pyd_file = PREFIX + file_name + ".pyd"
       
    91     if pyd_file is not None:
       
    92         SDK_FILES.append(((emu_release_from + '\\' + pyd_file),
       
    93                           (emu_release_to + '\\' + pyd_file)))
       
    94     else:
       
    95         print "Skipping mmp file:", mmp_file
       
    96 
       
    97 for header_file in files_matching_regex('\\epoc32\\include\\python25',
       
    98                                         '.*.h'):
       
    99     SDK_FILES.append((header_file, ('epoc32\\include\\python25\\' +
       
   100                                      os.path.basename(header_file))))
       
   101 
       
   102 for lib_file in files_matching_regex('\\epoc32\\winscw\\c\\resource\\python25',
       
   103                                      '.*'):
       
   104     temp_path, relative_lib_file = lib_file.split('resource\\python25\\')
       
   105     SDK_FILES.append((lib_file, ('epoc32\\winscw\\c\\resource\\python25\\' +
       
   106                                   relative_lib_file)))
       
   107 
       
   108 # This loop is for copying all the files in c\\data\\python\\ folder.
       
   109 for dependent_files in files_matching_regex('\\epoc32\\winscw\\c\\data\\' +
       
   110                                             'python', '.*'):
       
   111     temp_path, relative_dependent_file = dependent_files.split('data\\' +
       
   112                                                                'python\\')
       
   113     SDK_FILES.append((dependent_files, ('epoc32\\winscw\\c\\data\\python\\' +
       
   114                                          relative_dependent_file)))
       
   115 
       
   116 # This loop is for copying all the files in c\\data\\test\\ folder. This
       
   117 # folder structure is required by test_zipfile.
       
   118 for dependent_files in files_matching_regex('\\epoc32\\winscw\\c\\data\\test',
       
   119                                             '.*'):
       
   120     temp_path, relative_dependent_file = dependent_files.split('data\\test\\')
       
   121     SDK_FILES.append((dependent_files, ('epoc32\\winscw\\c\\data\\test\\' +
       
   122                                          relative_dependent_file)))
       
   123 if INCLUDE_ARMV5_PYDS:
       
   124     binary_from = dev_release_from + DEVICE_BUILD
       
   125     binary_to = dev_release_to + DEVICE_BUILD
       
   126     for dependent_files in files_matching_regex(binary_from + '\\', '.*.pyd'):
       
   127         temp_path, relative_dependent_file = \
       
   128                                         dependent_files.split('armv5\\urel\\')
       
   129         SDK_FILES.append((dependent_files, (binary_to + '\\' +
       
   130                                               relative_dependent_file)))
       
   131     if BUILD_PROFILE == 'release':
       
   132         SDK_FILES.append(((binary_from + '\\run_testapp.exe'),
       
   133                           (binary_to + '\\run_testapp.exe')))
       
   134         SDK_FILES.append(((binary_from + '\\interpreter-startup.exe'),
       
   135                           (binary_to + '\\interpreter-startup.exe')))
       
   136         SDK_FILES.append(((binary_from + '\\run-interpretertimer.exe'),
       
   137                           (binary_to + '\\run-interpretertimer.exe')))
       
   138 
       
   139         rsc_file_path = 'private\\10003a3f\\import\\apps\\'
       
   140 
       
   141         SDK_FILES.append((('\\Epoc32\\Data\\z\\' + rsc_file_path +
       
   142                            'testapp_reg.RSC'),
       
   143                           ('Epoc32\\Data\\z\\' + rsc_file_path +
       
   144                            'testapp_reg.RSC')))
       
   145         SDK_FILES.append((('\\Epoc32\\Data\\z\\' + rsc_file_path +
       
   146                            'run_testapp_reg.rsc'),
       
   147                           ('Epoc32\\Data\\z\\' + rsc_file_path +
       
   148                            'run_testapp_reg.rsc')))
       
   149         SDK_FILES.append((('\\Epoc32\\Data\\z\\' + rsc_file_path +
       
   150                            'interpreter-startup_reg.RSC'),
       
   151                           ('Epoc32\\Data\\z\\' + rsc_file_path +
       
   152                            'interpreter-startup_reg.RSC')))
       
   153         SDK_FILES.append((('\\Epoc32\\Data\\z\\' + rsc_file_path +
       
   154                            'run-interpretertimer_reg.RSC'),
       
   155                           ('Epoc32\\Data\\z\\' + rsc_file_path +
       
   156                            'run-interpretertimer_reg.RSC')))
       
   157 
       
   158 
       
   159 SDK_FILES.append((('\\epoc32\\winscw\\c\\private\\' + PYS60_UID_PYTHONUI[2:] +
       
   160                    '\\launcher.py'),
       
   161                   ('epoc32\\winscw\\c\\private\\' + PYS60_UID_PYTHONUI[2:] +
       
   162                    '\\launcher.py')))
       
   163 SDK_FILES.append((('\\epoc32\\winscw\\c\\private\\' + PYS60_UID_PYTHONUI[2:] +
       
   164                    '\\default.py'),
       
   165                   ('epoc32\\winscw\\c\\private\\' + PYS60_UID_PYTHONUI[2:] +
       
   166                    '\\default.py')))