[DEV] zip data for windows and create a zip package for final output

This commit is contained in:
Edouard DUPIN 2016-10-05 22:57:30 +02:00
parent 092843cd02
commit 71e0f242bf
7 changed files with 495 additions and 399 deletions

View File

@ -780,6 +780,7 @@ class Target:
## @param[in] static The package is build in static mode ## @param[in] static The package is build in static mode
## ##
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): 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: #The package generated depend of the type of the element:
end_point_module_name = heritage_list.list_heritage[-1].name end_point_module_name = heritage_list.list_heritage[-1].name
module = self.get_module(end_point_module_name) module = self.get_module(end_point_module_name)
@ -801,6 +802,7 @@ class Target:
if module.get_type() == 'PACKAGE': if module.get_type() == 'PACKAGE':
debug.info("Can not create package for package"); debug.info("Can not create package for package");
return return
debug.debug("make_package [STOP]")
return return
## ##
@ -813,6 +815,7 @@ class Target:
## @return False Nothing has been copied ## @return False Nothing has been copied
## ##
def make_package_binary_data(self, path_package, pkg_name, base_pkg_path, heritage_list, static): 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) target_shared_path = os.path.join(path_package, self.pkg_path_data)
if static == True: if static == True:
path_package_data = os.path.join(target_shared_path, pkg_name) path_package_data = os.path.join(target_shared_path, pkg_name)
@ -847,6 +850,7 @@ class Target:
ret_copy = tools.copy_list(copy_list) ret_copy = tools.copy_list(copy_list)
# remove unneded files (NOT folder ...) # remove unneded files (NOT folder ...)
ret_remove = tools.clean_directory(target_shared_path, copy_list) ret_remove = tools.clean_directory(target_shared_path, copy_list)
debug.debug("make_package_binary_data [STOP]")
return ret_copy or ret_remove return ret_copy or ret_remove
## ##
@ -859,6 +863,7 @@ class Target:
## @return False Nothing has been copied ## @return False Nothing has been copied
## ##
def make_package_binary_bin(self, path_package, pkg_name, base_pkg_path, heritage_list, static): 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={} copy_list={}
path_package_bin = os.path.join(path_package, self.pkg_path_bin) path_package_bin = os.path.join(path_package, self.pkg_path_bin)
tools.create_directory_of_file(path_package_bin) tools.create_directory_of_file(path_package_bin)
@ -874,6 +879,7 @@ class Target:
if self.pkg_path_bin != "": if self.pkg_path_bin != "":
# remove unneded files (NOT folder ...) # remove unneded files (NOT folder ...)
ret_remove = tools.clean_directory(path_package_bin, copy_list) ret_remove = tools.clean_directory(path_package_bin, copy_list)
debug.debug("make_package_binary_bin [STOP]")
return ret_copy or ret_remove return ret_copy or ret_remove
## ##
@ -886,6 +892,7 @@ class Target:
## @return False Nothing has been copied ## @return False Nothing has been copied
## ##
def make_package_binary_lib(self, path_package, pkg_name, base_pkg_path, heritage_list, static): 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={} copy_list={}
path_package_lib = os.path.join(path_package, self.pkg_path_lib) path_package_lib = os.path.join(path_package, self.pkg_path_lib)
if static == False: if static == False:
@ -909,10 +916,12 @@ class Target:
if self.pkg_path_lib != "": if self.pkg_path_lib != "":
# remove unneded files (NOT folder ...) # remove unneded files (NOT folder ...)
ret_remove = tools.clean_directory(path_package_lib, copy_list) ret_remove = tools.clean_directory(path_package_lib, copy_list)
debug.debug("make_package_binary_lib [STOP]")
return ret_copy or ret_remove return ret_copy or ret_remove
def make_package_generic_files(self, path_package, pkg_properties, pkg_name, base_pkg_path, heritage_list, static): 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: ## Create version file:
ret_version = tools.file_write_data(os.path.join(path_package, self.pkg_path_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"]), tools.version_to_string(pkg_properties["VERSION"]),
@ -973,6 +982,7 @@ class Target:
ret_changelog = tools.file_write_data(change_log_file_dest, ret_changelog = tools.file_write_data(change_log_file_dest,
"No changelog data " + pkg_name + "\n", "No changelog data " + pkg_name + "\n",
only_if_new=True) only_if_new=True)
debug.debug("make_package_generic_files [STOP]")
return ret_version \ return ret_version \
or ret_maintainer \ or ret_maintainer \
or ret_appl_name \ or ret_appl_name \

View File

@ -63,100 +63,115 @@ class Target(lutinTarget_Linux.Target):
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create share datas: ## 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: ## 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: ## 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: ## 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: ## create the package:
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg") if ret_share \
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") or ret_bin \
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") or ret_lib \
tools.create_directory_of_file(self.get_final_path()) or ret_file \
tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg") or need_generate_package:
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): """
""" ## create the package:
self.get_staging_path(pkg_name) debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg")
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/" os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
finalFileControl = target_outpathDebian + "control" #multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
finalFilepostRm = target_outpathDebian + "postrm" tools.create_directory_of_file(self.get_final_path())
# create the paths : tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
tools.create_directory_of_file(finalFileControl) def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
tools.create_directory_of_file(finalFilepostRm) """
## Create the control file self.get_staging_path(pkg_name)
tools.create_directory_of_file(finalFileControl) target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
tmpFile = open(finalFileControl, 'w') finalFileControl = target_outpathDebian + "control"
tmpFile.write("Package: " + debianpkg_name + "\n") finalFilepostRm = target_outpathDebian + "postrm"
tmpFile.write("Version: " + tools.version_to_string(pkg_properties["VERSION"]) + "\n") # create the paths :
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n") tools.create_directory_of_file(finalFileControl)
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n") tools.create_directory_of_file(finalFilepostRm)
tmpFile.write("Architecture: all\n") ## Create the control file
tmpFile.write("Depends: bash\n") tools.create_directory_of_file(finalFileControl)
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n") tmpFile = open(finalFileControl, 'w')
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n") tmpFile.write("Package: " + debianpkg_name + "\n")
tmpFile.write("\n") tmpFile.write("Version: " + tools.version_to_string(pkg_properties["VERSION"]) + "\n")
tmpFile.flush() tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
tmpFile.close() tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
## Create the PostRm tmpFile.write("Architecture: all\n")
tmpFile = open(finalFilepostRm, 'w') tmpFile.write("Depends: bash\n")
tmpFile.write("#!/bin/bash\n") tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
tmpFile.write("touch ~/." + pkg_name + "\n") tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
if pkg_name != "": tmpFile.write("\n")
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")
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## licence file ## Create the PostRm
license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright" tmpFile = open(finalFilepostRm, 'w')
tools.create_directory_of_file(license_file_dest) tmpFile.write("#!/bin/bash\n")
if os.path.exists(base_pkg_path + "/license.txt")==True: tmpFile.write("touch ~/." + pkg_name + "\n")
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest) if pkg_name != "":
else: tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
debug.info("no file 'license.txt' ==> generate an empty one") tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
tmpFile = open(license_file_dest, 'w') tmpFile.write("\n")
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
##changeLog file ## Enable Execution in script
change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog" os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
tools.create_directory_of_file(change_log_file_dest) ## Readme donumentation
if os.path.exists(base_pkg_path + "/changelog")==True: readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest) tools.create_directory_of_file(readmeFileDest)
else: if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
debug.info("no file 'changelog' ==> generate an empty one") tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
tmpFile = open(change_log_file_dest, 'w') elif os.path.exists(base_pkg_path + "/README")==True:
tmpFile.write("No changelog data " + pkg_name + "\n") tools.copy_file(base_pkg_path + "/README", readmeFileDest)
tmpFile.flush() elif os.path.exists(base_pkg_path + "/README.md")==True:
tmpFile.close() tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
## create the package : else:
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb") debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name) tmpFile = open(readmeFileDest, 'w')
tools.create_directory_of_file(self.get_final_path()) tmpFile.write("No documentation for " + pkg_name + "\n")
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package) 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): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@ -105,264 +105,277 @@ class Target(target.Target):
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create share datas: ## 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: ## 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: ## 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: ## 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: ## end of the package generation
if "ICON" in pkg_properties.keys() \ build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
and pkg_properties["ICON"] != "": #Check date between the current file "list of action to generate package and the end of package generation
# Resize all icon needed for Ios ... need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
# 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: ## create the package:
debug.print_element("pkg", "PkgInfo", "<==", "APPL????") if ret_share \
tools.file_write_data(os.path.join(target_outpath, "PkgInfo"), or ret_bin \
"APPL????", or ret_lib \
only_if_new=True) or ret_file \
or need_generate_package:
## Create Info.plist (in XML mode) ## Create icon:
debug.print_element("pkg", "Info.plist", "<==", "Package properties") if "ICON" in pkg_properties.keys() \
# http://www.sandroid.org/imcross/#Deployment and pkg_properties["ICON"] != "":
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" # Resize all icon needed for Ios ...
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" # TODO : Do not regenerate if source resource is not availlable
data_file += "<plist version=\"1.0\">\n" # TODO : Add a colored background ...
data_file += " <dict>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork.png")
data_file += " <key>CFBundleDevelopmentRegion</key>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork.png"), 512, 512)
data_file += " <string>en</string>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork@2x.png")
data_file += " <key>CFBundleDisplayName</key>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork@2x.png"), 1024, 1024)
data_file += " <string>" + pkg_properties["NAME"] + "</string>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-60@2x.png")
data_file += " <key>CFBundleExecutable</key>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-60@2x.png"), 120, 120)
data_file += " <string>" + pkg_name + "</string>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76.png")
data_file += " <key>CFBundleIdentifier</key>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76.png"), 76, 76)
data_file += " <string>com." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n" 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)
data_file += " <key>CFBundleIconFiles</key>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40.png")
data_file += " <array>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40.png"), 40, 40)
data_file += " <string>Icon-60@2x.png</string>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40@2x.png")
data_file += " <string>Icon-76.png</string>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40@2x.png"), 80, 80)
data_file += " <string>Icon-76@2x.png</string>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small.png")
data_file += " <string>Icon-Small-40.png</string>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small.png"), 29, 29)
data_file += " <string>Icon-Small-40@2x.png</string>\n" debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small@2x.png")
data_file += " <string>Icon-Small.png</string>\n" image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small@2x.png"), 58, 58)
data_file += " <string>Icon-Small@2x.png</string>\n"
data_file += " <string>iTunesArtwork.png</string>\n" ## Create the info file:
data_file += " <string>iTunesArtwork@2x.png</string>\n" debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
data_file += " </array>\n" tools.file_write_data(os.path.join(target_outpath, "PkgInfo"),
"APPL????",
data_file += " <key>CFBundleInfoDictionaryVersion</key>\n" only_if_new=True)
data_file += " <string>6.0</string>\n"
data_file += " <key>CFBundleName</key>\n" ## Create Info.plist (in XML mode)
data_file += " <string>" + pkg_name + "</string>\n" debug.print_element("pkg", "Info.plist", "<==", "Package properties")
data_file += " <key>CFBundlePackageType</key>\n" # http://www.sandroid.org/imcross/#Deployment
data_file += " <string>APPL</string>\n" data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
data_file += " <key>CFBundleSignature</key>\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 += " <string>????</string>\n" data_file += "<plist version=\"1.0\">\n"
data_file += " <key>CFBundleSupportedPlatforms</key>\n" data_file += " <dict>\n"
data_file += " <array>\n" data_file += " <key>CFBundleDevelopmentRegion</key>\n"
data_file += " <string>iPhoneSimulator</string>\n" data_file += " <string>en</string>\n"
data_file += " </array>\n" data_file += " <key>CFBundleDisplayName</key>\n"
data_file += " \n" data_file += " <string>" + pkg_properties["NAME"] + "</string>\n"
data_file += " <key>CFBundleShortVersionString</key>\n" data_file += " <key>CFBundleExecutable</key>\n"
data_file += " <string>"+tools.version_to_string(pkg_properties["VERSION"])+"</string>\n" data_file += " <string>" + pkg_name + "</string>\n"
data_file += " <key>CFBundleVersion</key>\n" data_file += " <key>CFBundleIdentifier</key>\n"
data_file += " <string>"+str(pkg_properties["VERSION_CODE"])+"</string>\n" data_file += " <string>com." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
data_file += " \n"
data_file += " <key>CFBundleResourceSpecification</key>\n" data_file += " <key>CFBundleIconFiles</key>\n"
data_file += " <string>ResourceRules.plist</string>\n" data_file += " <array>\n"
if self.get_simulation() == False: data_file += " <string>Icon-60@2x.png</string>\n"
data_file += " <key>LSRequiresIPhoneOS</key>\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" data_file += " <true/>\n"
else: data_file += " <key>UISupportedInterfaceOrientations</key>\n"
data_file += " <key>DTPlatformName</key>\n" data_file += " <array>\n"
data_file += " <string>iphonesimulator</string>\n" data_file += " <string>UIInterfaceOrientationPortrait</string>\n"
data_file += " <key>DTSDKName</key>\n" data_file += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
data_file += " <string>iphonesimulator7.0</string>\n" data_file += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
data_file += " \n" data_file += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
data_file += " <key>UIDeviceFamily</key>\n" data_file += " </array>\n"
data_file += " <array>\n" data_file += " <key>UISupportedInterfaceOrientations~ipad</key>\n"
data_file += " <integer>1</integer>\n" data_file += " <array>\n"
data_file += " <integer>2</integer>\n" data_file += " <string>UIInterfaceOrientationPortrait</string>\n"
data_file += " </array>\n" data_file += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
data_file += " <key>UIRequiredDeviceCapabilities</key>\n" data_file += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
data_file += " <array>\n" data_file += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
data_file += " <string>armv7</string>\n" data_file += " </array>\n"
data_file += " </array>\n" data_file += " </dict>\n"
data_file += " <key>UIStatusBarHidden</key>\n" data_file += "</plist>\n"
data_file += " <true/>\n" data_file += "\n\n"
data_file += " <key>UISupportedInterfaceOrientations</key>\n" tools.file_write_data(os.path.join(target_outpath, "Info.plist"),
data_file += " <array>\n" data_file,
data_file += " <string>UIInterfaceOrientationPortrait</string>\n" only_if_new=True)
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
""" """
#/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 infoFile = self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist"
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 # Create the info file
tmpFile = open(os.path.join(self.get_build_path(pkg_name), pkg_name + ".xcent"), 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") tmpFile.write(data_file)
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.flush()
tmpFile.close() tmpFile.close()
# application signing : cmdLine = "builtin-infoPlistUtility "
debug.print_element("pkg(signed)", "pkg", "<==", "Signing application") cmdLine += " " + self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist "
iosDevelopperKeyFile = ".iosKey.txt" cmdLine += " -genpkginfo " + self.get_staging_path(pkg_name) + "/PkgInfo"
if tools.file_size(iosDevelopperKeyFile) < 10: cmdLine += " -expandbuildsettings "
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\"'") cmdLine += " -format binary "
debug.warning("Can not be install ... not runnable") if self.get_simulation() == False:
cmdLine += " -platform iphonesimulator "
else: else:
signatureKey = tools.file_read_data(iosDevelopperKeyFile) cmdLine += " -platform iphoneos "
signatureKey = re.sub('\n', '', signatureKey) cmdLine += " -o " + self.get_staging_path(pkg_name) + "/" + "Info.plist"
cmdLine = 'codesign --force --sign ' multiprocess.run_command(cmdLine)
# 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") /Users/edouarddupin/dev/exampleProjectXcode/projectName/projectName/projectName-Info.plist
multiprocess.run_command(cmdLine) -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): def create_random_number(self, len):
out = "" out = ""
for iii in range(0,len): for iii in range(0,len):

View File

@ -103,16 +103,24 @@ class Target(target.Target):
## Create generic files: ## 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_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: ## create the package:
if ret_share \ if ret_share \
or ret_bin \ or ret_bin \
or ret_lib \ 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")) 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") 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") #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.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")) 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): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@ -71,73 +71,86 @@ class Target(target.Target):
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create share datas: ## 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: ## 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: ## 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: ## 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): ## end of the package generation
if "ICON" in pkg_properties.keys() \ build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
and pkg_properties["ICON"] != "": #Check date between the current file "list of action to generate package and the end of package generation
tools.copy_file(pkg_properties["ICON"], os.path.join(target_outpath, "icon.icns"), force=True) need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
## Create info.plist file: ## create the package:
# http://www.sandroid.org/imcross/#Deployment if ret_share \
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" or ret_bin \
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" or ret_lib \
data_file += "<plist version=\"1.0\">\n" or ret_file \
data_file += " <dict>\n" or need_generate_package:
data_file += " <key>CFBundleExecutableFile</key>\n"
data_file += " <string>"+pkg_name+"</string>\n" ## Create icon (no convertion ==> TODO: must test if png is now supported):
data_file += " <key>CFBundleName</key>\n" if "ICON" in pkg_properties.keys() \
data_file += " <string>"+pkg_name+"</string>\n" and pkg_properties["ICON"] != "":
data_file += " <key>CFBundleIdentifier</key>\n" tools.copy_file(pkg_properties["ICON"], os.path.join(target_outpath, "icon.icns"), force=True)
data_file += " <string>" + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
data_file += " <key>CFBundleSignature</key>\n" ## Create info.plist file:
data_file += " <string>????</string>\n" # http://www.sandroid.org/imcross/#Deployment
data_file += " <key>CFBundleIconFile</key>\n" data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
data_file += " <string>icon.icns</string>\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 += " </dict>\n" data_file += "<plist version=\"1.0\">\n"
data_file += "</plist>\n" data_file += " <dict>\n"
data_file += "\n\n" data_file += " <key>CFBundleExecutableFile</key>\n"
tools.file_write_data(os.path.join(target_outpath, "Info.plist"), data_file += " <string>"+pkg_name+"</string>\n"
data_file, data_file += " <key>CFBundleName</key>\n"
only_if_new=True) data_file += " <string>"+pkg_name+"</string>\n"
data_file += " <key>CFBundleIdentifier</key>\n"
## Create PkgInfo file: data_file += " <string>" + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
tools.file_write_data(os.path.join(target_outpath, "PkgInfo"), data_file += " <key>CFBundleSignature</key>\n"
"APPL????", data_file += " <string>????</string>\n"
only_if_new=True) data_file += " <key>CFBundleIconFile</key>\n"
data_file += " <string>icon.icns</string>\n"
## Create a simple interface to localy install the aplication for the shell (a shell command line interface): data_file += " </dict>\n"
data_file = "#!/bin/bash\n" data_file += "</plist>\n"
data_file += "# Simply open the real application in the correct way (a link does not work ...)\n" data_file += "\n\n"
data_file += "/Applications/" + pkg_name + ".app/Contents/MacOS/" + pkg_name + " $*\n" tools.file_write_data(os.path.join(target_outpath, "Info.plist"),
tools.file_write_data(os.path.join(target_outpath, "shell", pkg_name), data_file,
data_file, only_if_new=True)
only_if_new=True)
## Create PkgInfo file:
## Create the disk image of the application: tools.file_write_data(os.path.join(target_outpath, "PkgInfo"),
debug.info("Generate disk image for '" + pkg_name + "'") "APPL????",
output_file_name = os.path.join(self.get_final_path(), pkg_name + ".dmg") only_if_new=True)
cmd = "hdiutil create -volname "
cmd += pkg_name + " -srcpath " ## Create a simple interface to localy install the aplication for the shell (a shell command line interface):
cmd += os.path.join(tools.get_run_path(), self.path_out, self.path_staging, pkg_name + ".app") data_file = "#!/bin/bash\n"
cmd += " -ov -format UDZO " data_file += "# Simply open the real application in the correct way (a link does not work ...)\n"
cmd += output_file_name data_file += "/Applications/" + pkg_name + ".app/Contents/MacOS/" + pkg_name + " $*\n"
tools.create_directory_of_file(output_file_name) tools.file_write_data(os.path.join(target_outpath, "shell", pkg_name),
multiprocess.run_command_direct(cmd) data_file,
debug.info("disk image: " + output_file_name) only_if_new=True)
## user information: ## Create the disk image of the application:
#debug.info("You can have an shell interface by executing : ") debug.info("Generate disk image for '" + pkg_name + "'")
#debug.info(" sudo cp " + shell_file_name + " /usr/local/bin") 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): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@ -12,6 +12,7 @@ from lutin import debug
from lutin import target from lutin import target
from lutin import tools from lutin import tools
from lutin import host from lutin import host
from lutin import depend
import os import os
import stat import stat
import sys import sys
@ -71,8 +72,8 @@ class Target(target.Target):
self.support_dynamic_link = False self.support_dynamic_link = False
def get_staging_path_data(self, binary_name, heritage_list): def get_staging_path_data(self, binary_name):
return self.get_staging_path(binary_name) + self.path_data 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): def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------") 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) ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## Create generic files: ## 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: ## create the package:
if ret_share \ if ret_share \
or ret_bin \ or ret_bin \
or ret_lib \ or ret_lib \
or ret_file: or ret_file \
debug.info("TODO: create a windows pkg ...") 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): def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@ -18,15 +18,31 @@ from . import tools
def create_zip(path, outputFile): def create_zip(path, outputFile):
debug.debug("Create Zip : '" + outputFile + "'") debug.debug("Create Zip : '" + outputFile + "'")
debug.debug(" from '" + path + "'") tools.create_directory_of_file(outputFile)
basePathlen = len(path) debug.debug(" from '" + str(path) + "'")
if tools.get_type_string(path) == "string":
path = [path]
zf = zipfile.ZipFile(outputFile, mode='w') zf = zipfile.ZipFile(outputFile, mode='w')
for root, dirnames, filenames in os.walk(path): for elem in path:
# List all files : basePathlen = len(elem)
for filename in filenames: for root, dirnames, filenames in os.walk(elem):
file = os.path.join(root, filename) # List all files :
debug.verbose(" ADD zip = " + str(file)) for filename in filenames:
zf.write(file, file[basePathlen:]) 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() zf.close()