[DEBUG] correct basic path to create the zip file in Windows Target

This commit is contained in:
Edouard DUPIN 2016-10-05 23:45:46 +02:00
parent 71e0f242bf
commit 27f6a95d41
3 changed files with 30 additions and 19 deletions

View File

@ -239,6 +239,7 @@ class Target:
self.path_out = os.path.join("out", self._name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"])
self.path_final = os.path.join("final", self.config["compilator"])
self.path_staging = os.path.join("staging", self.config["compilator"])
self.path_staging_tmp = os.path.join("staging_tmp", self.config["compilator"])
self.path_build = os.path.join("build", self.config["compilator"])
# TODO: Remove this from here ==> this is a tools
@ -375,8 +376,11 @@ class Target:
## @param[in] name (string) Name of the module
## @return (string) The path
##
def get_staging_path(self, name):
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, name)
def get_staging_path(self, name, tmp=False):
if tmp == False:
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging, name)
else:
return os.path.join(tools.get_run_path(), self.path_out, self.path_staging_tmp, name)
##
## @brief Get the build path ==> dependency file, object files, cmdlines files, generate files, local install headers ...
@ -475,8 +479,8 @@ class Target:
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_bin(self, name):
return os.path.join(self.get_staging_path(name), self.path_bin)
def get_staging_path_bin(self, name, tmp=False):
return os.path.join(self.get_staging_path(name, tmp), self.path_bin)
##
## @brief Get the lib path for staging step
@ -484,8 +488,8 @@ class Target:
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_lib(self, name):
return os.path.join(self.get_staging_path(name), self.path_lib, name)
def get_staging_path_lib(self, name, tmp=False):
return os.path.join(self.get_staging_path(name, tmp), self.path_lib, name)
##
## @brief Get the data path for staging step
@ -493,8 +497,8 @@ class Target:
## @param[in] name (string) Name of the package
## @return (string) The path
##
def get_staging_path_data(self, name):
return os.path.join(self.get_staging_path(name), self.path_data, name)
def get_staging_path_data(self, name, tmp=False):
return os.path.join(self.get_staging_path(name, tmp), self.path_data, name)
##
## @brief Get the include path for staging step

View File

@ -72,15 +72,15 @@ class Target(target.Target):
self.support_dynamic_link = False
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 get_staging_path_data(self, binary_name, tmp=False):
return os.path.join(self.get_staging_path(binary_name, tmp), binary_name + ".app", self.pkg_path_data)
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------")
debug.debug("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
debug.debug("------------------------------------------------------------------------")
#output path
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
target_outpath = os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app")
tools.create_directory_of_file(target_outpath)
## Create share datas:
@ -105,19 +105,26 @@ class Target(target.Target):
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")
debug.print_element("zip", "data.zip", "<==", self.get_staging_path_data(pkg_name, tmp=True) + "/*")
zip_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "data.zip")
zip.create_zip([
self.get_staging_path_data(pkg_name),
self.get_staging_path_data(pkg_name, tmp=True),
target_outpath+"/pkg"
], zip_path)
# copy if needed the binary:
tools.copy_file(
os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app", pkg_name + self.suffix_binary),
os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary),
force_identical=True)
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))
debug.print_element("zip", pkg_name + ".zip", "<==", self.get_staging_path(pkg_name), pkg_name + ".app")
zip.create_zip_file([
zip_path,
os.path.join(target_outpath, pkg_name + self.suffix_binary)
os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary)
],
pkg_name + ".app",
zip_path_final)
tools.file_write_data(build_package_path_done, "done...")

View File

@ -33,7 +33,7 @@ def create_zip(path, outputFile):
zf.write(file, file[basePathlen:])
zf.close()
def create_zip_file(files, outputFile):
def create_zip_file(files, base_output, outputFile):
debug.debug("Create Zip : '" + outputFile + "'")
tools.create_directory_of_file(outputFile)
debug.debug(" from '" + str(files) + "'")
@ -41,8 +41,8 @@ def create_zip_file(files, outputFile):
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)):])
debug.verbose(" ADD zip = " + str(elem) + " ==> " + base_output + "/" + elem[len(os.path.dirname(elem)):])
zf.write(elem, base_output + "/" + elem[len(os.path.dirname(elem)):])
zf.close()