[DEV] start add unitary test
This commit is contained in:
parent
6c416c9fef
commit
0b33c94680
60
.travis.yml
Normal file
60
.travis.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#language: python
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-4.9
|
||||||
|
- expect
|
||||||
|
- binutils-mingw-w64-i686
|
||||||
|
- gcc-mingw-w64-i686
|
||||||
|
- g++-mingw-w64-i686
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux
|
||||||
|
- os: linux
|
||||||
|
env: CONF=debug BUILDER=clang TARGET=Linux
|
||||||
|
- os: linux
|
||||||
|
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
|
||||||
|
- os: linux
|
||||||
|
env: CONF=debug BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
|
||||||
|
- os: osx
|
||||||
|
env: CONF=release BUILDER=clang TARGET=MacOs TAG=MacOs
|
||||||
|
- os: osx
|
||||||
|
env: CONF=release BUILDER=clang TARGET=IOs TAG=IOs
|
||||||
|
|
||||||
|
install:
|
||||||
|
- cd ..
|
||||||
|
# download NDK
|
||||||
|
- if [ "$TAG" == "Android" ]; then
|
||||||
|
git clone --depth 1 --branch master https://github.com/HeeroYui/android-download-tool;
|
||||||
|
./android-download-tool/dl-android.sh;
|
||||||
|
fi
|
||||||
|
- git clone --depth 1 --branch master https://github.com/atria-soft/ci.git
|
||||||
|
- cd -
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- ./setup.py build
|
||||||
|
- export PYTHONPATH=$PYTHONPATH:./lutin/build/lib.linux-x86_64-2.7/:./lutin/build/lib.linux-x86_64-2.7/lutin/:./lutin/build/lib:./lutin/build/lib/lutin/
|
||||||
|
- cd ..
|
||||||
|
- pwd
|
||||||
|
- ls -l *
|
||||||
|
- ./ci/build_send.py --tag=$TAG --status=START;
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./lutin/build/scripts-2.7/lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE test-c; STATUS=$?
|
||||||
|
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
- yui.heero@gmail.com
|
43
README.rst
43
README.rst
@ -3,9 +3,52 @@ Lutin
|
|||||||
|
|
||||||
`lutin` is a generic builder and package maker is a FREE software tool.
|
`lutin` is a generic builder and package maker is a FREE software tool.
|
||||||
|
|
||||||
|
|
||||||
.. image:: https://badge.fury.io/py/lutin.png
|
.. image:: https://badge.fury.io/py/lutin.png
|
||||||
:target: https://pypi.python.org/pypi/lutin
|
:target: https://pypi.python.org/pypi/lutin
|
||||||
|
|
||||||
|
Release (master)
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=master
|
||||||
|
:target: https://travis-ci.org/HeeroYui/lutin
|
||||||
|
|
||||||
|
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Linux
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=MacOs
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Mingw
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
|
||||||
|
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Android
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=IOs
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
|
||||||
|
|
||||||
|
Developement (dev)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=dev
|
||||||
|
:target: https://travis-ci.org/HeeroYui/lutin
|
||||||
|
|
||||||
|
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Linux
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=MacOs
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Mingw
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
|
||||||
|
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Android
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=IOs
|
||||||
|
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||||
|
|
||||||
|
|
||||||
Instructions
|
Instructions
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
@ -83,17 +83,17 @@ class Module:
|
|||||||
self.origin_path = tools.get_current_path(self.origin_file)
|
self.origin_path = tools.get_current_path(self.origin_file)
|
||||||
self.local_heritage = heritage.heritage(self, None)
|
self.local_heritage = heritage.heritage(self, None)
|
||||||
|
|
||||||
self.package_prop = { "COMPAGNY_TYPE" : set(""),
|
self.package_prop = { "COMPAGNY_TYPE" : "",
|
||||||
"COMPAGNY_NAME" : set(""),
|
"COMPAGNY_NAME" : "",
|
||||||
"COMPAGNY_NAME2" : set(""),
|
"COMPAGNY_NAME2" : "",
|
||||||
"MAINTAINER" : set([]),
|
"MAINTAINER" : [],
|
||||||
#"ICON" : set(""),
|
#"ICON" : set(""),
|
||||||
"SECTION" : set([]),
|
"SECTION" : [],
|
||||||
"PRIORITY" : set(""),
|
"PRIORITY" : "",
|
||||||
"DESCRIPTION" : set(""),
|
"DESCRIPTION" : "",
|
||||||
"VERSION" : [0,0,0],
|
"VERSION" : [0,0,0],
|
||||||
"VERSION_CODE" : "",
|
"VERSION_CODE" : "",
|
||||||
"NAME" : set("no-name"), # name of the application
|
"NAME" : "no-name", # name of the application
|
||||||
"ANDROID_MANIFEST" : "", # By default generate the manifest
|
"ANDROID_MANIFEST" : "", # By default generate the manifest
|
||||||
"ANDROID_RESOURCES" : [],
|
"ANDROID_RESOURCES" : [],
|
||||||
"ANDROID_APPL_TYPE" : "APPL", # the other mode is "WALLPAPER" ... and later "WIDGET"
|
"ANDROID_APPL_TYPE" : "APPL", # the other mode is "WALLPAPER" ... and later "WIDGET"
|
||||||
@ -135,9 +135,10 @@ class Module:
|
|||||||
"-Wreturn-type",
|
"-Wreturn-type",
|
||||||
#"-Wint-to-pointer-cast",
|
#"-Wint-to-pointer-cast",
|
||||||
"-Wno-write-strings",
|
"-Wno-write-strings",
|
||||||
"-Woverloaded-virtual",
|
|
||||||
"-Wnon-virtual-dtor",
|
|
||||||
"-Wno-unused-variable"]);
|
"-Wno-unused-variable"]);
|
||||||
|
self.compile_flags('c++', [
|
||||||
|
"-Woverloaded-virtual",
|
||||||
|
"-Wnon-virtual-dtor"]);
|
||||||
#only for gcc : "-Wunused-variable", "-Wunused-but-set-variable",
|
#only for gcc : "-Wunused-variable", "-Wunused-but-set-variable",
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -50,6 +50,8 @@ def remove_path_and_sub_path(path):
|
|||||||
def remove_file(path):
|
def remove_file(path):
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
elif os.path.islink(path):
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
def file_size(path):
|
def file_size(path):
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
|
@ -87,19 +87,35 @@ class Target(target.Target):
|
|||||||
self.pkg_path_lib = "data/lib/armeabi"
|
self.pkg_path_lib = "data/lib/armeabi"
|
||||||
self.pkg_path_license = "license"
|
self.pkg_path_license = "license"
|
||||||
|
|
||||||
# board id at 15 is for android 4.0.3 and more ... (note: API 14 has been removed ...)
|
# If the env variable is not define, find the newest version of the BOARD_ID (Note: 0: autofind)
|
||||||
self.boardId = 15
|
self.board_id = int(os.getenv('PROJECT_NDK_BOARD_ID', "0"))
|
||||||
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
|
if self.board_id != 0:
|
||||||
|
# check if element existed :
|
||||||
|
if not os.path.isdir(self.path_ndk +"/platforms/android-" + str(self.board_id)):
|
||||||
|
debug.error("Specify PROJECT_NDK_BOARD_ID env variable and the BOARD_ID does not exit ... : " + str(self.board_id) + "==> auto-search")
|
||||||
|
self.board_id = 0
|
||||||
|
if self.board_id == 0:
|
||||||
|
debug.debug("Auto-search BOARD-ID")
|
||||||
|
for iii in reversed(range(0, 50)):
|
||||||
|
debug.debug("try: " + self.path_ndk +"/platforms/android-" + str(iii))
|
||||||
|
if os.path.isdir(self.path_ndk +"/platforms/android-" + str(iii)):
|
||||||
|
debug.debug("Find BOARD-ID : " + str(iii))
|
||||||
|
self.board_id = iii
|
||||||
|
break;
|
||||||
|
if self.board_id == 0:
|
||||||
|
debug.error("Can not find BOARD-ID ==> update your android SDK")
|
||||||
|
|
||||||
|
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.board_id))
|
||||||
if arch == "armv5" or arch == "armv7":
|
if arch == "armv5" or arch == "armv7":
|
||||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.board_id) + "/arch-arm/usr/include/")
|
||||||
elif arch == "mips":
|
elif arch == "mips":
|
||||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.board_id) + "/arch-mips/usr/include/")
|
||||||
elif arch == "x86":
|
elif arch == "x86":
|
||||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
|
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.board_id) + "/arch-x86/usr/include/")
|
||||||
|
|
||||||
if True:
|
if True:
|
||||||
if self.config["compilator"] == "clang":
|
if self.config["compilator"] == "clang":
|
||||||
if self.boardId < 21:
|
if self.board_id < 21:
|
||||||
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
||||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||||
# llvm-libc++ : BSD | MIT
|
# llvm-libc++ : BSD | MIT
|
||||||
@ -158,9 +174,9 @@ class Target(target.Target):
|
|||||||
else :
|
else :
|
||||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/system/include/")
|
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/system/include/")
|
||||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/stlport/stlport/")
|
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/stlport/stlport/")
|
||||||
self.global_flags_ld.append(self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a")
|
self.global_flags_ld.append(self.path_ndk +"/platforms/android-" + str(self.board_id) + "/arch-arm/usr/lib/libstdc++.a")
|
||||||
|
|
||||||
self.global_sysroot = "--sysroot=" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm"
|
self.global_sysroot = "--sysroot=" + self.path_ndk +"/platforms/android-" + str(self.board_id) + "/arch-arm"
|
||||||
|
|
||||||
self.global_flags_cc.append("-D__ARM_ARCH_5__")
|
self.global_flags_cc.append("-D__ARM_ARCH_5__")
|
||||||
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
||||||
@ -266,16 +282,27 @@ class Target(target.Target):
|
|||||||
pkg_name_application_name = pkg_name
|
pkg_name_application_name = pkg_name
|
||||||
if self.config["mode"] == "debug":
|
if self.config["mode"] == "debug":
|
||||||
pkg_name_application_name += "debug"
|
pkg_name_application_name += "debug"
|
||||||
|
debug.info("ploppppp: " + str(pkg_properties))
|
||||||
# FINAL_path_JAVA_PROJECT
|
# FINAL_path_JAVA_PROJECT
|
||||||
self.path_java_project = os.path.join(target_outpath,
|
self.path_java_project = os.path.join(target_outpath,
|
||||||
"src",
|
"src")
|
||||||
pkg_properties["COMPAGNY_TYPE"],
|
if pkg_properties["COMPAGNY_TYPE"] != "":
|
||||||
pkg_properties["COMPAGNY_NAME2"],
|
self.path_java_project = os.path.join(self.path_java_project,
|
||||||
|
pkg_properties["COMPAGNY_TYPE"])
|
||||||
|
if pkg_properties["COMPAGNY_NAME2"] != "":
|
||||||
|
self.path_java_project = os.path.join(self.path_java_project,
|
||||||
|
pkg_properties["COMPAGNY_NAME2"])
|
||||||
|
self.path_java_project = os.path.join(self.path_java_project,
|
||||||
pkg_name_application_name)
|
pkg_name_application_name)
|
||||||
#FINAL_FILE_ABSTRACTION
|
#FINAL_FILE_ABSTRACTION
|
||||||
self.file_final_abstraction = os.path.join(self.path_java_project, pkg_name_application_name + ".java")
|
self.file_final_abstraction = os.path.join(self.path_java_project, pkg_name_application_name + ".java")
|
||||||
|
|
||||||
compleatePackageName = pkg_properties["COMPAGNY_TYPE"]+"."+pkg_properties["COMPAGNY_NAME2"]+"." + pkg_name_application_name
|
compleatePackageName = ""
|
||||||
|
if pkg_properties["COMPAGNY_TYPE"] != "":
|
||||||
|
compleatePackageName += pkg_properties["COMPAGNY_TYPE"] + "."
|
||||||
|
if pkg_properties["COMPAGNY_NAME2"] != "":
|
||||||
|
compleatePackageName += pkg_properties["COMPAGNY_NAME2"] + "."
|
||||||
|
compleatePackageName += pkg_name_application_name
|
||||||
|
|
||||||
if "ADMOD_ID" in pkg_properties:
|
if "ADMOD_ID" in pkg_properties:
|
||||||
pkg_properties["RIGHT"].append("INTERNET")
|
pkg_properties["RIGHT"].append("INTERNET")
|
||||||
@ -335,7 +362,7 @@ class Target(target.Target):
|
|||||||
cmdLine = androidToolPath + "aapt p -f " \
|
cmdLine = androidToolPath + "aapt p -f " \
|
||||||
+ "-M " + target_outpath + "/AndroidManifest.xml " \
|
+ "-M " + target_outpath + "/AndroidManifest.xml " \
|
||||||
+ "-F " + target_outpath + "/resources.res " \
|
+ "-F " + target_outpath + "/resources.res " \
|
||||||
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
|
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar "\
|
||||||
+ "-S " + target_outpath + "/res/ " \
|
+ "-S " + target_outpath + "/res/ " \
|
||||||
+ adModResoucepath \
|
+ adModResoucepath \
|
||||||
+ "-J " + target_outpath + "/src/ "
|
+ "-J " + target_outpath + "/src/ "
|
||||||
@ -360,7 +387,7 @@ class Target(target.Target):
|
|||||||
|
|
||||||
cmdLine = "javac " \
|
cmdLine = "javac " \
|
||||||
+ "-d " + self.get_staging_path(pkg_name) + "/build/classes " \
|
+ "-d " + self.get_staging_path(pkg_name) + "/build/classes " \
|
||||||
+ "-classpath " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
|
+ "-classpath " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar" \
|
||||||
+ adModJarFile + " " \
|
+ adModJarFile + " " \
|
||||||
+ filesString \
|
+ filesString \
|
||||||
+ self.file_final_abstraction + " " \
|
+ self.file_final_abstraction + " " \
|
||||||
|
@ -94,221 +94,50 @@ class Target(target.Target):
|
|||||||
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
## create the package:
|
## create the package:
|
||||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg")
|
debug.debug("package : " + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.pkg"))
|
||||||
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||||
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
|
||||||
tools.create_directory_of_file(self.get_final_path())
|
tools.create_directory_of_file(self.get_final_path())
|
||||||
tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
|
tools.copy_file(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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"+pkg_properties["VERSION"])
|
|
||||||
debug.debug("------------------------------------------------------------------------")
|
|
||||||
self.get_staging_path(pkg_name)
|
|
||||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
|
||||||
finalFileControl = target_outpathDebian + "control"
|
|
||||||
finalFilepostRm = target_outpathDebian + "postrm"
|
|
||||||
# create the paths :
|
|
||||||
tools.create_directory_of_file(finalFileControl)
|
|
||||||
tools.create_directory_of_file(finalFilepostRm)
|
|
||||||
## Create the control file
|
|
||||||
tools.create_directory_of_file(finalFileControl)
|
|
||||||
tmpFile = open(finalFileControl, 'w')
|
|
||||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
|
||||||
tmpFile.write("Version: " + pkg_properties["VERSION"] + "\n")
|
|
||||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
|
|
||||||
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
|
|
||||||
tmpFile.write("Architecture: all\n")
|
|
||||||
tmpFile.write("Depends: bash\n")
|
|
||||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
|
|
||||||
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
|
|
||||||
tmpFile.write("\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## Create the PostRm
|
|
||||||
tmpFile = open(finalFilepostRm, 'w')
|
|
||||||
tmpFile.write("#!/bin/bash\n")
|
|
||||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
|
||||||
if pkg_name != "":
|
|
||||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
|
||||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
|
||||||
tmpFile.write("\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## Enable Execution in script
|
|
||||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
|
||||||
## Readme donumentation
|
|
||||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
|
||||||
tools.create_directory_of_file(readmeFileDest)
|
|
||||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
|
||||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
|
||||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
|
||||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
|
||||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
|
||||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
|
||||||
tmpFile = open(readmeFileDest, 'w')
|
|
||||||
tmpFile.write("No documentation for " + pkg_name + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## licence file
|
|
||||||
license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
|
||||||
tools.create_directory_of_file(license_file_dest)
|
|
||||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
|
||||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
|
||||||
tmpFile = open(license_file_dest, 'w')
|
|
||||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
##changeLog file
|
|
||||||
change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
|
||||||
tools.create_directory_of_file(change_log_file_dest)
|
|
||||||
if os.path.exists(base_pkg_path + "/changelog")==True:
|
|
||||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'changelog' ==> generate an empty one")
|
|
||||||
tmpFile = open(change_log_file_dest, 'w')
|
|
||||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## create the package :
|
|
||||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
|
||||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
|
||||||
tools.create_directory_of_file(self.get_final_path())
|
|
||||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
|
||||||
|
|
||||||
def install_package(self, pkg_name):
|
def install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Install package '" + pkg_name + "'")
|
debug.info("Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
# this is temporary ... Will call:
|
||||||
|
if False:
|
||||||
|
os.system("lutin-pkg -i " + os.path.join(self.get_final_path(), + pkg_name + ".app.gpkg"))
|
||||||
|
else:
|
||||||
|
#Copy directly from staging path:
|
||||||
|
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||||
|
target_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app")
|
||||||
|
target_bin_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app", "bin", pkg_name)
|
||||||
|
target_bin_link = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name)
|
||||||
|
# remove output path:
|
||||||
|
tools.remove_path_and_sub_path(target_path)
|
||||||
|
# remove executable link version:
|
||||||
|
tools.remove_file(target_bin_link)
|
||||||
|
# copy result:
|
||||||
|
tools.copy_anything(appl_path, target_path, recursive=True)
|
||||||
|
# create synbolic link:
|
||||||
|
debug.info("kkk " + "ln -s " + target_bin_path + " " + target_bin_link)
|
||||||
|
os.symlink(target_bin_path, target_bin_link)
|
||||||
|
|
||||||
def un_install_package(self, pkg_name):
|
def un_install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Un-Install package '" + pkg_name + "'")
|
debug.info("Un-Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
# this is temporary ... Will call:
|
||||||
|
if False:
|
||||||
"""
|
os.system("lutin-pkg -r " + pkg_name)
|
||||||
.local/application
|
|
||||||
*--> applName -> applName.app/bin/applName
|
|
||||||
*--> applName.app
|
|
||||||
*--> appl_description.txt
|
|
||||||
*--> appl_name.txt
|
|
||||||
*--> changelog.txt
|
|
||||||
*--> copyright.txt
|
|
||||||
*--> readme.txt
|
|
||||||
*--> version.txt
|
|
||||||
*--> website.txt
|
|
||||||
*--> icon.png
|
|
||||||
*--> bin
|
|
||||||
* *--> applName
|
|
||||||
*--> doc
|
|
||||||
* *--> applName
|
|
||||||
*--> lib
|
|
||||||
* *--> XX.so
|
|
||||||
* *--> YY.so
|
|
||||||
*--> license
|
|
||||||
* *--> applName.txt
|
|
||||||
* *--> libXX.txt
|
|
||||||
* *--> libYY.txt
|
|
||||||
*--> man
|
|
||||||
*--> share
|
|
||||||
* *--> applName
|
|
||||||
* *--> XX
|
|
||||||
* *--> YY
|
|
||||||
*--> sources
|
|
||||||
"""
|
|
||||||
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"+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(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:
|
else:
|
||||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
#Copy directly from staging path:
|
||||||
tmpFile = open(readmeFileDest, 'w')
|
target_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app")
|
||||||
tmpFile.write("No documentation for " + pkg_name + "\n")
|
target_bin_link = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name)
|
||||||
tmpFile.flush()
|
# remove output path:
|
||||||
tmpFile.close()
|
tools.remove_path_and_sub_path(target_path)
|
||||||
## Create licence file
|
# remove executable link version:
|
||||||
license_file_dest = target_outpath + "/license/"+ debianpkg_name + ".txt"
|
tools.remove_file(target_bin_link)
|
||||||
tools.create_directory_of_file(license_file_dest)
|
|
||||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
|
||||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
|
||||||
tmpFile = open(license_file_dest, 'w')
|
|
||||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## Create changeLog file
|
|
||||||
change_log_file_dest = target_outpath + "/changelog.txt"
|
|
||||||
if os.path.exists(base_pkg_path + "/changelog") == True:
|
|
||||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'changelog' ==> generate an empty one")
|
|
||||||
tmpFile = open(change_log_file_dest, 'w')
|
|
||||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## 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")
|
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,12 +39,14 @@ class Target(target.Target):
|
|||||||
sys.path.append("c:\\MinGW\\bin" )
|
sys.path.append("c:\\MinGW\\bin" )
|
||||||
os.environ['PATH'] += ";c:\\MinGW\\bin\\"
|
os.environ['PATH'] += ";c:\\MinGW\\bin\\"
|
||||||
else:
|
else:
|
||||||
if self.config["bus-size"] == "64":
|
#if self.config["bus-size"] == "64":
|
||||||
# 64 bits
|
# # 64 bits
|
||||||
self.set_cross_base("x86_64-w64-mingw32-")
|
# self.set_cross_base("x86_64-w64-mingw32-")
|
||||||
else:
|
#else:
|
||||||
# 32 bits
|
# # 32 bits
|
||||||
self.set_cross_base("i686-w64-mingw32-")
|
# self.set_cross_base("i686-w64-mingw32-")
|
||||||
|
# Only one ... need understand why
|
||||||
|
self.set_cross_base("i686-w64-mingw32-")
|
||||||
# force static link to prenvent many errors ...
|
# force static link to prenvent many errors ...
|
||||||
self.global_flags_ld.append(["-static-libgcc",
|
self.global_flags_ld.append(["-static-libgcc",
|
||||||
"-static-libstdc++",
|
"-static-libstdc++",
|
||||||
|
22
test/test-c/lutin_test-c.py
Normal file
22
test/test-c/lutin_test-c.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import lutin.module as module
|
||||||
|
import lutin.tools as tools
|
||||||
|
import lutin.debug as debug
|
||||||
|
import os
|
||||||
|
|
||||||
|
def get_type():
|
||||||
|
return "BINARY"
|
||||||
|
|
||||||
|
def get_desc():
|
||||||
|
return "Text C compilation"
|
||||||
|
|
||||||
|
def create(target, module_name):
|
||||||
|
my_module = module.Module(__file__, module_name, get_type())
|
||||||
|
my_module.add_extra_compile_flags()
|
||||||
|
my_module.add_src_file([
|
||||||
|
'test.c'
|
||||||
|
])
|
||||||
|
if target.name=="Android":
|
||||||
|
my_module.compile_version("c", 1999)
|
||||||
|
return my_module
|
||||||
|
|
6
test/test-c/test.c
Normal file
6
test/test-c/test.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int _argc, char* _argv[]) {
|
||||||
|
printf("Hello World\n");
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user