From 06481abcbf01f6682866314659898925b52d717a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 16 Sep 2015 16:58:01 +0200 Subject: [PATCH] [DEV] set work compilation again on windows --- lutin/target.py | 13 ++ lutin/z_target/lutinTarget_Android.py | 146 +++++++++++----------- lutin/z_target/lutinTarget_IOs.py | 125 +++++++++---------- lutin/z_target/lutinTarget_Linux.py | 151 ++++++++++------------- lutin/z_target/lutinTarget_MacOs.py | 74 ++++++------ lutin/z_target/lutinTarget_Windows.py | 168 +++++++++++++++++++++++--- 6 files changed, 402 insertions(+), 275 deletions(-) diff --git a/lutin/target.py b/lutin/target.py index f641ea4..c34944f 100644 --- a/lutin/target.py +++ b/lutin/target.py @@ -492,6 +492,19 @@ class Target: self.action_on_state[name_of_state] = [[level, name, action]] else: self.action_on_state[name_of_state].append([level, name, action]) + + + + def generate_list_separate_coma(self, list): + result = "" + fistTime = True + for elem in list: + if fistTime == True: + fistTime = False + else: + result += "," + result += elem + return result targetList=[] diff --git a/lutin/z_target/lutinTarget_Android.py b/lutin/z_target/lutinTarget_Android.py index 6fd1acb..a5d7d02 100644 --- a/lutin/z_target/lutinTarget_Android.py +++ b/lutin/z_target/lutinTarget_Android.py @@ -198,39 +198,39 @@ class Target(target.Target): self.global_flags_cc.append("-fexceptions") self.global_flags_xx.append("-Wa,--noexecstack") - def check_right_package(self, pkgProperties, value): - for val in pkgProperties["RIGHT"]: + def check_right_package(self, pkg_properties, value): + for val in pkg_properties["RIGHT"]: if value == val: return True return False """ - def get_staging_path_data(self, binaryName): - return self.get_staging_path(binaryName) + self.path_data + def get_staging_path_data(self, binary_name): + return self.get_staging_path(binary_name) + self.path_data """ - def make_package(self, pkgName, pkgProperties, basePkgPath, heritage): + def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): # http://alp.developpez.com/tutoriels/debian/creer-paquet/ debug.debug("------------------------------------------------------------------------") - debug.info("Generate package '" + pkgName + "'") + debug.info("Generate package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") - pkgNameApplicationName = pkgName + pkg_name_application_name = pkg_name if self.config["mode"] == "debug": - pkgNameApplicationName += "debug" + pkg_name_application_name += "debug" # FINAL_path_JAVA_PROJECT - self.path_javaProject= self.get_staging_path(pkgName) \ + self.path_javaProject= self.get_staging_path(pkg_name) \ + "/src/" \ - + pkgProperties["COMPAGNY_TYPE"] \ - + "/" + pkgProperties["COMPAGNY_NAME2"] \ - + "/" + pkgNameApplicationName + "/" + + pkg_properties["COMPAGNY_TYPE"] \ + + "/" + pkg_properties["COMPAGNY_NAME2"] \ + + "/" + pkg_name_application_name + "/" #FINAL_FILE_ABSTRACTION - self.file_finalAbstraction = self.path_javaProject + "/" + pkgNameApplicationName + ".java" + self.file_finalAbstraction = self.path_javaProject + "/" + pkg_name_application_name + ".java" - compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgNameApplicationName + compleatePackageName = pkg_properties["COMPAGNY_TYPE"]+"."+pkg_properties["COMPAGNY_NAME2"]+"." + pkg_name_application_name - if "ADMOD_ID" in pkgProperties: - pkgProperties["RIGHT"].append("INTERNET") - pkgProperties["RIGHT"].append("ACCESS_NETWORK_STATE") + if "ADMOD_ID" in pkg_properties: + pkg_properties["RIGHT"].append("INTERNET") + pkg_properties["RIGHT"].append("ACCESS_NETWORK_STATE") debug.print_element("pkg", "absractionFile", "<==", "dynamic file") @@ -239,20 +239,20 @@ class Target(target.Target): # Create file : # java ==> done by ewol wrapper ... (and compiled in the normal compilation system ==> must be find in the dependency list of jar ... - tools.create_directory_of_file(self.get_staging_path(pkgName) + "/res/drawable/icon.png"); - if "ICON" in pkgProperties.keys() \ - and pkgProperties["ICON"] != "": - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/res/drawable/icon.png", 256, 256) + tools.create_directory_of_file(self.get_staging_path(pkg_name) + "/res/drawable/icon.png"); + if "ICON" in pkg_properties.keys() \ + and pkg_properties["ICON"] != "": + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/res/drawable/icon.png", 256, 256) else: # to be sure that we have all time a resource ... - tmpFile = open(self.get_staging_path(pkgName) + "/res/drawable/plop.txt", 'w') + tmpFile = open(self.get_staging_path(pkg_name) + "/res/drawable/plop.txt", 'w') tmpFile.write('plop\n') tmpFile.flush() tmpFile.close() - if pkgProperties["ANDROID_MANIFEST"]!="": - debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"]) - tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_path(pkgName) + "/AndroidManifest.xml", force=True) + if pkg_properties["ANDROID_MANIFEST"]!="": + debug.print_element("pkg", "AndroidManifest.xml", "<==", pkg_properties["ANDROID_MANIFEST"]) + tools.copy_file(pkg_properties["ANDROID_MANIFEST"], self.get_staging_path(pkg_name) + "/AndroidManifest.xml", force=True) else: debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ") @@ -262,16 +262,16 @@ class Target(target.Target): # myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"]) # myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"] #copy needed resources : - for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]: + for res_source, res_dest in pkg_properties["ANDROID_RESOURCES"]: if res_source == "": continue - tools.copy_file(res_source , self.get_staging_path(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True) + tools.copy_file(res_source , self.get_staging_path(pkg_name) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True) # Doc : # http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/ debug.print_element("pkg", "R.java", "<==", "Resources files") - tools.create_directory_of_file(self.get_staging_path(pkgName) + "/src/noFile") + tools.create_directory_of_file(self.get_staging_path(pkg_name) + "/src/noFile") androidToolPath = self.path_sdk + "/build-tools/" # find android tool version dirnames = tools.get_list_sub_path(androidToolPath) @@ -281,48 +281,48 @@ class Target(target.Target): # this is to create resource file for android ... (we did not use aset in jar with ewol ... adModResoucepath = "" - if "ADMOD_ID" in pkgProperties: + if "ADMOD_ID" in pkg_properties: adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ " cmdLine = androidToolPath + "aapt p -f " \ - + "-M " + self.get_staging_path(pkgName) + "/AndroidManifest.xml " \ - + "-F " + self.get_staging_path(pkgName) + "/resources.res " \ + + "-M " + self.get_staging_path(pkg_name) + "/AndroidManifest.xml " \ + + "-F " + self.get_staging_path(pkg_name) + "/resources.res " \ + "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\ - + "-S " + self.get_staging_path(pkgName) + "/res/ " \ + + "-S " + self.get_staging_path(pkg_name) + "/res/ " \ + adModResoucepath \ - + "-J " + self.get_staging_path(pkgName) + "/src/ " + + "-J " + self.get_staging_path(pkg_name) + "/src/ " multiprocess.run_command(cmdLine) - tools.create_directory_of_file(self.get_staging_path(pkgName) + "/build/classes/noFile") + tools.create_directory_of_file(self.get_staging_path(pkg_name) + "/build/classes/noFile") debug.print_element("pkg", "*.class", "<==", "*.java") #generate android java files: filesString="" """ old : - if "ADMOD_ID" in pkgProperties: + if "ADMOD_ID" in pkg_properties: # TODO : check this I do not think it is really usefull ... ==> write for IDE only ... filesString += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java " - if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0: - filesString += self.path_javaProject + pkgNameApplicationName + "Settings.java " + if len(pkg_properties["ANDROID_WALLPAPER_PROPERTIES"])!=0: + filesString += self.path_javaProject + pkg_name_application_name + "Settings.java " adModJarFile = "" - if "ADMOD_ID" in pkgProperties: + if "ADMOD_ID" in pkg_properties: adModJarFile = ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar" cmdLine = "javac " \ - + "-d " + self.get_staging_path(pkgName) + "/build/classes " \ + + "-d " + self.get_staging_path(pkg_name) + "/build/classes " \ + "-classpath " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \ + adModJarFile + " " \ + filesString \ + self.file_finalAbstraction + " " \ - + self.get_staging_path(pkgName) + "/src/R.java " + + self.get_staging_path(pkg_name) + "/src/R.java " multiprocess.run_command(cmdLine) """ - debug.verbose("heritage .so=" + str(tools.filter_extention(heritage.src, ["so"]))) - debug.verbose("heritage .jar=" + str(tools.filter_extention(heritage.src, ["jar"]))) + debug.verbose("heritage .so=" + str(tools.filter_extention(heritage_list.src, ["so"]))) + debug.verbose("heritage .jar=" + str(tools.filter_extention(heritage_list.src, ["jar"]))) class_extern = "" - upper_jar = tools.filter_extention(heritage.src, ["jar"]) + upper_jar = tools.filter_extention(heritage_list.src, ["jar"]) #debug.warning("ploppppp = " + str(upper_jar)) for elem in upper_jar: if len(class_extern) > 0: @@ -330,18 +330,18 @@ class Target(target.Target): class_extern += elem # create enpoint element : cmdLine = "javac " \ - + "-d " + self.get_staging_path(pkgName) + "/build/classes " \ + + "-d " + self.get_staging_path(pkg_name) + "/build/classes " \ + "-classpath " + class_extern + " " \ - + self.get_staging_path(pkgName) + "/src/R.java " + + self.get_staging_path(pkg_name) + "/src/R.java " multiprocess.run_command(cmdLine) debug.print_element("pkg", ".dex", "<==", "*.class") cmdLine = androidToolPath + "dx " \ + "--dex --no-strict " \ - + "--output=" + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \ - + self.get_staging_path(pkgName) + "/build/classes/ " + + "--output=" + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + ".dex " \ + + self.get_staging_path(pkg_name) + "/build/classes/ " - if "ADMOD_ID" in pkgProperties: + if "ADMOD_ID" in pkg_properties: cmdLine += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar " # add element to dexification: for elem in upper_jar: @@ -360,11 +360,11 @@ class Target(target.Target): + " -classpath " + self.path_sdk + "/tools/lib/sdklib.jar " \ + builderDebug \ + " com.android.sdklib.build.ApkBuilderMain " \ - + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + " -u " \ - + " -z " + self.get_staging_path(pkgName) + "/resources.res " \ - + " -f " + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \ - + " -rf " + self.get_staging_path(pkgName) + "/data " + + " -z " + self.get_staging_path(pkg_name) + "/resources.res " \ + + " -f " + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + ".dex " \ + + " -rf " + self.get_staging_path(pkg_name) + "/data " multiprocess.run_command(cmdLine) # doc : @@ -382,7 +382,7 @@ class Target(target.Target): + " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -storepass Pass__AndroidDebugKey " \ + " -keypass PassKey__AndroidDebugKey " \ - + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + " alias__AndroidDebugKey" multiprocess.run_command(cmdLine) tmpFile = open("tmpPass.boo", 'w') @@ -393,52 +393,52 @@ class Target(target.Target): print("On release mode we need the file : and key an pasword to sign the application ...") debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)") cmdLine = "jarsigner " \ - + " -keystore " + basePkgPath + "/AndroidKey.jks " \ + + " -keystore " + base_pkg_path + "/AndroidKey.jks " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \ - + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ - + " " + pkgNameApplicationName + + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + + " " + pkg_name_application_name multiprocess.run_command(cmdLine) cmdLine = "jarsigner " \ + " -verify -verbose -certs " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \ - + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " + + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " multiprocess.run_command(cmdLine) debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)") - tools.remove_file(self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk") + tools.remove_file(self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk") # verbose mode : -v cmdLine = androidToolPath + "zipalign 4 " \ - + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ - + self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk " + + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + + self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk " multiprocess.run_command(cmdLine) # copy file in the final stage : - tools.copy_file(self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk", - self.get_final_path() + "/" + pkgNameApplicationName + ".apk", + tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk", + self.get_final_path() + "/" + pkg_name_application_name + ".apk", force=True) - def install_package(self, pkgName): + def install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Install package '" + pkgName + "'") + debug.info("Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") - pkgNameApplicationName = pkgName + pkg_name_application_name = pkg_name if self.config["mode"] == "debug": - pkgNameApplicationName += "debug" + pkg_name_application_name += "debug" cmdLine = self.path_sdk + "/platform-tools/adb install -r " \ - + self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk " + + self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk " multiprocess.run_command(cmdLine) - def un_install_package(self, pkgName): + def un_install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Un-Install package '" + pkgName + "'") + debug.info("Un-Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") - pkgNameApplicationName = pkgName + pkg_name_application_name = pkg_name if self.config["mode"] == "debug": - pkgNameApplicationName += "debug" - cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName + pkg_name_application_name += "debug" + cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkg_name_application_name Rmultiprocess.run_command(cmdLine) - def Log(self, pkgName): + def Log(self, pkg_name): debug.debug("------------------------------------------------------------------------") debug.info("logcat of android board") debug.debug("------------------------------------------------------------------------") diff --git a/lutin/z_target/lutinTarget_IOs.py b/lutin/z_target/lutinTarget_IOs.py index db0678a..453a28b 100644 --- a/lutin/z_target/lutinTarget_IOs.py +++ b/lutin/z_target/lutinTarget_IOs.py @@ -45,14 +45,15 @@ class Target(target.Target): # remove unneeded ranlib ... self.ranlib="" - self.path_bin="" - self.path_data="share" - self.path_doc="doc" + #self.path_bin="" + #self.path_data="share" + #self.path_doc="doc" self.suffix_lib_static='.a' self.suffix_lib_dynamic='.dylib' - self.suffix_binary='' - self.suffix_package='' + #self.suffix_binary='' + #self.suffix_package='' + if self.sumulator == True: self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk" self.global_flags_ld.append("-mios-simulator-version-min=8.0") @@ -76,43 +77,43 @@ class Target(target.Target): self.global_flags_m.append("-fobjc-arc") #self.global_flags_m.append("-fmodules") - def get_staging_path(self, binaryName): - return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/" + def get_staging_path(self, binary_name): + return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/" - def get_staging_path_data(self, binaryName): - return self.get_staging_path(binaryName) + self.path_data + "/" + def get_staging_path_data(self, binary_name): + return self.get_staging_path(binary_name) + self.path_data + "/" - def make_package(self, pkgName, pkgProperties, basePkgPath): + def make_package(self, pkg_name, pkg_properties, basePkgPath, heritage_list): debug.debug("------------------------------------------------------------------------") - debug.info("Generate package '" + pkgName + "'") + debug.info("Generate package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") - if "ICON" in pkgProperties.keys() \ - and pkgProperties["ICON"] != "": + if "ICON" in pkg_properties.keys() \ + and pkg_properties["ICON"] != "": # Resize all icon needed for Ios ... # TODO : Do not regenerate if source resource is not availlable # TODO : Add a colored background ... - debug.print_element("pkg", "iTunesArtwork.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/iTunesArtwork.png", 512, 512) - debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/iTunesArtwork@2x.png", 1024, 1024) - debug.print_element("pkg", "Icon-60@2x.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-60@2x.png", 120, 120) - debug.print_element("pkg", "Icon-76.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-76.png", 76, 76) - debug.print_element("pkg", "Icon-76@2x.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-76@2x.png", 152, 152) - debug.print_element("pkg", "Icon-Small-40.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small-40.png", 40, 40) - debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small-40@2x.png", 80, 80) - debug.print_element("pkg", "Icon-Small.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small.png", 29, 29) - debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkgProperties["ICON"]) - image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small@2x.png", 58, 58) + debug.print_element("pkg", "iTunesArtwork.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/iTunesArtwork.png", 512, 512) + debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/iTunesArtwork@2x.png", 1024, 1024) + debug.print_element("pkg", "Icon-60@2x.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-60@2x.png", 120, 120) + debug.print_element("pkg", "Icon-76.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-76.png", 76, 76) + debug.print_element("pkg", "Icon-76@2x.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-76@2x.png", 152, 152) + debug.print_element("pkg", "Icon-Small-40.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small-40.png", 40, 40) + debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small-40@2x.png", 80, 80) + debug.print_element("pkg", "Icon-Small.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small.png", 29, 29) + debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkg_properties["ICON"]) + image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small@2x.png", 58, 58) debug.print_element("pkg", "PkgInfo", "<==", "APPL????") - infoFile = self.get_staging_path(pkgName) + "/PkgInfo" + infoFile = self.get_staging_path(pkg_name) + "/PkgInfo" # Create the info file tmpFile = open(infoFile, 'w') tmpFile.write("APPL????") @@ -128,11 +129,11 @@ class Target(target.Target): dataFile += " CFBundleDevelopmentRegion\n" dataFile += " en\n" dataFile += " CFBundleDisplayName\n" - dataFile += " " + pkgProperties["NAME"] + "\n" + dataFile += " " + pkg_properties["NAME"] + "\n" dataFile += " CFBundleExecutable\n" - dataFile += " " + pkgName + "\n" + dataFile += " " + pkg_name + "\n" dataFile += " CFBundleIdentifier\n" - dataFile += " com." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "\n" + dataFile += " com." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "\n" dataFile += " CFBundleIconFiles\n" dataFile += " \n" @@ -150,7 +151,7 @@ class Target(target.Target): dataFile += " CFBundleInfoDictionaryVersion\n" dataFile += " 6.0\n" dataFile += " CFBundleName\n" - dataFile += " " + pkgName + "\n" + dataFile += " " + pkg_name + "\n" dataFile += " CFBundlePackageType\n" dataFile += " APPL\n" dataFile += " CFBundleSignature\n" @@ -161,9 +162,9 @@ class Target(target.Target): dataFile += " \n" dataFile += " \n" dataFile += " CFBundleShortVersionString\n" - dataFile += " "+pkgProperties["VERSION"]+"\n" + dataFile += " "+pkg_properties["VERSION"]+"\n" dataFile += " CFBundleVersion\n" - dataFile += " "+pkgProperties["VERSION_CODE"]+"\n" + dataFile += " "+pkg_properties["VERSION_CODE"]+"\n" dataFile += " \n" dataFile += " CFBundleResourceSpecification\n" dataFile += " ResourceRules.plist\n" @@ -205,29 +206,29 @@ class Target(target.Target): dataFile += "\n" dataFile += "\n\n" - infoFile = self.get_staging_path(pkgName) + "/Info.plist" + infoFile = self.get_staging_path(pkg_name) + "/Info.plist" # Create the info file tmpFile = open(infoFile, 'w') tmpFile.write(dataFile) tmpFile.flush() tmpFile.close() """ - infoFile = self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist" + infoFile = self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist" # Create the info file tmpFile = open(infoFile, 'w') tmpFile.write(dataFile) tmpFile.flush() tmpFile.close() cmdLine = "builtin-infoPlistUtility " - cmdLine += " " + self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist " - cmdLine += " -genpkginfo " + self.get_staging_path(pkgName) + "/PkgInfo" + 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.sumulator == False: cmdLine += " -platform iphonesimulator " else: cmdLine += " -platform iphoneos " - cmdLine += " -o " + self.get_staging_path(pkgName) + "/" + "Info.plist" + cmdLine += " -o " + self.get_staging_path(pkg_name) + "/" + "Info.plist" multiprocess.run_command(cmdLine) """ """ @@ -273,7 +274,7 @@ class Target(target.Target): dataFile += "\n" dataFile += "\n\n" - infoFile = self.get_staging_path(pkgName) + "/ResourceRules.plist" + infoFile = self.get_staging_path(pkg_name) + "/ResourceRules.plist" # Create the info file tmpFile = open(infoFile, 'w') tmpFile.write(dataFile) @@ -291,7 +292,7 @@ class Target(target.Target): dataFile += "\n" dataFile += "\n\n" - infoFile = self.get_staging_path(pkgName) + "/Entitlements.plist" + infoFile = self.get_staging_path(pkg_name) + "/Entitlements.plist" # Create the info file tmpFile = open(infoFile, 'w') tmpFile.write(dataFile) @@ -310,21 +311,21 @@ class Target(target.Target): if self.sumulator == False: # Create the info file - tmpFile = open(self.get_build_path(pkgName) + "/worddown.xcent", 'w') + tmpFile = open(self.get_build_path(pkg_name) + "/worddown.xcent", 'w') tmpFile.write("\n") tmpFile.write("\n") tmpFile.write("\n") tmpFile.write(" \n") tmpFile.write(" application-identifier\n") try: - tmpFile.write(" " + pkgProperties["APPLE_APPLICATION_IOS_ID"] + "." + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "\n") + tmpFile.write(" " + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "\n") except: debug.error("Missing package property : APPLE_APPLICATION_IOS_ID") tmpFile.write(" get-task-allow\n") tmpFile.write(" \n") tmpFile.write(" keychain-access-groups\n") tmpFile.write(" \n") - tmpFile.write(" " + pkgProperties["APPLE_APPLICATION_IOS_ID"] + ".atriasoft.worddown\n") + tmpFile.write(" " + pkg_properties["APPLE_APPLICATION_IOS_ID"] + ".atriasoft.worddown\n") tmpFile.write(" \n") tmpFile.write(" \n") tmpFile.write("\n") @@ -340,8 +341,8 @@ class Target(target.Target): cmdLine = 'codesign --force --sign ' # to get this key ; certtool y | grep "Developer" cmdLine += ' "' + signatureKey + '" ' - cmdLine += ' --entitlements ' + self.get_build_path(pkgName) + '/worddown.xcent' - cmdLine += ' ' + self.get_staging_path(pkgName) + cmdLine += ' --entitlements ' + self.get_build_path(pkg_name) + '/worddown.xcent' + cmdLine += ' ' + self.get_staging_path(pkg_name) multiprocess.run_command(cmdLine) # --force --sign "iPhone Developer: Edouard DUPIN (SDFGSDFGSDFG)" @@ -356,9 +357,9 @@ class Target(target.Target): out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]) return out - def install_package(self, pkgName): + def install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Install package '" + pkgName + "'") + debug.info("Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") if self.sumulator == False: if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: @@ -368,10 +369,10 @@ class Target(target.Target): if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: debug.error("Can not create ios-deploy external software ...") debug.print_element("deploy", "iphone/ipad", "<==", "aplication") - cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_path(pkgName) + cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_path(pkg_name) multiprocess.run_command(cmdLine) else: - simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt" + simulatorIdFile = ".iosSimutatorId_" + pkg_name + ".txt" if tools.file_size(simulatorIdFile) < 10: #create the file: tmpFile = open(simulatorIdFile, 'w') @@ -389,31 +390,31 @@ class Target(target.Target): simulatorId = tools.file_read_data(simulatorIdFile) home = os.path.expanduser("~") destinationpathBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId - destinationpath = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app" - destinationpath2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app" + destinationpath = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkg_name + ".app" + destinationpath2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkg_name + ".app" debug.info("install in simulator : " + destinationpath) tools.create_directory_of_file(destinationpath + "/plop.txt") - cmdLine = "cp -rf " + self.get_staging_path(pkgName) + " " + destinationpath2 + cmdLine = "cp -rf " + self.get_staging_path(pkg_name) + " " + destinationpath2 multiprocess.run_command(cmdLine) cmdLine = "touch " + destinationpathBase multiprocess.run_command(cmdLine) #sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package - def un_install_package(self, pkgName): + def un_install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Un-Install package '" + pkgName + "'") + debug.info("Un-Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") if self.sumulator == False: debug.warning("not implemented") else: - simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt" + simulatorIdFile = ".iosSimutatorId_" + pkg_name + ".txt" if tools.file_size(simulatorIdFile) < 10: debug.warning("Can not get simulation O_ID : " + simulatorIdFile) #sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package - def Log(self, pkgName): + def Log(self, pkg_name): debug.debug("------------------------------------------------------------------------") debug.info("log of iOs board") debug.debug("------------------------------------------------------------------------") @@ -425,7 +426,7 @@ class Target(target.Target): if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: debug.error("Can not create ios-deploy external software ...") debug.print_element("deploy", "iphone/ipad", "<==", "aplication") - cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_path(pkgName) + cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_path(pkg_name) multiprocess.run_command(cmdLine) else: cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log" diff --git a/lutin/z_target/lutinTarget_Linux.py b/lutin/z_target/lutinTarget_Linux.py index 9930272..0077bdf 100644 --- a/lutin/z_target/lutinTarget_Linux.py +++ b/lutin/z_target/lutinTarget_Linux.py @@ -36,19 +36,14 @@ class Target(target.Target): self.global_flags_cc.append("-fpic") self.global_flags_cc.append("-D__STDCPP_GNU__") + + + self.pkg_path_data = "share" + self.pkg_path_bin = "bin" + self.pkg_path_lib = "lib" + self.pkg_path_license = "license" - def generate_list_separate_coma(self, list): - result = "" - fistTime = True - for elem in list: - if fistTime == True: - fistTime = False - else: - result += "," - result += elem - return result - - def make_package(self, pkg_name, pkgProperties, basePkgPath, heritage_list, type="generic"): + 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) @@ -64,18 +59,18 @@ class Target(target.Target): return if module.get_type() == 'BINARY' \ or module.get_type() == 'BINARY_STAND_ALONE': - self.make_package_generic_binary(pkg_name, pkgProperties, basePkgPath, heritage_list, static = True) + 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, pkgProperties, basePkgPath, heritage_list, static = False) + 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, pkgProperties, basePkgPath, heritage_list) + self.make_package_debian(pkg_name, pkg_properties, base_pkg_path, heritage_list) elif type == "generic": - self.make_package_generic(pkg_name, pkgProperties, basePkgPath, heritage_list) + self.make_package_generic(pkg_name, pkg_properties, base_pkg_path, heritage_list) """ @@ -108,11 +103,9 @@ class Target(target.Target): * *--> YY *--> sources """ - def make_package_generic_binary(self, pkg_name, pkgProperties, basePkgPath, heritage_list, static): - debianpkg_name = re.sub("_", "-", pkg_name) - + def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): debug.debug("------------------------------------------------------------------------") - debug.info("Generate generic '" + debianpkg_name + "' v"+pkgProperties["VERSION"]) + debug.info("Generate generic '" + pkg_name + "' v"+pkg_properties["VERSION"]) debug.debug("------------------------------------------------------------------------") #output path target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") @@ -120,9 +113,9 @@ class Target(target.Target): ## Create share datas if static == True: - target_outpath_data = os.path.join(target_outpath, "share", pkg_name) + target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name) else: - target_outpath_data = os.path.join(target_outpath, "share") + 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: @@ -139,8 +132,8 @@ class Target(target.Target): #copy all data: tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True) - ## Create share datas - target_outpath_bin = os.path.join(target_outpath, "bin") + ## copy binary files + 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) @@ -150,7 +143,7 @@ class Target(target.Target): ## Create libraries if static == False: #copy all shred libs... - target_outpath_lib = os.path.join(target_outpath, "lib") + 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: @@ -165,36 +158,36 @@ class Target(target.Target): ## Create version file tmpFile = open(target_outpath + "/version.txt", 'w') - tmpFile.write(pkgProperties["VERSION"]) + tmpFile.write(pkg_properties["VERSION"]) tmpFile.flush() tmpFile.close() ## Create maintainer file tmpFile = open(target_outpath + "/maintainer.txt", 'w') - tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"])) + tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"])) tmpFile.flush() tmpFile.close() ## Create appl_name file tmpFile = open(target_outpath + "/appl_name.txt", 'w') - tmpFile.write("en_EN:" + pkgProperties["NAME"]) + tmpFile.write("en_EN:" + pkg_properties["NAME"]) tmpFile.flush() tmpFile.close() ## Create appl_description file tmpFile = open(target_outpath + "/appl_description.txt", 'w') - tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"]) + tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"]) tmpFile.flush() tmpFile.close() ## Create Readme file readmeFileDest = target_outpath + "/readme.txt" - if os.path.exists(basePkgPath + "/os-Linux/README")==True: - tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) - elif os.path.exists(basePkgPath + "/README")==True: - tools.copy_file(basePkgPath + "/README", readmeFileDest) - elif os.path.exists(basePkgPath + "/README.md")==True: - tools.copy_file(basePkgPath + "/README.md", 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') @@ -203,10 +196,10 @@ class Target(target.Target): tmpFile.close() ## Create licence file - licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".txt" + licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt") tools.create_directory_of_file(licenseFileDest) - if os.path.exists(basePkgPath + "/license.txt")==True: - tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) + if os.path.exists(base_pkg_path + "/license.txt")==True: + tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest) else: debug.info("no file 'license.txt' ==> generate an empty one") tmpFile = open(licenseFileDest, 'w') @@ -216,8 +209,8 @@ class Target(target.Target): ## Create changeLog file changeLogFileDest = target_outpath + "/changelog.txt" - if os.path.exists(basePkgPath + "/changelog") == True: - tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) + if os.path.exists(base_pkg_path + "/changelog") == True: + tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest) else: debug.info("no file 'changelog' ==> generate an empty one") tmpFile = open(changeLogFileDest, 'w') @@ -225,30 +218,20 @@ class Target(target.Target): tmpFile.flush() tmpFile.close() - ## copy share path - #debug.info("plop:" + self.get_staging_path(pkg_name) + self.path_data) - if os.path.exists(self.get_staging_path(pkg_name) + self.path_data) == True: - tools.copy_anything(self.get_staging_path(pkg_name) + self.path_data + "/*", target_outpath + self.path_data, recursive=True) - - ## Create binary path: - bin_path = target_outpath + self.path_bin - #tools.create_directory_of_file(bin_path) - tools.copy_anything(self.get_staging_path(pkg_name) + self.path_bin + "/*", - bin_path) ## create the package: - debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".app.pkg") + debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg") os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") #multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") tools.create_directory_of_file(self.get_final_path()) tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg") - def make_package_debian(self, pkg_name, pkgProperties, basePkgPath, heritage_list): + def make_package_debian(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): # http://alp.developpez.com/tutoriels/debian/creer-paquet/ debianpkg_name = re.sub("_", "-", pkg_name) debug.debug("------------------------------------------------------------------------") - debug.info("Generate package '" + debianpkg_name + "' v"+pkgProperties["VERSION"]) + debug.info("Generate package '" + debianpkg_name + "' v"+pkg_properties["VERSION"]) debug.debug("------------------------------------------------------------------------") self.get_staging_path(pkg_name) target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/" @@ -261,13 +244,13 @@ class Target(target.Target): tools.create_directory_of_file(finalFileControl) tmpFile = open(finalFileControl, 'w') tmpFile.write("Package: " + debianpkg_name + "\n") - tmpFile.write("Version: " + pkgProperties["VERSION"] + "\n") - tmpFile.write("Section: " + self.generate_list_separate_coma(pkgProperties["SECTION"]) + "\n") - tmpFile.write("Priority: " + pkgProperties["PRIORITY"] + "\n") + tmpFile.write("Version: " + pkg_properties["VERSION"] + "\n") + tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n") + tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n") tmpFile.write("Architecture: all\n") tmpFile.write("Depends: bash\n") - tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkgProperties["MAINTAINER"]) + "\n") - tmpFile.write("Description: " + pkgProperties["DESCRIPTION"] + "\n") + tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n") + tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n") tmpFile.write("\n") tmpFile.flush() tmpFile.close() @@ -286,12 +269,12 @@ class Target(target.Target): ## 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(basePkgPath + "/os-Linux/README")==True: - tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) - elif os.path.exists(basePkgPath + "/README")==True: - tools.copy_file(basePkgPath + "/README", readmeFileDest) - elif os.path.exists(basePkgPath + "/README.md")==True: - tools.copy_file(basePkgPath + "/README.md", 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') @@ -301,8 +284,8 @@ class Target(target.Target): ## licence file licenseFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright" tools.create_directory_of_file(licenseFileDest) - if os.path.exists(basePkgPath + "/license.txt")==True: - tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) + if os.path.exists(base_pkg_path + "/license.txt")==True: + tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest) else: debug.info("no file 'license.txt' ==> generate an empty one") tmpFile = open(licenseFileDest, 'w') @@ -312,8 +295,8 @@ class Target(target.Target): ##changeLog file changeLogFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog" tools.create_directory_of_file(changeLogFileDest) - if os.path.exists(basePkgPath + "/changelog")==True: - tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) + if os.path.exists(base_pkg_path + "/changelog")==True: + tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest) else: debug.info("no file 'changelog' ==> generate an empty one") tmpFile = open(changeLogFileDest, 'w') @@ -368,44 +351,44 @@ class Target(target.Target): * *--> YY *--> sources """ - def make_package_generic(self, pkg_name, pkgProperties, basePkgPath, heritage_list): + def make_package_generic(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): debug.warning("heritage for " + str(pkg_name) + ":") for heritage in heritage_list.list_heritage: debug.warning("heritage .... " + str(heritage.name) + " : " + str(heritage.depends)) debianpkg_name = re.sub("_", "-", pkg_name) debug.debug("------------------------------------------------------------------------") - debug.info("Generate generic '" + debianpkg_name + "' v"+pkgProperties["VERSION"]) + debug.info("Generate generic '" + debianpkg_name + "' v"+pkg_properties["VERSION"]) debug.debug("------------------------------------------------------------------------") target_outpath = self.get_staging_path(pkg_name) + "/edn.app/" tools.create_directory_of_file(target_outpath) ## Create version file tmpFile = open(target_outpath + "/version.txt", 'w') - tmpFile.write(pkgProperties["VERSION"]) + tmpFile.write(pkg_properties["VERSION"]) tmpFile.flush() tmpFile.close() ## Create maintainer file tmpFile = open(target_outpath + "/maintainer.txt", 'w') - tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"])) + tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"])) tmpFile.flush() tmpFile.close() ## Create appl_name file tmpFile = open(target_outpath + "/appl_name.txt", 'w') - tmpFile.write("en_EN:" + pkgProperties["NAME"]) + tmpFile.write("en_EN:" + pkg_properties["NAME"]) tmpFile.flush() tmpFile.close() ## Create appl_description file tmpFile = open(target_outpath + "/appl_description.txt", 'w') - tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"]) + tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"]) tmpFile.flush() tmpFile.close() ## Create Readme file readmeFileDest = target_outpath + "/readme.txt" - if os.path.exists(basePkgPath + "/os-Linux/README")==True: - tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) - elif os.path.exists(basePkgPath + "/README")==True: - tools.copy_file(basePkgPath + "/README", readmeFileDest) - elif os.path.exists(basePkgPath + "/README.md")==True: - tools.copy_file(basePkgPath + "/README.md", 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') @@ -415,8 +398,8 @@ class Target(target.Target): ## Create licence file licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".txt" tools.create_directory_of_file(licenseFileDest) - if os.path.exists(basePkgPath + "/license.txt")==True: - tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) + if os.path.exists(base_pkg_path + "/license.txt")==True: + tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest) else: debug.info("no file 'license.txt' ==> generate an empty one") tmpFile = open(licenseFileDest, 'w') @@ -425,8 +408,8 @@ class Target(target.Target): tmpFile.close() ## Create changeLog file changeLogFileDest = target_outpath + "/changelog.txt" - if os.path.exists(basePkgPath + "/changelog") == True: - tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) + if os.path.exists(base_pkg_path + "/changelog") == True: + tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest) else: debug.info("no file 'changelog' ==> generate an empty one") tmpFile = open(changeLogFileDest, 'w') diff --git a/lutin/z_target/lutinTarget_MacOs.py b/lutin/z_target/lutinTarget_MacOs.py index 2ce773f..15482b7 100644 --- a/lutin/z_target/lutinTarget_MacOs.py +++ b/lutin/z_target/lutinTarget_MacOs.py @@ -28,36 +28,36 @@ class Target(target.Target): # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt target.Target.__init__(self, "MacOs", config, "") - self.path_bin="MacOS" - self.path_lib="lib" - self.path_data="Resources" - self.path_doc="doc" + #self.path_bin="MacOS" + #self.path_lib="lib" + #self.path_data="Resources" + #self.path_doc="doc" self.suffix_lib_static='.a' self.suffix_lib_dynamic='.dylib' - self.suffix_binary='' - self.suffix_package='' + #self.suffix_binary='' + #self.suffix_package='' self.global_flags_cc.append("-D__STDCPP_LLVM__") - def get_staging_path(self, binaryName): - return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/Contents/" + def get_staging_path(self, binary_name): + return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/Contents/" - def get_staging_path_data(self, binaryName): - return self.get_staging_path(binaryName) + self.path_data + "/" + def get_staging_path_data(self, binary_name): + return self.get_staging_path(binary_name) + self.path_data + "/" - def make_package(self, pkgName, pkgProperties, basePkgPath): + def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): debug.debug("------------------------------------------------------------------------") - debug.info("Generate package '" + pkgName + "'") + debug.info("Generate package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") - if "ICON" in pkgProperties.keys() \ - and pkgProperties["ICON"] != "": - tools.copy_file(pkgProperties["ICON"], self.get_staging_path_data(pkgName) + "/icon.icns", force=True) + if "ICON" in pkg_properties.keys() \ + and pkg_properties["ICON"] != "": + tools.copy_file(pkg_properties["ICON"], self.get_staging_path_data(pkg_name) + "/icon.icns", force=True) # http://www.sandroid.org/imcross/#Deployment - infoFile=self.get_staging_path(pkgName) + "/Info.plist" + infoFile=self.get_staging_path(pkg_name) + "/Info.plist" # Create the info file tmpFile = open(infoFile, 'w') tmpFile.write("\n") @@ -65,11 +65,11 @@ class Target(target.Target): tmpFile.write("\n") tmpFile.write(" \n") tmpFile.write(" CFBundleExecutableFile\n") - tmpFile.write(" "+pkgName+"\n") + tmpFile.write(" "+pkg_name+"\n") tmpFile.write(" CFBundleName\n") - tmpFile.write(" "+pkgName+"\n") + tmpFile.write(" "+pkg_name+"\n") tmpFile.write(" CFBundleIdentifier\n") - tmpFile.write(" " + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "\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") @@ -79,7 +79,7 @@ class Target(target.Target): tmpFile.write("\n\n") tmpFile.flush() tmpFile.close() - infoFile=self.get_staging_path(pkgName) + "/PkgInfo" + infoFile=self.get_staging_path(pkg_name) + "/PkgInfo" # Create the info file tmpFile = open(infoFile, 'w') tmpFile.write("APPL????") @@ -87,24 +87,24 @@ class Target(target.Target): tmpFile.close() # Create a simple interface to localy install the aplication for the shell (a shell command line interface) - shell_file_name=self.get_staging_path(pkgName) + "/shell/" + pkgName + shell_file_name=self.get_staging_path(pkg_name) + "/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/" + pkgName + ".app/Contents/MacOS/" + pkgName + " $*\n") + tmpFile.write("/Applications/" + pkg_name + ".app/Contents/MacOS/" + pkg_name + " $*\n") #tmpFile.write("open -n /Applications/edn.app --args -AppCommandLineArg $*\n") tmpFile.flush() tmpFile.close() # Must create the disk image of the application - debug.info("Generate disk image for '" + pkgName + "'") - output_file_name = self.get_final_path() + "/" + pkgName + ".dmg" + debug.info("Generate disk image for '" + pkg_name + "'") + output_file_name = self.get_final_path() + "/" + pkg_name + ".dmg" cmd = "hdiutil create -volname " - cmd += pkgName + " -srcpath " - cmd += tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app" + cmd += pkg_name + " -srcpath " + cmd += 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) @@ -114,24 +114,24 @@ class Target(target.Target): debug.info("You can have an shell interface by executing : ") debug.info(" sudo cp " + shell_file_name + " /usr/local/bin") - def install_package(self, pkgName): + def install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Install package '" + pkgName + "'") + debug.info("Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") - debug.info("copy " + tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app in /Applications/") - if os.path.exists("/Applications/" + pkgName + ".app") == True: - shutil.rmtree("/Applications/" + pkgName + ".app") + debug.info("copy " + tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app in /Applications/") + if os.path.exists("/Applications/" + pkg_name + ".app") == True: + shutil.rmtree("/Applications/" + pkg_name + ".app") # copy the application in the basic application path : /Applications/xxx.app - shutil.copytree(tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app") + shutil.copytree(tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app", "/Applications/" + pkg_name + ".app") - def un_install_package(self, pkgName): + def un_install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Un-Install package '" + pkgName + "'") + debug.info("Un-Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") - debug.info("remove OLD application /Applications/" + pkgName + ".app") + debug.info("remove OLD application /Applications/" + pkg_name + ".app") # Remove the application in the basic application path : /Applications/xxx.app - if os.path.exists("/Applications/" + pkgName + ".app") == True: - shutil.rmtree("/Applications/" + pkgName + ".app") + if os.path.exists("/Applications/" + pkg_name + ".app") == True: + shutil.rmtree("/Applications/" + pkg_name + ".app") diff --git a/lutin/z_target/lutinTarget_Windows.py b/lutin/z_target/lutinTarget_Windows.py index d5b16a9..e658bd8 100644 --- a/lutin/z_target/lutinTarget_Windows.py +++ b/lutin/z_target/lutinTarget_Windows.py @@ -50,38 +50,168 @@ class Target(target.Target): "-static-libstdc++", "-static"]) - self.path_bin="" - self.path_lib="lib" - self.path_data="data" - self.path_doc="doc" + #self.path_bin="" + #self.path_lib="lib" + #self.path_data="data" + #self.path_doc="doc" + + self.pkg_path_data = "data" + self.pkg_path_bin = "" + self.pkg_path_lib = "lib" + self.pkg_path_license = "license" self.suffix_lib_static='.a' self.suffix_lib_dynamic='.dll' self.suffix_binary='.exe' - self.suffix_package='' + #self.suffix_package='' self.global_flags_cc.append("-D__STDCPP_GNU__") - def get_staging_path_data(self, binaryName): - return self.get_staging_path(binaryName) + self.path_data + def get_staging_path_data(self, binary_name, heritage_list): + return self.get_staging_path(binary_name) + self.path_data - def make_package(self, pkgName, pkgProperties, basePkgPath): + 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 '" + pkgName + "'") + debug.info("Generate package '" + pkg_name + "'") + debug.debug("------------------------------------------------------------------------") + #output path + target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") + 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) + + ## copy binary files + 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) + + ## Create version file + tmpFile = open(target_outpath + "/version.txt", 'w') + tmpFile.write(pkg_properties["VERSION"]) + tmpFile.flush() + tmpFile.close() + + ## Create maintainer file + tmpFile = open(target_outpath + "/maintainer.txt", 'w') + tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"])) + tmpFile.flush() + tmpFile.close() + + ## Create appl_name file + tmpFile = open(target_outpath + "/appl_name.txt", 'w') + tmpFile.write("en_EN:" + pkg_properties["NAME"]) + tmpFile.flush() + tmpFile.close() + + ## Create appl_description file + tmpFile = open(target_outpath + "/appl_description.txt", 'w') + tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"]) + tmpFile.flush() + tmpFile.close() + + ## Create Readme file + readmeFileDest = 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) + elif os.path.exists(base_pkg_path + "/README")==True: + tools.copy_file(base_pkg_path + "/README", readmeFileDest) + elif os.path.exists(base_pkg_path + "/README.md")==True: + tools.copy_file(base_pkg_path + "/README.md", readmeFileDest) + else: + debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one") + tmpFile = open(readmeFileDest, 'w') + tmpFile.write("No documentation for " + pkg_name + "\n") + tmpFile.flush() + tmpFile.close() + + ## Create licence file + licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt") + tools.create_directory_of_file(licenseFileDest) + if os.path.exists(base_pkg_path + "/license.txt")==True: + tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest) + 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() + + ## Create changeLog file + changeLogFileDest = target_outpath + "/changelog.txt" + if os.path.exists(base_pkg_path + "/changelog") == True: + tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest) + 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() + + + + def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): + debug.debug("------------------------------------------------------------------------") + debug.info("Generate package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") debug.print_element("zip", "data.zip", "<==", "data/*") - zipPath = self.get_staging_path(pkgName) + "/data.zip" - zip.create_zip(self.get_staging_path_data(pkgName), zipPath) + zipPath = self.get_staging_path(pkg_name) + "/data.zip" + zip.create_zip(self.get_staging_path_data(pkg_name), zipPath) - binPath = self.get_staging_path(pkgName) + "/" + self.path_bin + "/" + pkgName + self.suffix_binary + binPath = self.get_staging_path(pkg_name) + "/" + self.path_bin + "/" + pkg_name + self.suffix_binary binSize = tools.file_size(binPath) debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets") #now we create a simple bundle binary ==> all file is stored in one file ... - self.get_staging_path(pkgName) - finalBin = self.get_final_path() + "/" + pkgName + self.suffix_binary + self.get_staging_path(pkg_name) + finalBin = self.get_final_path() + "/" + pkg_name + self.suffix_binary tools.create_directory_of_file(finalBin); - debug.print_element("pkg", finalBin, "<==", pkgName + self.suffix_binary) + debug.print_element("pkg", finalBin, "<==", pkg_name + self.suffix_binary) #open output file tmpFile = open(finalBin, 'wb') # read all executable binary @@ -118,16 +248,16 @@ class Target(target.Target): tmpFile.close() debug.verbose("zip position=" + str(positionOfZip) + " = 0x" + h) - def install_package(self, pkgName): + def install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Install package '" + pkgName + "'") + debug.info("Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") debug.warning(" ==> TODO") #sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package - def un_install_package(self, pkgName): + def un_install_package(self, pkg_name): debug.debug("------------------------------------------------------------------------") - debug.info("Un-Install package '" + pkgName + "'") + debug.info("Un-Install package '" + pkg_name + "'") debug.debug("------------------------------------------------------------------------") debug.warning(" ==> TODO") #sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package