[DEV] zip data for windows and create a zip package for final output
This commit is contained in:
parent
092843cd02
commit
71e0f242bf
@ -780,6 +780,7 @@ class Target:
|
||||
## @param[in] static The package is build in static mode
|
||||
##
|
||||
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
debug.debug("make_package [START]")
|
||||
#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)
|
||||
@ -801,6 +802,7 @@ class Target:
|
||||
if module.get_type() == 'PACKAGE':
|
||||
debug.info("Can not create package for package");
|
||||
return
|
||||
debug.debug("make_package [STOP]")
|
||||
return
|
||||
|
||||
##
|
||||
@ -813,6 +815,7 @@ class Target:
|
||||
## @return False Nothing has been copied
|
||||
##
|
||||
def make_package_binary_data(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
|
||||
debug.debug("make_package_binary_data [START]")
|
||||
target_shared_path = os.path.join(path_package, self.pkg_path_data)
|
||||
if static == True:
|
||||
path_package_data = os.path.join(target_shared_path, pkg_name)
|
||||
@ -847,6 +850,7 @@ class Target:
|
||||
ret_copy = tools.copy_list(copy_list)
|
||||
# remove unneded files (NOT folder ...)
|
||||
ret_remove = tools.clean_directory(target_shared_path, copy_list)
|
||||
debug.debug("make_package_binary_data [STOP]")
|
||||
return ret_copy or ret_remove
|
||||
|
||||
##
|
||||
@ -859,6 +863,7 @@ class Target:
|
||||
## @return False Nothing has been copied
|
||||
##
|
||||
def make_package_binary_bin(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
|
||||
debug.debug("make_package_binary_bin [START]")
|
||||
copy_list={}
|
||||
path_package_bin = os.path.join(path_package, self.pkg_path_bin)
|
||||
tools.create_directory_of_file(path_package_bin)
|
||||
@ -874,6 +879,7 @@ class Target:
|
||||
if self.pkg_path_bin != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
ret_remove = tools.clean_directory(path_package_bin, copy_list)
|
||||
debug.debug("make_package_binary_bin [STOP]")
|
||||
return ret_copy or ret_remove
|
||||
|
||||
##
|
||||
@ -886,6 +892,7 @@ class Target:
|
||||
## @return False Nothing has been copied
|
||||
##
|
||||
def make_package_binary_lib(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
|
||||
debug.debug("make_package_binary_lib [START]")
|
||||
copy_list={}
|
||||
path_package_lib = os.path.join(path_package, self.pkg_path_lib)
|
||||
if static == False:
|
||||
@ -909,10 +916,12 @@ class Target:
|
||||
if self.pkg_path_lib != "":
|
||||
# remove unneded files (NOT folder ...)
|
||||
ret_remove = tools.clean_directory(path_package_lib, copy_list)
|
||||
debug.debug("make_package_binary_lib [STOP]")
|
||||
return ret_copy or ret_remove
|
||||
|
||||
|
||||
def make_package_generic_files(self, path_package, pkg_properties, pkg_name, base_pkg_path, heritage_list, static):
|
||||
debug.debug("make_package_generic_files [START]")
|
||||
## Create version file:
|
||||
ret_version = tools.file_write_data(os.path.join(path_package, self.pkg_path_version_file),
|
||||
tools.version_to_string(pkg_properties["VERSION"]),
|
||||
@ -973,6 +982,7 @@ class Target:
|
||||
ret_changelog = tools.file_write_data(change_log_file_dest,
|
||||
"No changelog data " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
debug.debug("make_package_generic_files [STOP]")
|
||||
return ret_version \
|
||||
or ret_maintainer \
|
||||
or ret_appl_name \
|
||||
|
@ -63,100 +63,115 @@ class Target(lutinTarget_Linux.Target):
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create libraries:
|
||||
self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create generic files:
|
||||
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
"""
|
||||
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## end of the package generation
|
||||
build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
|
||||
#Check date between the current file "list of action to generate package and the end of package generation
|
||||
need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg")
|
||||
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||
#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_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
"""
|
||||
self.get_staging_path(pkg_name)
|
||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
||||
tmpFile.write("Version: " + tools.version_to_string(pkg_properties["VERSION"]) + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
||||
if pkg_name != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
||||
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")
|
||||
if ret_share \
|
||||
or ret_bin \
|
||||
or ret_lib \
|
||||
or ret_file \
|
||||
or need_generate_package:
|
||||
"""
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg")
|
||||
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||
#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_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
"""
|
||||
self.get_staging_path(pkg_name)
|
||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
||||
tmpFile.write("Version: " + tools.version_to_string(pkg_properties["VERSION"]) + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## licence file
|
||||
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", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
||||
if pkg_name != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
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", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
||||
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()
|
||||
## licence file
|
||||
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", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
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", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
# package is done corectly ...
|
||||
tools.file_write_data(build_package_path_done, "done...")
|
||||
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@ -105,264 +105,277 @@ class Target(target.Target):
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create libraries:
|
||||
self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create generic files:
|
||||
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create icon:
|
||||
if "ICON" in pkg_properties.keys() \
|
||||
and pkg_properties["ICON"] != "":
|
||||
# Resize all icon needed for Ios ...
|
||||
# TODO : Do not regenerate if source resource is not availlable
|
||||
# TODO : Add a colored background ...
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork.png"), 512, 512)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork@2x.png"), 1024, 1024)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-60@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-60@2x.png"), 120, 120)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76.png"), 76, 76)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76@2x.png"), 152, 152)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40.png"), 40, 40)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40@2x.png"), 80, 80)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small.png"), 29, 29)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small@2x.png"), 58, 58)
|
||||
## end of the package generation
|
||||
build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
|
||||
#Check date between the current file "list of action to generate package and the end of package generation
|
||||
need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
|
||||
|
||||
## Create the info file:
|
||||
debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
|
||||
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
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
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>"+tools.version_to_string(pkg_properties["VERSION"])+"</string>\n"
|
||||
data_file += " <key>CFBundleVersion</key>\n"
|
||||
data_file += " <string>"+str(pkg_properties["VERSION_CODE"])+"</string>\n"
|
||||
data_file += " \n"
|
||||
data_file += " <key>CFBundleResourceSpecification</key>\n"
|
||||
data_file += " <string>ResourceRules.plist</string>\n"
|
||||
if self.get_simulation() == False:
|
||||
data_file += " <key>LSRequiresIPhoneOS</key>\n"
|
||||
## create the package:
|
||||
if ret_share \
|
||||
or ret_bin \
|
||||
or ret_lib \
|
||||
or ret_file \
|
||||
or need_generate_package:
|
||||
## Create icon:
|
||||
if "ICON" in pkg_properties.keys() \
|
||||
and pkg_properties["ICON"] != "":
|
||||
# Resize all icon needed for Ios ...
|
||||
# TODO : Do not regenerate if source resource is not availlable
|
||||
# TODO : Add a colored background ...
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork.png"), 512, 512)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork@2x.png"), 1024, 1024)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-60@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-60@2x.png"), 120, 120)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76.png"), 76, 76)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76@2x.png"), 152, 152)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40.png"), 40, 40)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40@2x.png"), 80, 80)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small.png"), 29, 29)
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small@2x.png")
|
||||
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????")
|
||||
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
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
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>"+tools.version_to_string(pkg_properties["VERSION"])+"</string>\n"
|
||||
data_file += " <key>CFBundleVersion</key>\n"
|
||||
data_file += " <string>"+str(pkg_properties["VERSION_CODE"])+"</string>\n"
|
||||
data_file += " \n"
|
||||
data_file += " <key>CFBundleResourceSpecification</key>\n"
|
||||
data_file += " <string>ResourceRules.plist</string>\n"
|
||||
if self.get_simulation() == False:
|
||||
data_file += " <key>LSRequiresIPhoneOS</key>\n"
|
||||
data_file += " <true/>\n"
|
||||
else:
|
||||
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"
|
||||
else:
|
||||
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 = self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(data_file)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
cmdLine = "builtin-infoPlistUtility "
|
||||
cmdLine += " " + self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist "
|
||||
cmdLine += " -genpkginfo " + self.get_staging_path(pkg_name) + "/PkgInfo"
|
||||
cmdLine += " -expandbuildsettings "
|
||||
cmdLine += " -format binary "
|
||||
if self.get_simulation() == False:
|
||||
cmdLine += " -platform iphonesimulator "
|
||||
else:
|
||||
cmdLine += " -platform iphoneos "
|
||||
cmdLine += " -o " + self.get_staging_path(pkg_name) + "/" + "Info.plist"
|
||||
multiprocess.run_command(cmdLine)
|
||||
"""
|
||||
"""
|
||||
|
||||
/Users/edouarddupin/dev/exampleProjectXcode/projectName/projectName/projectName-Info.plist
|
||||
-genpkginfo
|
||||
/Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/PkgInfo
|
||||
-expandbuildsettings
|
||||
-format binary
|
||||
-platform iphonesimulator
|
||||
-additionalcontentfile /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Intermediates/projectName.build/Debug-iphonesimulator/projectName.build/assetcatalog_generated_info.plist
|
||||
-o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/Info.plist
|
||||
-additionalcontentfile /Users/edouarddupin/Library/Developer/Xcode/DerivedData/zdzdzd-bjuyukzpzhnyerdmxohjyuxfdllv/Build/Intermediates/zdzdzd.build/Debug-iphoneos/zdzdzd.build/assetcatalog_generated_info.plist -o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/zdzdzd-bjuyukzpzhnyerdmxohjyuxfdllv/Build/Products/Debug-iphoneos/zdzdzd.app/Info.plist
|
||||
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)
|
||||
|
||||
"""
|
||||
#/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")
|
||||
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")
|
||||
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/
|
||||
# must have a 'uuidgen' UID generate value with this elemennt ...
|
||||
# get the bundle path : ==> maybe usefull in MocOS ...
|
||||
# NSLog(@"%@",[[NSBundle mainBundle] bundlePath]);
|
||||
|
||||
# Must create the tarball of the application
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
|
||||
if self.get_simulation() == False:
|
||||
if "APPLE_APPLICATION_IOS_ID" not in pkg_properties:
|
||||
pkg_properties["APPLE_APPLICATION_IOS_ID"] = "00000000"
|
||||
debug.warning("Missing package property : APPLE_APPLICATION_IOS_ID USE " + pkg_properties["APPLE_APPLICATION_IOS_ID"] + " ID ... ==> CAN NOT WORK ..." )
|
||||
infoFile = self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(os.path.join(self.get_build_path(pkg_name), pkg_name + ".xcent"), 'w')
|
||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple//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>application-identifier</key>\n")
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
tmpFile.write(" <key>get-task-allow</key>\n")
|
||||
tmpFile.write(" <true/>\n")
|
||||
tmpFile.write(" <key>keychain-access-groups</key>\n")
|
||||
tmpFile.write(" <array>\n")
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
tmpFile.write(" </array>\n")
|
||||
tmpFile.write(" </dict>\n")
|
||||
tmpFile.write("</plist>\n")
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(data_file)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
# application signing :
|
||||
debug.print_element("pkg(signed)", "pkg", "<==", "Signing application")
|
||||
iosDevelopperKeyFile = ".iosKey.txt"
|
||||
if tools.file_size(iosDevelopperKeyFile) < 10:
|
||||
debug.warning("To sign an application we need to have a signing key in the file '" + iosDevelopperKeyFile + "' \n it is represented like: 'iPhone Developer: Francis DUGENOUX (YRRQE5KGTH)'\n you can obtain it with : 'certtool y | grep \"Developer\"'")
|
||||
debug.warning("Can not be install ... not runnable")
|
||||
cmdLine = "builtin-infoPlistUtility "
|
||||
cmdLine += " " + self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist "
|
||||
cmdLine += " -genpkginfo " + self.get_staging_path(pkg_name) + "/PkgInfo"
|
||||
cmdLine += " -expandbuildsettings "
|
||||
cmdLine += " -format binary "
|
||||
if self.get_simulation() == False:
|
||||
cmdLine += " -platform iphonesimulator "
|
||||
else:
|
||||
signatureKey = tools.file_read_data(iosDevelopperKeyFile)
|
||||
signatureKey = re.sub('\n', '', signatureKey)
|
||||
cmdLine = 'codesign --force --sign '
|
||||
# to get this key ; certtool y | grep "Developer"
|
||||
cmdLine += ' "' + signatureKey + '" '
|
||||
cmdLine += ' --entitlements ' + os.path.join(self.get_build_path(pkg_name), pkg_name + ".xcent")
|
||||
cmdLine += ' ' + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
cmdLine += " -platform iphoneos "
|
||||
cmdLine += " -o " + self.get_staging_path(pkg_name) + "/" + "Info.plist"
|
||||
multiprocess.run_command(cmdLine)
|
||||
"""
|
||||
"""
|
||||
|
||||
/Users/edouarddupin/dev/exampleProjectXcode/projectName/projectName/projectName-Info.plist
|
||||
-genpkginfo
|
||||
/Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/PkgInfo
|
||||
-expandbuildsettings
|
||||
-format binary
|
||||
-platform iphonesimulator
|
||||
-additionalcontentfile /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Intermediates/projectName.build/Debug-iphonesimulator/projectName.build/assetcatalog_generated_info.plist
|
||||
-o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/Info.plist
|
||||
-additionalcontentfile /Users/edouarddupin/Library/Developer/Xcode/DerivedData/zdzdzd-bjuyukzpzhnyerdmxohjyuxfdllv/Build/Intermediates/zdzdzd.build/Debug-iphoneos/zdzdzd.build/assetcatalog_generated_info.plist -o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/zdzdzd-bjuyukzpzhnyerdmxohjyuxfdllv/Build/Products/Debug-iphoneos/zdzdzd.app/Info.plist
|
||||
|
||||
"""
|
||||
#/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")
|
||||
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")
|
||||
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/
|
||||
# must have a 'uuidgen' UID generate value with this elemennt ...
|
||||
# get the bundle path : ==> maybe usefull in MocOS ...
|
||||
# NSLog(@"%@",[[NSBundle mainBundle] bundlePath]);
|
||||
|
||||
# Must create the tarball of the application
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
|
||||
if self.get_simulation() == False:
|
||||
if "APPLE_APPLICATION_IOS_ID" not in pkg_properties:
|
||||
pkg_properties["APPLE_APPLICATION_IOS_ID"] = "00000000"
|
||||
debug.warning("Missing package property : APPLE_APPLICATION_IOS_ID USE " + pkg_properties["APPLE_APPLICATION_IOS_ID"] + " ID ... ==> CAN NOT WORK ..." )
|
||||
# Create the info file
|
||||
tmpFile = open(os.path.join(self.get_build_path(pkg_name), pkg_name + ".xcent"), 'w')
|
||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple//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>application-identifier</key>\n")
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
tmpFile.write(" <key>get-task-allow</key>\n")
|
||||
tmpFile.write(" <true/>\n")
|
||||
tmpFile.write(" <key>keychain-access-groups</key>\n")
|
||||
tmpFile.write(" <array>\n")
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
tmpFile.write(" </array>\n")
|
||||
tmpFile.write(" </dict>\n")
|
||||
tmpFile.write("</plist>\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
# application signing :
|
||||
debug.print_element("pkg(signed)", "pkg", "<==", "Signing application")
|
||||
iosDevelopperKeyFile = ".iosKey.txt"
|
||||
if tools.file_size(iosDevelopperKeyFile) < 10:
|
||||
debug.warning("To sign an application we need to have a signing key in the file '" + iosDevelopperKeyFile + "' \n it is represented like: 'iPhone Developer: Francis DUGENOUX (YRRQE5KGTH)'\n you can obtain it with : 'certtool y | grep \"Developer\"'")
|
||||
debug.warning("Can not be install ... not runnable")
|
||||
else:
|
||||
signatureKey = tools.file_read_data(iosDevelopperKeyFile)
|
||||
signatureKey = re.sub('\n', '', signatureKey)
|
||||
cmdLine = 'codesign --force --sign '
|
||||
# to get this key ; certtool y | grep "Developer"
|
||||
cmdLine += ' "' + signatureKey + '" '
|
||||
cmdLine += ' --entitlements ' + os.path.join(self.get_build_path(pkg_name), pkg_name + ".xcent")
|
||||
cmdLine += ' ' + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
multiprocess.run_command(cmdLine)
|
||||
# package is done corectly ...
|
||||
tools.file_write_data(build_package_path_done, "done...")
|
||||
|
||||
def create_random_number(self, len):
|
||||
out = ""
|
||||
for iii in range(0,len):
|
||||
|
@ -103,16 +103,24 @@ class Target(target.Target):
|
||||
## Create generic files:
|
||||
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## end of the package generation
|
||||
build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
|
||||
#Check date between the current file "list of action to generate package and the end of package generation
|
||||
need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
|
||||
|
||||
## create the package:
|
||||
if ret_share \
|
||||
or ret_bin \
|
||||
or ret_lib \
|
||||
or ret_file:
|
||||
or ret_file \
|
||||
or need_generate_package:
|
||||
debug.debug("package : " + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.pkg"))
|
||||
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||
#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(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg"))
|
||||
# package is done corectly ...
|
||||
tools.file_write_data(build_package_path_done, "done...")
|
||||
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@ -71,73 +71,86 @@ class Target(target.Target):
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create libraries:
|
||||
self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create generic files:
|
||||
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create icon (no convertion ==> TODO: must test if png is now supported):
|
||||
if "ICON" in pkg_properties.keys() \
|
||||
and pkg_properties["ICON"] != "":
|
||||
tools.copy_file(pkg_properties["ICON"], os.path.join(target_outpath, "icon.icns"), force=True)
|
||||
## end of the package generation
|
||||
build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
|
||||
#Check date between the current file "list of action to generate package and the end of package generation
|
||||
need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
|
||||
|
||||
## Create info.plist file:
|
||||
# http://www.sandroid.org/imcross/#Deployment
|
||||
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:
|
||||
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):
|
||||
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"
|
||||
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 + "'")
|
||||
output_file_name = os.path.join(self.get_final_path(), pkg_name + ".dmg")
|
||||
cmd = "hdiutil create -volname "
|
||||
cmd += pkg_name + " -srcpath "
|
||||
cmd += os.path.join(tools.get_run_path(), self.path_out, self.path_staging, pkg_name + ".app")
|
||||
cmd += " -ov -format UDZO "
|
||||
cmd += output_file_name
|
||||
tools.create_directory_of_file(output_file_name)
|
||||
multiprocess.run_command_direct(cmd)
|
||||
debug.info("disk image: " + output_file_name)
|
||||
|
||||
## user information:
|
||||
#debug.info("You can have an shell interface by executing : ")
|
||||
#debug.info(" sudo cp " + shell_file_name + " /usr/local/bin")
|
||||
## create the package:
|
||||
if ret_share \
|
||||
or ret_bin \
|
||||
or ret_lib \
|
||||
or ret_file \
|
||||
or need_generate_package:
|
||||
|
||||
## Create icon (no convertion ==> TODO: must test if png is now supported):
|
||||
if "ICON" in pkg_properties.keys() \
|
||||
and pkg_properties["ICON"] != "":
|
||||
tools.copy_file(pkg_properties["ICON"], os.path.join(target_outpath, "icon.icns"), force=True)
|
||||
|
||||
## Create info.plist file:
|
||||
# http://www.sandroid.org/imcross/#Deployment
|
||||
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:
|
||||
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):
|
||||
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"
|
||||
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 + "'")
|
||||
output_file_name = os.path.join(self.get_final_path(), pkg_name + ".dmg")
|
||||
cmd = "hdiutil create -volname "
|
||||
cmd += pkg_name + " -srcpath "
|
||||
cmd += os.path.join(tools.get_run_path(), self.path_out, self.path_staging, pkg_name + ".app")
|
||||
cmd += " -ov -format UDZO "
|
||||
cmd += output_file_name
|
||||
tools.create_directory_of_file(output_file_name)
|
||||
multiprocess.run_command_direct(cmd)
|
||||
debug.info("disk image: " + output_file_name)
|
||||
|
||||
## user information:
|
||||
#debug.info("You can have an shell interface by executing : ")
|
||||
#debug.info(" sudo cp " + shell_file_name + " /usr/local/bin")
|
||||
tools.file_write_data(build_package_path_done, "done...")
|
||||
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@ -12,6 +12,7 @@ from lutin import debug
|
||||
from lutin import target
|
||||
from lutin import tools
|
||||
from lutin import host
|
||||
from lutin import depend
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
@ -71,8 +72,8 @@ class Target(target.Target):
|
||||
self.support_dynamic_link = False
|
||||
|
||||
|
||||
def get_staging_path_data(self, binary_name, heritage_list):
|
||||
return self.get_staging_path(binary_name) + self.path_data
|
||||
def get_staging_path_data(self, binary_name):
|
||||
return os.path.join(self.get_staging_path(binary_name), binary_name + ".app", self.pkg_path_data)
|
||||
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@ -92,14 +93,34 @@ class Target(target.Target):
|
||||
ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create generic files:
|
||||
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
ret_file = self.make_package_generic_files(target_outpath+"/pkg", pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
|
||||
#Check date between the current file "list of action to generate package and the end of package generation
|
||||
need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
|
||||
## create the package:
|
||||
if ret_share \
|
||||
or ret_bin \
|
||||
or ret_lib \
|
||||
or ret_file:
|
||||
debug.info("TODO: create a windows pkg ...")
|
||||
or ret_file \
|
||||
or need_generate_package:
|
||||
# Zip the data
|
||||
debug.print_element("zip", "data.zip", "<==", self.get_staging_path_data(pkg_name) + "/*")
|
||||
zip_path = os.path.join(self.get_staging_path(pkg_name), "data.zip")
|
||||
zip.create_zip([
|
||||
self.get_staging_path_data(pkg_name),
|
||||
target_outpath+"/pkg"
|
||||
], zip_path)
|
||||
zip_path_final = os.path.join(self.get_final_path(), pkg_name + ".zip")
|
||||
# generate deployed zip (for user)
|
||||
debug.print_element("zip", pkg_name + ".zip", "<==", self.get_staging_path(pkg_name))
|
||||
zip.create_zip_file([
|
||||
zip_path,
|
||||
os.path.join(target_outpath, pkg_name + self.suffix_binary)
|
||||
],
|
||||
zip_path_final)
|
||||
|
||||
tools.file_write_data(build_package_path_done, "done...")
|
||||
|
||||
def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
32
lutin/zip.py
32
lutin/zip.py
@ -18,15 +18,31 @@ from . import tools
|
||||
|
||||
def create_zip(path, outputFile):
|
||||
debug.debug("Create Zip : '" + outputFile + "'")
|
||||
debug.debug(" from '" + path + "'")
|
||||
basePathlen = len(path)
|
||||
tools.create_directory_of_file(outputFile)
|
||||
debug.debug(" from '" + str(path) + "'")
|
||||
if tools.get_type_string(path) == "string":
|
||||
path = [path]
|
||||
zf = zipfile.ZipFile(outputFile, mode='w')
|
||||
for root, dirnames, filenames in os.walk(path):
|
||||
# List all files :
|
||||
for filename in filenames:
|
||||
file = os.path.join(root, filename)
|
||||
debug.verbose(" ADD zip = " + str(file))
|
||||
zf.write(file, file[basePathlen:])
|
||||
for elem in path:
|
||||
basePathlen = len(elem)
|
||||
for root, dirnames, filenames in os.walk(elem):
|
||||
# List all files :
|
||||
for filename in filenames:
|
||||
file = os.path.join(root, filename)
|
||||
debug.verbose(" ADD zip = " + str(file) + " ==> " +file[basePathlen:])
|
||||
zf.write(file, file[basePathlen:])
|
||||
zf.close()
|
||||
|
||||
def create_zip_file(files, outputFile):
|
||||
debug.debug("Create Zip : '" + outputFile + "'")
|
||||
tools.create_directory_of_file(outputFile)
|
||||
debug.debug(" from '" + str(files) + "'")
|
||||
if tools.get_type_string(files) == "string":
|
||||
files = [files]
|
||||
zf = zipfile.ZipFile(outputFile, mode='w')
|
||||
for elem in files:
|
||||
debug.verbose(" ADD zip = " + str(elem) + " ==> " + elem[len(os.path.dirname(elem)):])
|
||||
zf.write(elem, elem[len(os.path.dirname(elem)):])
|
||||
zf.close()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user