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