📄 umake_cwxml_ascript.py
字号:
# # ***** BEGIN LICENSE BLOCK *****# Source last modified: $Id: umake_cwxml_ascript.py,v 1.6 2004/07/07 22:00:04 hubbe Exp $# # Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.# # The contents of this file, and the files included with this file,# are subject to the current version of the RealNetworks Public# Source License (the "RPSL") available at# http://www.helixcommunity.org/content/rpsl unless you have licensed# the file under the current version of the RealNetworks Community# Source License (the "RCSL") available at# http://www.helixcommunity.org/content/rcsl, in which case the RCSL# will apply. You may also obtain the license terms directly from# RealNetworks. You may not use this file except in compliance with# the RPSL or, if you have a valid RCSL with RealNetworks applicable# to this file, the RCSL. Please see the applicable RPSL or RCSL for# the rights, obligations and limitations governing use of the# contents of the file.# # Alternatively, the contents of this file may be used under the# terms of the GNU General Public License Version 2 or later (the# "GPL") in which case the provisions of the GPL are applicable# instead of those above. If you wish to allow use of your version of# this file only under the terms of the GPL, and not to allow others# to use your version of this file under the terms of either the RPSL# or RCSL, indicate your decision by deleting the provisions above# and replace them with the notice and other provisions required by# the GPL. If you do not delete the provisions above, a recipient may# use your version of this file under the terms of any one of the# RPSL, the RCSL or the GPL.# # This file is part of the Helix DNA Technology. RealNetworks is the# developer of the Original Code and owns the copyrights in the# portions it created.# # This file, and the files included with this file, is distributed# and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY# KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS# ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET# ENJOYMENT OR NON-INFRINGEMENT.# # Technology Compatibility Kit Test Suite(s) Location:# http://www.helixcommunity.org/content/tck# # Contributor(s):# # ***** END LICENSE BLOCK *****# """This is the Mactinosh/AppleScript/CodeWarrior back end for Umake. Itgenerates a AppleScript file which, when run, tries its best to emulatea standard Makefile. It uses AppleScript to generate a CodeWarrior project,and also emits copy commands (using the AppleScript extentions in AkauSweets)to copy the targets once built."""import osimport sysimport stringimport reimport timeimport typesimport posixpathimport macfsimport ascriptimport umake_libimport macpathimport bldregimport umake_ascriptfrom umake_ascript import *## This function has a large portion of shared code with## umake_ascript.py, should probably be made a into a class..## -Hubbedef ProjectToMacCWProjectData(platform, project): """Takes a Platform and Project class, defined in umake.py, and creates a MacCWProjectData class from them. The MacCWProjectData class is then fed to the CodeWarrior AppleScript generator. Data from the Project and Platform classes are munged in various ways in this function. There are many "make it work" hacks here.""" mprj = MacCWProjectData() mprj.platform = platform mprj.project = project mprj.target_name = project.target_name mprj.target_type = project.target_type mprj.define_list = project.defines[:] mprj.prefix_file_include_list = project.prefix_file_include_list[:] ## setup paths/file names if project.project_name == '': mprj.project_file = "%s.prj" % (mprj.target_name) mprj.cwtarget_name = "%s" % (mprj.target_name) mprj.cwtarget_name = "%s" % ("kikkipoo") else: mprj.project_file = "%s.prj" % (project.project_name) mprj.cwtarget_name = "%s" % (project.project_name) makefile = os.path.join(project.module_directory(), project.makefile_name) mprj.cwtarget_name = declaw_name(makefile) mprj.project_file_path = os.path.join(os.getcwd(), mprj.project_file) ## project data foldername/folder path mprj.project_data = "%s Data" % (mprj.target_name) mprj.project_data_path = "%s" % os.path.join(os.getcwd(), mprj.project_data) ## prefix file filename/path mprj.prefix_file = "%s_prefix.h" % (mprj.target_name) mprj.prefix_file_path = mprj.prefix_file mprj.rprefix_file = "r%s_prefix.r" % (mprj.target_name) mprj.rprefix_file_path = mprj.rprefix_file ## resource targets if project.with_resource_flag: mprj.rtarget = "%s.%s" % ( project.resource_target, platform.resource_dll_suffix) mprj.rfile = project.resourcefile ## resource project filename/path mprj.rproject_file = "r%s.prj" % (mprj.target_name) mprj.rproject_file_path = os.path.join(os.getcwd(), mprj.rproject_file) ## resource project data foldername/folder path mprj.rproject_data = "r%s Data" % (mprj.target_name) ## output foldername/folder path mprj.output_dir = project.output_dir mprj.output_dir_path = condense_mac_path( os.path.join(os.getcwd(), mprj.output_dir)) ## target dir foldername/folder path mprj.target_dir = project.target_dir mprj.target_dir_path = condense_mac_path( os.path.join(os.getcwd(), mprj.target_dir)) ## copy over the "preferences" nested hash from the project for (panel, pref) in project.preferences.items(): ## skip copying some of the panels which are handled ## seperately if panel == "Access Paths": for (key, value) in pref.items(): key = string.lower(key) if key == "always full search": mprj.always_full_search = (value == "true") try: temp = mprj.preferences[panel] except KeyError: temp = mprj.preferences[panel] = {} for (pref_key, pref_value) in pref.items(): temp[pref_key] = pref_value ## includes are processed at the end of this, but they are ## accumeulated here first include_path_list = [] ## create soruce_list from project.sources, adding the source ## path (if any) to the user access path list mprj.source_list = [] for source in project.sources: source_path, source_name = os.path.split(source) mprj.source_list.append(source_name) if source_path and source_path not in include_path_list: include_path_list.append(source_path) ## add libraries to sources ## we have to add the libraries to mprj.source_list by splitting ## any path away (if there is a path) and adding it to the includes ## list, which ends up in the "Access Paths->User Paths" panel library_list = project.libraries + project.libraries2 + \ project.local_libs + project.dynamic_libraries + \ project.sys_libraries ## XXX: don't include the module libraries for static libraries ## this is a hack; normally, we don't link any libraries into ## static libs; on the Macintosh, dynamic library links to the ## static library are inherited by whatever program or shared ## library links in the static lib, and programmers have used ## this feature in our code base to avoid listing all the ## libraries programs/dll's link to in their Makefiles... -JMP if mprj.target_type != "lib": library_list = project.module_libs + library_list for library in library_list: lib_path, lib_name = os.path.split(library) ## only add to the weak link list if the library was added if lib_name in project.weak_link_list: mprj.weak_link_list.append(lib_name) if lib_name not in mprj.library_list: mprj.library_list.append(lib_name) if lib_path and lib_path not in include_path_list: include_path_list.append(lib_path) ## Access Paths (System Paths/User Paths) for path in platform.system_paths + project.system_paths: mprj.system_paths.append(extract_ascw_path(path,project)) for path in platform.user_paths: mprj.user_paths.append(extract_ascw_path(path,project)) ## include this for the path to the XRS(resource) dll ## XXX: this should be moved -JMP mprj.user_paths.append( (mprj.output_dir, "false", "project relative") ) ## mix in source/lib/project.includes here ## drop non-unique paths temp_list = project.includes + include_path_list include_path_list = [] for include in temp_list: if include not in include_path_list: include_path_list.append(include) for include in include_path_list: if include[-1] != ":": include = "%s:" % (include) mprj.user_paths.append( (include, "false", "project relative") ) ## Resource Access Paths for path in platform.rsystem_paths: mprj.rsystem_paths.append(extract_ascw_path(path,project)) for path in platform.ruser_paths: mprj.ruser_paths.append(extract_ascw_path(path,project)) for include in project.resourceincludes: if include[-1] != ":": include = "%s:" % (include) if os.path.isdir(include): mprj.ruser_paths.append( (include, "false", "project relative") ) else: umake_lib.warning( "dropping non-existant include path=\"%s\"" % (include)) ## export file mprj.export_file = "" if len(project.exported_func): mprj.export_file = "%s.exp" % (mprj.target_name) mprj.export_list = project.exported_func mprj.source_list.append(mprj.export_file) ## customize the "PPC Project", "PPC PEF" panel, setting ## target output and type ppc_project = mprj.preferences["PPC Project"] ppc_pef = mprj.preferences["PPC PEF"] mprj.output_name = project.OutputName() ## set target name if ppc_project["MWProject_PPC_outfile"] == "": ppc_project["MWProject_PPC_outfile"] = "%s" % (mprj.output_name) ppc_pef["MWPEF_fragmentname"] = ppc_project["MWProject_PPC_outfile"] ## targe type/output file type if mprj.target_type == "lib": ppc_project["MWProject_PPC_type"] = "Library" ppc_project["MWProject_PPC_filetype"] = "????" ppc_pef["MWPEF_exports"] = "None" elif mprj.target_type == "exe": ppc_project["MWProject_PPC_type"] = "Application" ppc_project["MWProject_PPC_filetype"] = "APPL" ppc_pef["MWPEF_exports"] = "None" elif mprj.target_type == "dll": ppc_project["MWProject_PPC_type"] = "SharedLibrary" # mayhave been over-ridden by netscape plugin's pcf if ppc_project["MWProject_PPC_filetype"] == "": ppc_project["MWProject_PPC_filetype"] = "shlb" ## if the target type is a DLL, check for a export file in the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -