[DEV] update package building (start generization)
This commit is contained in:
parent
f0fe760836
commit
64a6e47b37
@ -494,7 +494,81 @@ class Target:
|
||||
else:
|
||||
self.action_on_state[name_of_state].append([level, name, action])
|
||||
|
||||
##
|
||||
## @brief Create a package/bundle for the platform.
|
||||
## @param[in] pkg_name Package Name (generic name)
|
||||
## @param[in] pkg_properties Property of the package
|
||||
## @param[in] base_pkg_path Base path of the package
|
||||
## @param[in] heritage_list List of dependency of the package
|
||||
## @param[in] static The package is build in static mode
|
||||
##
|
||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
#The package generated depend of the type of the element:
|
||||
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||
module = self.get_module(end_point_module_name)
|
||||
if module == None:
|
||||
debug.error("can not create package ... ");
|
||||
if module.get_type() == 'PREBUILD':
|
||||
#nothing to do ...
|
||||
return
|
||||
if module.get_type() == 'LIBRARY' \
|
||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||
or module.get_type() == 'LIBRARY_STATIC':
|
||||
debug.info("Can not create package for library");
|
||||
return
|
||||
if module.get_type() == 'BINARY' \
|
||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||
if module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
return
|
||||
return
|
||||
|
||||
##
|
||||
## @brief Create a generic tree of the shared data for each platform
|
||||
## @param[in] path_package Path of the basic install folder of the application
|
||||
## @param[in] pkg_name Package Name (generic name)
|
||||
## @param[in] heritage_list List of dependency of the package
|
||||
## @param[in] static The package is build in static mode
|
||||
##
|
||||
def make_package_binary_data(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
|
||||
target_shared_path = os.path.join(path_package, self.pkg_path_data)
|
||||
if static == True:
|
||||
target_outpath_data = os.path.join(target_shared_path, pkg_name)
|
||||
else:
|
||||
target_outpath_data = target_shared_path
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
# prepare list of copy files
|
||||
copy_list={}
|
||||
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
path_src = self.get_build_path_data(heritage.name)
|
||||
debug.verbose(" has directory: " + path_src)
|
||||
if os.path.isdir(path_src):
|
||||
if static == True:
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(path_src,
|
||||
target_outpath_data,
|
||||
recursive=True,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
else:
|
||||
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(os.path.dirname(path_src),
|
||||
target_outpath_data,
|
||||
recursive=True,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_shared_path, copy_list)
|
||||
|
||||
|
||||
def generate_list_separate_coma(self, list):
|
||||
result = ""
|
||||
|
@ -68,7 +68,18 @@ def file_read_data(path, binary=False):
|
||||
file.close()
|
||||
return data_file
|
||||
|
||||
def file_write_data(path, data):
|
||||
##
|
||||
## @brief Write data in a specific path.
|
||||
## @param[in] path Path of the data might be written.
|
||||
## @param[in] data Data To write in the file.
|
||||
## @param[in] only_if_new (default: False) Write data only if data is different.
|
||||
##
|
||||
def file_write_data(path, data, only_if_new=False):
|
||||
if only_if_new == True:
|
||||
old_data = file_read_data(path)
|
||||
if old_data == data:
|
||||
return
|
||||
#real write of data:
|
||||
file = open(path, "w")
|
||||
file.write(data)
|
||||
file.close()
|
||||
|
@ -213,74 +213,35 @@ class Target(target.Target):
|
||||
return self.get_staging_path(binary_name) + self.path_data
|
||||
"""
|
||||
|
||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
#The package generated depend of the type of the element:
|
||||
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||
module = self.get_module(end_point_module_name)
|
||||
if module == None:
|
||||
debug.error("can not create package ... ");
|
||||
if module.get_type() == 'PREBUILD':
|
||||
#nothing to do ...
|
||||
return
|
||||
if module.get_type() == 'LIBRARY' \
|
||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||
or module.get_type() == 'LIBRARY_STATIC':
|
||||
debug.info("Can not create package for library");
|
||||
return
|
||||
if module.get_type() == 'BINARY' \
|
||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||
if module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
return
|
||||
|
||||
def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkg_name + "'")
|
||||
debug.info("Generate package '" + pkg_name + "' v"+pkg_properties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
||||
#output path
|
||||
target_outpath = self.get_staging_path(pkg_name)
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas
|
||||
if static == True:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
|
||||
else:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data)
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
path_src = self.get_build_path_data(heritage.name)
|
||||
debug.verbose(" has directory: " + path_src)
|
||||
if os.path.isdir(path_src):
|
||||
if static == True:
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(path_src, target_outpath_data, recursive=True, force_identical=True)
|
||||
else:
|
||||
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True)
|
||||
## Create share datas:
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files
|
||||
# in Android Package wa have no binary element, only shared object ...
|
||||
|
||||
# in Android Package we have no binary element, only shared object ... (and java start file)
|
||||
|
||||
## Create libraries
|
||||
copy_list={}
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
tools.create_directory_of_file(target_outpath_lib)
|
||||
# copy application lib: (needed to lunch ...)
|
||||
file_src = self.get_build_file_dynamic(pkg_name)
|
||||
if os.path.isfile(file_src):
|
||||
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
|
||||
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
|
||||
tools.copy_file(file_src,
|
||||
os.path.join(target_outpath_lib, os.path.basename(file_src)),
|
||||
in_list=copy_list)
|
||||
# copy other if needed:
|
||||
if static == False:
|
||||
#copy all shared libs...
|
||||
#copy all shared libsh...
|
||||
debug.verbose("libs for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
@ -290,13 +251,14 @@ class Target(target.Target):
|
||||
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
|
||||
#copy all data:
|
||||
# TODO : We can have a problem when writing over library files ...
|
||||
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
tools.copy_file(file_src,
|
||||
os.path.join(target_outpath_lib, os.path.basename(file_src)),
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_lib != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_lib, copy_list)
|
||||
|
||||
pkg_name_application_name = pkg_name
|
||||
if self.config["mode"] == "debug":
|
||||
|
@ -83,29 +83,6 @@ class Target(target.Target):
|
||||
self.pkg_path_license = "license"
|
||||
|
||||
|
||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
#The package generated depend of the type of the element:
|
||||
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||
module = self.get_module(end_point_module_name)
|
||||
if module == None:
|
||||
debug.error("can not create package ... ");
|
||||
if module.get_type() == 'PREBUILD':
|
||||
#nothing to do ...
|
||||
return
|
||||
if module.get_type() == 'LIBRARY' \
|
||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||
or module.get_type() == 'LIBRARY_STATIC':
|
||||
debug.info("Can not create package for library");
|
||||
return
|
||||
if module.get_type() == 'BINARY' \
|
||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||
if module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
|
||||
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkg_name + "'")
|
||||
@ -115,38 +92,29 @@ class Target(target.Target):
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
if static == True:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
|
||||
else:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data)
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
path_src = self.get_build_path_data(heritage.name)
|
||||
debug.verbose(" has directory: " + path_src)
|
||||
if os.path.isdir(path_src):
|
||||
if static == True:
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(path_src, target_outpath_data, recursive=True, force_identical=True)
|
||||
else:
|
||||
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True)
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
copy_list={}
|
||||
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_bin)
|
||||
tools.create_directory_of_file(target_outpath_bin)
|
||||
path_src = self.get_build_file_bin(pkg_name)
|
||||
path_dst = os.path.join(target_outpath_bin, pkg_name + self.suffix_binary)
|
||||
debug.verbose("path_dst: " + str(path_dst))
|
||||
tools.copy_file(path_src, path_dst)
|
||||
tools.copy_file(path_src,
|
||||
path_dst,
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_bin != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_bin, copy_list)
|
||||
|
||||
## Create libraries:
|
||||
copy_list={}
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
if static == False:
|
||||
#copy all shred libs...
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
tools.create_directory_of_file(target_outpath_lib)
|
||||
debug.verbose("libs for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
@ -157,7 +125,14 @@ class Target(target.Target):
|
||||
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
|
||||
#copy all data:
|
||||
# TODO : We can have a problem when writing over library files ...
|
||||
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
|
||||
tools.copy_file(file_src,
|
||||
os.path.join(target_outpath_lib, os.path.basename(file_src)),
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_lib != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_lib, copy_list)
|
||||
|
||||
## Create icon:
|
||||
if "ICON" in pkg_properties.keys() \
|
||||
@ -184,111 +159,107 @@ class Target(target.Target):
|
||||
debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkg_properties["ICON"])
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small@2x.png"), 58, 58)
|
||||
|
||||
## Create the info file:
|
||||
debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
|
||||
infoFile = os.path.join(target_outpath, "PkgInfo")
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("APPL????")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "PkgInfo"),
|
||||
"APPL????",
|
||||
only_if_new=True)
|
||||
|
||||
## Create Info.plist (in XML mode)
|
||||
debug.print_element("pkg", "Info.plist", "<==", "Package properties")
|
||||
# http://www.sandroid.org/imcross/#Deployment
|
||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
dataFile += "<plist version=\"1.0\">\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>CFBundleDevelopmentRegion</key>\n"
|
||||
dataFile += " <string>en</string>\n"
|
||||
dataFile += " <key>CFBundleDisplayName</key>\n"
|
||||
dataFile += " <string>" + pkg_properties["NAME"] + "</string>\n"
|
||||
dataFile += " <key>CFBundleExecutable</key>\n"
|
||||
dataFile += " <string>" + pkg_name + "</string>\n"
|
||||
dataFile += " <key>CFBundleIdentifier</key>\n"
|
||||
dataFile += " <string>com." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
|
||||
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
data_file += "<plist version=\"1.0\">\n"
|
||||
data_file += " <dict>\n"
|
||||
data_file += " <key>CFBundleDevelopmentRegion</key>\n"
|
||||
data_file += " <string>en</string>\n"
|
||||
data_file += " <key>CFBundleDisplayName</key>\n"
|
||||
data_file += " <string>" + pkg_properties["NAME"] + "</string>\n"
|
||||
data_file += " <key>CFBundleExecutable</key>\n"
|
||||
data_file += " <string>" + pkg_name + "</string>\n"
|
||||
data_file += " <key>CFBundleIdentifier</key>\n"
|
||||
data_file += " <string>com." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
|
||||
|
||||
dataFile += " <key>CFBundleIconFiles</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>Icon-60@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-76.png</string>\n"
|
||||
dataFile += " <string>Icon-76@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-Small-40.png</string>\n"
|
||||
dataFile += " <string>Icon-Small-40@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-Small.png</string>\n"
|
||||
dataFile += " <string>Icon-Small@2x.png</string>\n"
|
||||
dataFile += " <string>iTunesArtwork.png</string>\n"
|
||||
dataFile += " <string>iTunesArtwork@2x.png</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
data_file += " <key>CFBundleIconFiles</key>\n"
|
||||
data_file += " <array>\n"
|
||||
data_file += " <string>Icon-60@2x.png</string>\n"
|
||||
data_file += " <string>Icon-76.png</string>\n"
|
||||
data_file += " <string>Icon-76@2x.png</string>\n"
|
||||
data_file += " <string>Icon-Small-40.png</string>\n"
|
||||
data_file += " <string>Icon-Small-40@2x.png</string>\n"
|
||||
data_file += " <string>Icon-Small.png</string>\n"
|
||||
data_file += " <string>Icon-Small@2x.png</string>\n"
|
||||
data_file += " <string>iTunesArtwork.png</string>\n"
|
||||
data_file += " <string>iTunesArtwork@2x.png</string>\n"
|
||||
data_file += " </array>\n"
|
||||
|
||||
dataFile += " <key>CFBundleInfoDictionaryVersion</key>\n"
|
||||
dataFile += " <string>6.0</string>\n"
|
||||
dataFile += " <key>CFBundleName</key>\n"
|
||||
dataFile += " <string>" + pkg_name + "</string>\n"
|
||||
dataFile += " <key>CFBundlePackageType</key>\n"
|
||||
dataFile += " <string>APPL</string>\n"
|
||||
dataFile += " <key>CFBundleSignature</key>\n"
|
||||
dataFile += " <string>????</string>\n"
|
||||
dataFile += " <key>CFBundleSupportedPlatforms</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>iPhoneSimulator</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " \n"
|
||||
dataFile += " <key>CFBundleShortVersionString</key>\n"
|
||||
dataFile += " <string>"+pkg_properties["VERSION"]+"</string>\n"
|
||||
dataFile += " <key>CFBundleVersion</key>\n"
|
||||
dataFile += " <string>"+pkg_properties["VERSION_CODE"]+"</string>\n"
|
||||
dataFile += " \n"
|
||||
dataFile += " <key>CFBundleResourceSpecification</key>\n"
|
||||
dataFile += " <string>ResourceRules.plist</string>\n"
|
||||
data_file += " <key>CFBundleInfoDictionaryVersion</key>\n"
|
||||
data_file += " <string>6.0</string>\n"
|
||||
data_file += " <key>CFBundleName</key>\n"
|
||||
data_file += " <string>" + pkg_name + "</string>\n"
|
||||
data_file += " <key>CFBundlePackageType</key>\n"
|
||||
data_file += " <string>APPL</string>\n"
|
||||
data_file += " <key>CFBundleSignature</key>\n"
|
||||
data_file += " <string>????</string>\n"
|
||||
data_file += " <key>CFBundleSupportedPlatforms</key>\n"
|
||||
data_file += " <array>\n"
|
||||
data_file += " <string>iPhoneSimulator</string>\n"
|
||||
data_file += " </array>\n"
|
||||
data_file += " \n"
|
||||
data_file += " <key>CFBundleShortVersionString</key>\n"
|
||||
data_file += " <string>"+pkg_properties["VERSION"]+"</string>\n"
|
||||
data_file += " <key>CFBundleVersion</key>\n"
|
||||
data_file += " <string>"+pkg_properties["VERSION_CODE"]+"</string>\n"
|
||||
data_file += " \n"
|
||||
data_file += " <key>CFBundleResourceSpecification</key>\n"
|
||||
data_file += " <string>ResourceRules.plist</string>\n"
|
||||
if self.sumulator == False:
|
||||
dataFile += " <key>LSRequiresIPhoneOS</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
data_file += " <key>LSRequiresIPhoneOS</key>\n"
|
||||
data_file += " <true/>\n"
|
||||
else:
|
||||
dataFile += " <key>DTPlatformName</key>\n"
|
||||
dataFile += " <string>iphonesimulator</string>\n"
|
||||
dataFile += " <key>DTSDKName</key>\n"
|
||||
dataFile += " <string>iphonesimulator7.0</string>\n"
|
||||
dataFile += " \n"
|
||||
dataFile += " <key>UIDeviceFamily</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <integer>1</integer>\n"
|
||||
dataFile += " <integer>2</integer>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " <key>UIRequiredDeviceCapabilities</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>armv7</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " <key>UIStatusBarHidden</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>UISupportedInterfaceOrientations</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " <key>UISupportedInterfaceOrientations~ipad</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
data_file += " <key>DTPlatformName</key>\n"
|
||||
data_file += " <string>iphonesimulator</string>\n"
|
||||
data_file += " <key>DTSDKName</key>\n"
|
||||
data_file += " <string>iphonesimulator7.0</string>\n"
|
||||
data_file += " \n"
|
||||
data_file += " <key>UIDeviceFamily</key>\n"
|
||||
data_file += " <array>\n"
|
||||
data_file += " <integer>1</integer>\n"
|
||||
data_file += " <integer>2</integer>\n"
|
||||
data_file += " </array>\n"
|
||||
data_file += " <key>UIRequiredDeviceCapabilities</key>\n"
|
||||
data_file += " <array>\n"
|
||||
data_file += " <string>armv7</string>\n"
|
||||
data_file += " </array>\n"
|
||||
data_file += " <key>UIStatusBarHidden</key>\n"
|
||||
data_file += " <true/>\n"
|
||||
data_file += " <key>UISupportedInterfaceOrientations</key>\n"
|
||||
data_file += " <array>\n"
|
||||
data_file += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||
data_file += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||
data_file += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||
data_file += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||
data_file += " </array>\n"
|
||||
data_file += " <key>UISupportedInterfaceOrientations~ipad</key>\n"
|
||||
data_file += " <array>\n"
|
||||
data_file += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||
data_file += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||
data_file += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||
data_file += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||
data_file += " </array>\n"
|
||||
data_file += " </dict>\n"
|
||||
data_file += "</plist>\n"
|
||||
data_file += "\n\n"
|
||||
tools.file_write_data(os.path.join(target_outpath, "Info.plist"),
|
||||
data_file,
|
||||
only_if_new=True)
|
||||
|
||||
infoFile = os.path.join(target_outpath, "Info.plist")
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
"""
|
||||
infoFile = self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.write(data_file)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
cmdLine = "builtin-infoPlistUtility "
|
||||
@ -319,57 +290,49 @@ class Target(target.Target):
|
||||
#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/projectName -o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app.dSYM
|
||||
|
||||
debug.print_element("pkg", "ResourceRules.plist", "<==", "Resources autorisation")
|
||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
dataFile += "<plist version=\"1.0\">\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>rules</key>\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>.*</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>Info.plist</key>\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>omit</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>weight</key>\n"
|
||||
dataFile += " <real>10</real>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += " <key>ResourceRules.plist</key>\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>omit</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>weight</key>\n"
|
||||
dataFile += " <real>100</real>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = os.path.join(target_outpath, "ResourceRules.plist")
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
data_file += "<plist version=\"1.0\">\n"
|
||||
data_file += " <dict>\n"
|
||||
data_file += " <key>rules</key>\n"
|
||||
data_file += " <dict>\n"
|
||||
data_file += " <key>.*</key>\n"
|
||||
data_file += " <true/>\n"
|
||||
data_file += " <key>Info.plist</key>\n"
|
||||
data_file += " <dict>\n"
|
||||
data_file += " <key>omit</key>\n"
|
||||
data_file += " <true/>\n"
|
||||
data_file += " <key>weight</key>\n"
|
||||
data_file += " <real>10</real>\n"
|
||||
data_file += " </dict>\n"
|
||||
data_file += " <key>ResourceRules.plist</key>\n"
|
||||
data_file += " <dict>\n"
|
||||
data_file += " <key>omit</key>\n"
|
||||
data_file += " <true/>\n"
|
||||
data_file += " <key>weight</key>\n"
|
||||
data_file += " <real>100</real>\n"
|
||||
data_file += " </dict>\n"
|
||||
data_file += " </dict>\n"
|
||||
data_file += " </dict>\n"
|
||||
data_file += "</plist>\n"
|
||||
data_file += "\n\n"
|
||||
tools.file_write_data(os.path.join(target_outpath, "ResourceRules.plist"),
|
||||
data_file,
|
||||
only_if_new=True)
|
||||
|
||||
debug.print_element("pkg", "Entitlements.plist", "<==", "application mode")
|
||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
dataFile += "<plist version=\"1.0\">\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>get-task-allow</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = os.path.join(target_outpath, "Entitlements.plist")
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
data_file += "<plist version=\"1.0\">\n"
|
||||
data_file += " <dict>\n"
|
||||
data_file += " <key>get-task-allow</key>\n"
|
||||
data_file += " <true/>\n"
|
||||
data_file += " </dict>\n"
|
||||
data_file += "</plist>\n"
|
||||
data_file += "\n\n"
|
||||
tools.file_write_data(os.path.join(target_outpath, "Entitlements.plist"),
|
||||
data_file,
|
||||
only_if_new=True)
|
||||
|
||||
# Simulateur path :
|
||||
#~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Applications/
|
||||
|
@ -43,36 +43,6 @@ class Target(target.Target):
|
||||
self.pkg_path_lib = "lib"
|
||||
self.pkg_path_license = "license"
|
||||
|
||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, type="generic"):
|
||||
#The package generated depend of the type of the element:
|
||||
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||
module = self.get_module(end_point_module_name)
|
||||
if module == None:
|
||||
debug.error("can not create package ... ");
|
||||
if module.get_type() == 'PREBUILD':
|
||||
#nothing to do ...
|
||||
return
|
||||
if module.get_type() == 'LIBRARY' \
|
||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||
or module.get_type() == 'LIBRARY_STATIC':
|
||||
debug.info("Can not create package for library");
|
||||
return
|
||||
if module.get_type() == 'BINARY' \
|
||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||
if module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
return
|
||||
return
|
||||
|
||||
if type == "debian":
|
||||
self.make_package_debian(pkg_name, pkg_properties, base_pkg_path, heritage_list)
|
||||
elif type == "generic":
|
||||
self.make_package_generic(pkg_name, pkg_properties, base_pkg_path, heritage_list)
|
||||
|
||||
|
||||
"""
|
||||
.local/application
|
||||
*--> applName -> applName.app/bin/applName
|
||||
@ -112,40 +82,7 @@ class Target(target.Target):
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
target_shared_path = os.path.join(target_outpath, self.pkg_path_data)
|
||||
if static == True:
|
||||
target_outpath_data = os.path.join(target_shared_path, pkg_name)
|
||||
else:
|
||||
target_outpath_data = target_shared_path
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
# prepare list of copy files
|
||||
copy_list={}
|
||||
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
path_src = self.get_build_path_data(heritage.name)
|
||||
debug.verbose(" has directory: " + path_src)
|
||||
if os.path.isdir(path_src):
|
||||
if static == True:
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(path_src,
|
||||
target_outpath_data,
|
||||
recursive=True,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
else:
|
||||
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(os.path.dirname(path_src),
|
||||
target_outpath_data,
|
||||
recursive=True,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_shared_path, copy_list)
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
copy_list={}
|
||||
@ -159,12 +96,15 @@ class Target(target.Target):
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_bin != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_bin, copy_list)
|
||||
|
||||
## Create libraries:
|
||||
copy_list={}
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
if static == False:
|
||||
#copy all shred libs...
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
tools.create_directory_of_file(target_outpath_lib)
|
||||
debug.verbose("libs for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
@ -180,68 +120,64 @@ class Target(target.Target):
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_lib != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_lib, copy_list)
|
||||
|
||||
## Create version file:
|
||||
tmpFile = open(target_outpath + "/version.txt", 'w')
|
||||
tmpFile.write(pkg_properties["VERSION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "version.txt"),
|
||||
pkg_properties["VERSION"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create maintainer file:
|
||||
tmpFile = open(target_outpath + "/maintainer.txt", 'w')
|
||||
tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"]))
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "maintainer.txt"),
|
||||
self.generate_list_separate_coma(pkg_properties["MAINTAINER"]),
|
||||
only_if_new=True)
|
||||
|
||||
## Create appl_name file:
|
||||
tmpFile = open(target_outpath + "/appl_name.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkg_properties["NAME"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "appl_name.txt"),
|
||||
"en_EN:" + pkg_properties["NAME"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create appl_description file:
|
||||
tmpFile = open(target_outpath + "/appl_description.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "appl_description.txt"),
|
||||
"en_EN:" + pkg_properties["DESCRIPTION"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create Readme file:
|
||||
readmeFileDest = target_outpath + "/readme.txt"
|
||||
readme_file_dest = os.path.join(target_outpath, "readme.txt")
|
||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readme_file_dest)
|
||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
||||
tools.copy_file(base_pkg_path + "/README", readme_file_dest)
|
||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
||||
tools.copy_file(base_pkg_path + "/README.md", readme_file_dest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
tmpFile.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(readme_file_dest,
|
||||
"No documentation for " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
|
||||
## Create licence file:
|
||||
licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt")
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
license_file_dest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt")
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest)
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(licenseFileDest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(license_file_dest,
|
||||
"No license define by the developper for " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
|
||||
## Create changeLog file:
|
||||
changeLogFileDest = target_outpath + "/changelog.txt"
|
||||
change_log_file_dest = target_outpath + "/changelog.txt"
|
||||
if os.path.exists(base_pkg_path + "/changelog") == True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(change_log_file_dest,
|
||||
"No changelog data " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg")
|
||||
@ -249,7 +185,9 @@ class Target(target.Target):
|
||||
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def make_package_debian(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
@ -306,24 +244,24 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## licence file
|
||||
licenseFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest)
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(licenseFileDest, 'w')
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
changeLogFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
||||
tools.create_directory_of_file(changeLogFileDest)
|
||||
change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
||||
tools.create_directory_of_file(change_log_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/changelog")==True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
@ -420,23 +358,23 @@ class Target(target.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create licence file
|
||||
licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".txt"
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
license_file_dest = target_outpath + "/license/"+ debianpkg_name + ".txt"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest)
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(licenseFileDest, 'w')
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create changeLog file
|
||||
changeLogFileDest = target_outpath + "/changelog.txt"
|
||||
change_log_file_dest = target_outpath + "/changelog.txt"
|
||||
if os.path.exists(base_pkg_path + "/changelog") == True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
@ -53,29 +53,6 @@ class Target(target.Target):
|
||||
return self.get_staging_path(binary_name) + self.path_data + "/"
|
||||
"""
|
||||
|
||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
#The package generated depend of the type of the element:
|
||||
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||
module = self.get_module(end_point_module_name)
|
||||
if module == None:
|
||||
debug.error("can not create package ... ");
|
||||
if module.get_type() == 'PREBUILD':
|
||||
#nothing to do ...
|
||||
return
|
||||
if module.get_type() == 'LIBRARY' \
|
||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||
or module.get_type() == 'LIBRARY_STATIC':
|
||||
debug.info("Can not create package for library");
|
||||
return
|
||||
if module.get_type() == 'BINARY' \
|
||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||
if module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
|
||||
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkg_name + "'")
|
||||
@ -85,38 +62,27 @@ class Target(target.Target):
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
if static == True:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
|
||||
else:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data)
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
path_src = self.get_build_path_data(heritage.name)
|
||||
debug.verbose(" has directory: " + path_src)
|
||||
if os.path.isdir(path_src):
|
||||
if static == True:
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(path_src, target_outpath_data, recursive=True, force_identical=True)
|
||||
else:
|
||||
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True)
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
copy_list={}
|
||||
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_bin)
|
||||
tools.create_directory_of_file(target_outpath_bin)
|
||||
path_src = self.get_build_file_bin(pkg_name)
|
||||
path_dst = os.path.join(target_outpath_bin, pkg_name + self.suffix_binary)
|
||||
debug.verbose("path_dst: " + str(path_dst))
|
||||
tools.copy_file(path_src, path_dst)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_bin != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_bin, copy_list)
|
||||
|
||||
## Create libraries:
|
||||
copy_list={}
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
if static == False:
|
||||
#copy all shred libs...
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
tools.create_directory_of_file(target_outpath_lib)
|
||||
debug.verbose("libs for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
@ -127,7 +93,14 @@ class Target(target.Target):
|
||||
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
|
||||
#copy all data:
|
||||
# TODO : We can have a problem when writing over library files ...
|
||||
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
|
||||
tools.copy_file(file_src,
|
||||
os.path.join(target_outpath_lib, os.path.basename(file_src)),
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_lib != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_bin, copy_list)
|
||||
|
||||
## Create icon (no convertion ==> TODO: must test if png is now supported):
|
||||
if "ICON" in pkg_properties.keys() \
|
||||
@ -136,48 +109,40 @@ class Target(target.Target):
|
||||
|
||||
## Create info.plist file:
|
||||
# http://www.sandroid.org/imcross/#Deployment
|
||||
infoFile = os.path.join(target_outpath, "Info.plist")
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
|
||||
tmpFile.write("<plist version=\"1.0\">\n")
|
||||
tmpFile.write(" <dict>\n")
|
||||
tmpFile.write(" <key>CFBundleExecutableFile</key>\n")
|
||||
tmpFile.write(" <string>"+pkg_name+"</string>\n")
|
||||
tmpFile.write(" <key>CFBundleName</key>\n")
|
||||
tmpFile.write(" <string>"+pkg_name+"</string>\n")
|
||||
tmpFile.write(" <key>CFBundleIdentifier</key>\n")
|
||||
tmpFile.write(" <string>" + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
tmpFile.write(" <key>CFBundleSignature</key>\n")
|
||||
tmpFile.write(" <string>????</string>\n")
|
||||
tmpFile.write(" <key>CFBundleIconFile</key>\n")
|
||||
tmpFile.write(" <string>icon.icns</string>\n")
|
||||
tmpFile.write(" </dict>\n")
|
||||
tmpFile.write("</plist>\n")
|
||||
tmpFile.write("\n\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
data_file += "<plist version=\"1.0\">\n"
|
||||
data_file += " <dict>\n"
|
||||
data_file += " <key>CFBundleExecutableFile</key>\n"
|
||||
data_file += " <string>"+pkg_name+"</string>\n"
|
||||
data_file += " <key>CFBundleName</key>\n"
|
||||
data_file += " <string>"+pkg_name+"</string>\n"
|
||||
data_file += " <key>CFBundleIdentifier</key>\n"
|
||||
data_file += " <string>" + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
|
||||
data_file += " <key>CFBundleSignature</key>\n"
|
||||
data_file += " <string>????</string>\n"
|
||||
data_file += " <key>CFBundleIconFile</key>\n"
|
||||
data_file += " <string>icon.icns</string>\n"
|
||||
data_file += " </dict>\n"
|
||||
data_file += "</plist>\n"
|
||||
data_file += "\n\n"
|
||||
tools.file_write_data(os.path.join(target_outpath, "Info.plist"),
|
||||
data_file,
|
||||
only_if_new=True)
|
||||
|
||||
## Create PkgInfo file:
|
||||
infoFile=os.path.join(target_outpath, "PkgInfo")
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("APPL????")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "PkgInfo"),
|
||||
"APPL????",
|
||||
only_if_new=True)
|
||||
|
||||
## Create a simple interface to localy install the aplication for the shell (a shell command line interface):
|
||||
shell_file_name = os.path.join(target_outpath, "shell", pkg_name)
|
||||
# Create the info file
|
||||
tools.create_directory_of_file(shell_file_name)
|
||||
tmpFile = open(shell_file_name, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("# Simply open the real application in the correct way (a link does not work ...)\n")
|
||||
tmpFile.write("/Applications/" + pkg_name + ".app/Contents/MacOS/" + pkg_name + " $*\n")
|
||||
data_file = "#!/bin/bash\n"
|
||||
data_file += "# Simply open the real application in the correct way (a link does not work ...)\n"
|
||||
data_file += "/Applications/" + pkg_name + ".app/Contents/MacOS/" + pkg_name + " $*\n"
|
||||
#tmpFile.write("open -n /Applications/edn.app --args -AppCommandLineArg $*\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "shell", pkg_name),
|
||||
data_file,
|
||||
only_if_new=True)
|
||||
|
||||
## Create the disk image of the application:
|
||||
debug.info("Generate disk image for '" + pkg_name + "'")
|
||||
|
@ -70,30 +70,6 @@ class Target(target.Target):
|
||||
def get_staging_path_data(self, binary_name, heritage_list):
|
||||
return self.get_staging_path(binary_name) + self.path_data
|
||||
|
||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
#The package generated depend of the type of the element:
|
||||
end_point_module_name = heritage_list.list_heritage[-1].name
|
||||
module = self.get_module(end_point_module_name)
|
||||
if module == None:
|
||||
debug.error("can not create package ... ");
|
||||
if module.get_type() == 'PREBUILD':
|
||||
#nothing to do ...
|
||||
return
|
||||
if module.get_type() == 'LIBRARY' \
|
||||
or module.get_type() == 'LIBRARY_DYNAMIC' \
|
||||
or module.get_type() == 'LIBRARY_STATIC':
|
||||
debug.info("Can not create package for library");
|
||||
return
|
||||
if module.get_type() == 'BINARY' \
|
||||
or module.get_type() == 'BINARY_STAND_ALONE':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
|
||||
if module.get_type() == 'BINARY_SHARED':
|
||||
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
return
|
||||
return
|
||||
|
||||
def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkg_name + "'")
|
||||
@ -103,95 +79,103 @@ class Target(target.Target):
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
if static == True:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
|
||||
else:
|
||||
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data)
|
||||
tools.create_directory_of_file(target_outpath_data)
|
||||
debug.debug("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
path_src = self.get_build_path_data(heritage.name)
|
||||
debug.verbose(" has directory: " + path_src)
|
||||
if os.path.isdir(path_src):
|
||||
if static == True:
|
||||
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(path_src, target_outpath_data, recursive=True, force_identical=True)
|
||||
else:
|
||||
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
|
||||
#copy all data:
|
||||
tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True)
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
copy_list={}
|
||||
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_bin)
|
||||
tools.create_directory_of_file(target_outpath_bin)
|
||||
path_src = self.get_build_file_bin(pkg_name)
|
||||
path_dst = os.path.join(target_outpath_bin, pkg_name + self.suffix_binary)
|
||||
debug.verbose("path_dst: " + str(path_dst))
|
||||
tools.copy_file(path_src, path_dst)
|
||||
tools.copy_file(path_src,
|
||||
path_dst,
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_bin != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_bin, copy_list)
|
||||
|
||||
## Create libraries:
|
||||
copy_list={}
|
||||
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
|
||||
if static == False:
|
||||
#copy all shred libs...
|
||||
tools.create_directory_of_file(target_outpath_lib)
|
||||
debug.verbose("libs for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.debug("sub elements: " + str(heritage.name))
|
||||
file_src = self.get_build_file_dynamic(heritage.name)
|
||||
debug.verbose(" has directory: " + file_src)
|
||||
if os.path.isfile(file_src):
|
||||
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
|
||||
#copy all data:
|
||||
# TODO : We can have a problem when writing over library files ...
|
||||
tools.copy_file(file_src,
|
||||
os.path.join(target_outpath_lib, os.path.basename(file_src)),
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
if self.pkg_path_lib != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
tools.clean_directory(target_outpath_lib, copy_list)
|
||||
|
||||
## Create version file:
|
||||
tmpFile = open(target_outpath + "/version.txt", 'w')
|
||||
tmpFile.write(pkg_properties["VERSION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "version.txt"),
|
||||
pkg_properties["VERSION"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create maintainer file:
|
||||
tmpFile = open(target_outpath + "/maintainer.txt", 'w')
|
||||
tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"]))
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "maintainer.txt"),
|
||||
self.generate_list_separate_coma(pkg_properties["MAINTAINER"]),
|
||||
only_if_new=True)
|
||||
|
||||
## Create appl_name file:
|
||||
tmpFile = open(target_outpath + "/appl_name.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkg_properties["NAME"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "appl_name.txt"),
|
||||
"en_EN:" + pkg_properties["NAME"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create appl_description file:
|
||||
tmpFile = open(target_outpath + "/appl_description.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(os.path.join(target_outpath, "appl_description.txt"),
|
||||
"en_EN:" + pkg_properties["DESCRIPTION"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create Readme file:
|
||||
readmeFileDest = target_outpath + "/readme.txt"
|
||||
readme_file_dest = target_outpath + "/readme.txt"
|
||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readme_file_dest)
|
||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
||||
tools.copy_file(base_pkg_path + "/README", readme_file_dest)
|
||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
||||
tools.copy_file(base_pkg_path + "/README.md", readme_file_dest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
tmpFile.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(readme_file_dest,
|
||||
"No documentation for " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
|
||||
## Create licence file:
|
||||
licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt")
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
license_file_dest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt")
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest)
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(licenseFileDest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tools.file_write_data(license_file_dest,
|
||||
"No license define by the developper for " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
|
||||
## Create changeLog file:
|
||||
changeLogFileDest = target_outpath + "/changelog.txt"
|
||||
change_log_file_dest = target_outpath + "/changelog.txt"
|
||||
if os.path.exists(base_pkg_path + "/changelog") == True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
tools.file_write_data(change_log_file_dest,
|
||||
"No changelog data " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
|
||||
|
||||
def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
|
Loading…
x
Reference in New Issue
Block a user