Compare commits

...

10 Commits
2.2.0 ... 2.2.2

Author SHA1 Message Date
0a536b5203 [RELEASE] release version 2.2.2 2016-11-10 21:56:36 +01:00
1c66efa105 [DEV] simplify naming of asset 2016-11-10 21:14:42 +01:00
edfe7a1c96 [DEV] add add_src_path and add_header_path 2016-11-09 23:33:38 +01:00
92a0e5198c [DEV] add base of emscripten build for firefox test 2016-11-04 22:54:25 +01:00
156abe3533 [CI] correct build CI 2016-10-28 00:31:06 +02:00
2992699ec5 [DEBUG] correct local simple C test 2016-10-28 00:08:46 +02:00
44dbcdd56d [DEV] add a dependency graph generator
lutin dependency:LD ; dot -Tsvg dependency.dot -o dependency.svg ; firefox dependency.svg
2016-10-28 00:06:05 +02:00
f2060d4c97 [RELEASE] release version 2.2.1 2016-10-27 21:13:24 +02:00
cfde4a549f [DEBUG] correct version number parsing 2016-10-27 21:13:24 +02:00
72e956f06a [DEBUG] correct ARM7 or ARM64 selection 2016-10-11 21:14:19 +02:00
9 changed files with 532 additions and 61 deletions

View File

@@ -1,6 +1,8 @@
#language: python
language: cpp
sudo: false
#sudo: false
sudo: required
dist: trusty
branches:
only:
@@ -24,14 +26,14 @@ addons:
matrix:
include:
- os: linux
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9"
compiler: gcc
- os: linux
env: CONF=debug BUILDER=clang TARGET=Linux
compiler: clang
- os: linux
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
compiler: gcc
compiler: x86_64-w64-mingw32-gcc
- os: linux
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
compiler: gcc
@@ -43,6 +45,8 @@ matrix:
compiler: clang
install:
- ./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 ..
# download NDK
- if [ "$TAG" == "Android" ]; then
@@ -53,15 +57,16 @@ install:
- 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 *
- ls -l
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export PATH=$PATH:/Users/travis/Library/Python/2.7/bin/;
fi
- ./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=$?
- ./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:

View File

@@ -69,6 +69,15 @@ def usage(full=False):
print(" clean all (same as previous)")
print(" " + color['green'] + "dump" + color['default'])
print(" Dump all the module dependency and properties")
print(" " + color['green'] + "dependency" + color['default'])
print(" generate a file dependency.dot that represent all the dependency link")
print(" Select what in included: 'dependency:LPBDK'")
print(" L: Library")
print(" P: Pre-build")
print(" D: Data")
print(" B: Binary")
print(" K: Package")
print(" eg: lutin dependency:LD ; dot -Tsvg dependency.dot -o dependency.svg ; firefox dependency.svg")
print(" " + color['green'] + "gcov" + color['default'])
print(" Parse all the code of the library with the gcov resolution")
listOfAllModule = module.list_all_module_with_desc()
@@ -169,18 +178,18 @@ def check_boolean(value):
def parseGenericArg(argument, active):
debug.extreme_verbose("parse arg : " + argument.get_option_name() + " " + argument.get_arg() + " active=" + str(active))
if argument.get_option_name() == "help":
if active==False:
if active == False:
usage()
return True
if argument.get_option_name() == "HELP":
if active==False:
if active == False:
usage(True)
return True
if argument.get_option_name() == "list-module":
if active==False:
listOfModule = module.list_all_module()
if active == False:
list_of_module = module.list_all_module()
retValue = ""
for moduleName in listOfModule:
for moduleName in list_of_module:
if retValue != "":
retValue += " "
retValue += moduleName
@@ -188,10 +197,10 @@ def parseGenericArg(argument, active):
exit(0)
return True
if argument.get_option_name() == "list-target":
if active==False:
listOfTarget = target.list_all_target()
if active == False:
list_of_target = target.list_all_target()
retValue = ""
for targetName in listOfTarget:
for targetName in list_of_target:
if retValue != "":
retValue += " "
retValue += targetName
@@ -199,61 +208,61 @@ def parseGenericArg(argument, active):
exit(0)
return True
elif argument.get_option_name()=="jobs":
if active==True:
if active == True:
multiprocess.set_core_number(int(argument.get_arg()))
return True
elif argument.get_option_name()=="depth":
if active==True:
if active == True:
env.set_parse_depth(int(argument.get_arg()))
return True
elif argument.get_option_name() == "verbose":
if active==True:
if active == True:
debug.set_level(int(argument.get_arg()))
return True
elif argument.get_option_name() == "color":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
debug.enable_color()
else:
debug.disable_color()
return True
elif argument.get_option_name() == "force-build":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_mode(True)
else:
env.set_force_mode(False)
return True
elif argument.get_option_name() == "pretty":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_print_pretty_mode(True)
else:
env.set_print_pretty_mode(False)
return True
elif argument.get_option_name() == "force-optimisation":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_optimisation(True)
else:
env.set_force_optimisation(False)
return True
elif argument.get_option_name() == "isolate-system":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_isolate_system(True)
else:
env.set_isolate_system(False)
return True
elif argument.get_option_name() == "force-strip":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_force_strip_mode(True)
else:
env.set_force_strip_mode(False)
return True
elif argument.get_option_name() == "warning":
if active==True:
if active == True:
if check_boolean(argument.get_arg()) == True:
env.set_warning_mode(True)
else:

View File

@@ -54,12 +54,25 @@ class Module:
def __init__(self, file, module_name, module_type):
## Remove all variable to prevent error of multiple deffinition of the module ...
debug.verbose("Create a new module : '" + module_name + "' TYPE=" + module_type)
self._origin_file=''
self._origin_path=''
self._origin_file = file;
self._origin_path = tools.get_current_path(self._origin_file)
# type of the module:
self._type='LIBRARY'
if module_type == 'BINARY' \
or module_type == 'BINARY_SHARED' \
or module_type == 'BINARY_STAND_ALONE' \
or module_type == 'LIBRARY' \
or module_type == 'LIBRARY_DYNAMIC' \
or module_type == 'LIBRARY_STATIC' \
or module_type == 'PACKAGE' \
or module_type == 'PREBUILD' \
or module_type == 'DATA':
self._type=module_type
else :
debug.error('for module "%s"' %module_name)
debug.error(' ==> error : "%s" ' %module_type)
raise 'Input value error'
# Name of the module
self._name=module_name
self._name = module_name
# Tools list:
self._tools = []
# Dependency list:
@@ -86,25 +99,9 @@ class Module:
self._paths = []
# The module has been already build ...
self._isbuild = False
## end of basic INIT ...
if module_type == 'BINARY' \
or module_type == 'BINARY_SHARED' \
or module_type == 'BINARY_STAND_ALONE' \
or module_type == 'LIBRARY' \
or module_type == 'LIBRARY_DYNAMIC' \
or module_type == 'LIBRARY_STATIC' \
or module_type == 'PACKAGE' \
or module_type == 'PREBUILD' \
or module_type == 'DATA':
self._type=module_type
else :
debug.error('for module "%s"' %module_name)
debug.error(' ==> error : "%s" ' %module_type)
raise 'Input value error'
self._origin_file = file;
self._origin_path = tools.get_current_path(self._origin_file)
# configure default heritage
self._local_heritage = None
# TODO : Do a better dynamic property system => not really versatil
# TODO : Do a better dynamic property system => not really versatile
self._package_prop = { "COMPAGNY_TYPE" : "",
"COMPAGNY_NAME" : "",
"COMPAGNY_NAME2" : "",
@@ -888,7 +885,6 @@ class Module:
target.make_package(self._name, self._package_prop, os.path.join(self._origin_path, ".."), self._sub_heritage_list)
else:
target.make_package(self._name, self._package_prop, os.path.join(self._origin_path, ".."), self._sub_heritage_list)
# return local dependency ...
return copy.deepcopy(self._sub_heritage_list)
@@ -1083,6 +1079,25 @@ class Module:
##
def add_src_file(self, list):
tools.list_append_to(self._src, list, True)
##
## @brief Add all files in a specific path as source file to compile
## @param[in] self (handle) Class handle
## @param[in] base_path (string) Path where to search files
## @param[in] regex (string) regular expression of the search
## @param[in] recursive (bool) Search in resursive mode
## @return None
##
def add_src_path(self, base_path, regex="*", recursive=False):
if len(base_path) == 0:
debug.error("[" + self.get_name() + "] ==> no path set for function add_src_path")
if base_path[0] == '/' \
or base_path[0] == '\\':
debug.error("[" + self.get_name() + "] ==> use relative path for function add_src_path")
list_of_file = tools.get_list_of_file_in_path(os.path.join(self._origin_path, base_path), regex=regex, recursive=recursive, remove_path=self._origin_path)
debug.debug("[" + self.get_name() + "] add " + str(len(list_of_file)) + " file(s)")
self.add_src_file(list_of_file)
##
## @brief An an header file in the install directory
## @param[in] self (handle) Class handle
@@ -1091,6 +1106,8 @@ class Module:
## @param[in] clip_path (string) Remove a part of the path set in the list and install data in generic include path
## @param[in] recursive (bool) when use regexp in file list ==> we can add recursive property
##
## @note see add_header_path for a simple integration
##
## @code
## my_module.add_header_file([
## 'include/ewol/widget.h',
@@ -1184,6 +1201,21 @@ class Module:
tools.list_append_to(self._header, new_list, True)
##
## @brief An an header path in the install directory
## @param[in] self (handle) Class handle
## @param[in] base_path (string) Path where to search files
## @param[in] regex (string) regular expression of the search
## @param[in] clip_path (string) Remove a part of the path set in the list and install data in generic include path
## @param[in] recursive (bool) Search in resursive mode
## @return None
##
def add_header_path(self, base_path, regex="*", clip_path=None, recursive=False):
if base_path[-1] == '/' \
or base_path[-1] == '\\':
self.add_header_file(base_path + regex, clip_path=clip_path, recursive=recursive)
else:
self.add_header_file(base_path + "/" + regex, clip_path=clip_path, recursive=recursive)
##
## @brief Many library need to generate dynamic file configuration, use this to generat your configuration and add it in the include path
## @param[in] self (handle) Class handle
## @param[in] data_file (string) Data of the file that is generated
@@ -1285,6 +1317,107 @@ class Module:
print('-----------------------------------------------')
return True
def check_rules(self, type, rules):
if ( ( type == 'LIBRARY' \
or type == 'LIBRARY_DYNAMIC' \
or type == 'LIBRARY_STATIC' ) \
and "L" not in rules ) \
or ( type == 'DATA' \
and "D" not in rules ) \
or ( type == 'PREBUILD'\
and "P" not in rules ) \
or ( type == 'PACKAGE'\
and "K" not in rules) \
or ( ( type == 'BINARY' \
or type == 'BINARY_SHARED' \
or type == 'BINARY_STAND_ALONE')\
and "B" not in rules ) :
return True
return False
# TODO: Add to simplify the display the possibility to check if an element already depend in dependency of an element ???
def dependency_generate(self, target, tmp_file, step, rules):
debug.print_element("dot", "dependency.dot", "<<<", self._name)
if self.check_rules(self._type, rules) == True:
return
if step == 1:
if self._type == 'DATA':
tmp_file.write(' node [\n');
tmp_file.write(' shape=Mdiamond;\n');
tmp_file.write(' style=filled;\n');
tmp_file.write(' color=red;\n');
tmp_file.write(' ];\n');
elif self._type == 'PREBUILD':
tmp_file.write(' node [\n');
tmp_file.write(' shape=square;\n');
tmp_file.write(' style=filled;\n');
tmp_file.write(' color=gray;\n');
tmp_file.write(' ];\n');
elif self._type == 'LIBRARY' \
or self._type == 'LIBRARY_DYNAMIC' \
or self._type == 'LIBRARY_STATIC':
tmp_file.write(' node [\n');
tmp_file.write(' shape=ellipse;\n');
tmp_file.write(' style=filled;\n');
tmp_file.write(' color=lightblue;\n');
tmp_file.write(' ];\n');
elif self._type == 'BINARY' \
or self._type == 'BINARY_SHARED' \
or self._type == 'BINARY_STAND_ALONE':
tmp_file.write(' node [\n');
tmp_file.write(' shape=rectangle;\n');
tmp_file.write(' style=filled;\n');
tmp_file.write(' color=green;\n');
tmp_file.write(' ];\n');
elif self._type == 'PACKAGE':
return
tmp_file.write(' ' + copy.deepcopy(self._name).replace('-','_')+ ';\n');
else:
for elem in self._depends:
debug.verbose("add depend on: " + elem);
tmp_module = None
try:
tmp_module = target.get_module(elem)
except:
target.load_if_needed(elem, optionnal=True)
try:
tmp_module = target.get_module(elem)
except:
debug.verbose(" ==> get error");
if tmp_module == None:
debug.verbose(" ==> notFound");
continue
if self.check_rules(tmp_module._type, rules) == True:
debug.verbose(" ==> not in rules");
continue
tmp_file.write(' ' + copy.deepcopy(self._name).replace('-','_') + ' -> ' + copy.deepcopy(elem).replace('-','_') + ';\n');
for elem in self._depends_optionnal:
elem = elem[0]
debug.verbose("add depend on: " + elem);
tmp_module = None
try:
tmp_module = target.get_module(elem)
except:
target.load_if_needed(elem, optionnal=True)
try:
tmp_module = target.get_module(elem)
except:
debug.verbose(" ==> get error");
if tmp_module == None:
debug.verbose(" ==> notFound");
continue
if self.check_rules(tmp_module._type, rules) == True:
debug.verbose(" ==> not in rules");
continue
tmp_file.write(' ' + copy.deepcopy(self._name).replace('-','_') + ' -> ' + copy.deepcopy(elem).replace('-','_') + ';\n');
"""
tmp_file.write(' module_' + self._name.replace('-','_') + ' {\n');
tmp_file.write(' style=filled;\n');
tmp_file.write(' color=blue;\n');
tmp_file.write(' label="' + self._name + '";\n');
tmp_file.write(' }\n');
"""
##
## @brief Get packaging property variable
## @param[in] self (handle) Class handle

View File

@@ -653,11 +653,42 @@ class Target:
for mod in self.module_list:
mod.display()
return
if name[:10] == "dependency":
if len(name) > 10:
rules = name.split(":")[1]
else:
rules = "LBDPK"
# L for library
# B for binary
# D for Data
# P for prebuild
# K for package
debug.print_element("dot", "", "---", "dependency.dot")
self.load_all()
tmp_file = open("dependency.dot", 'w')
tmp_file.write('digraph G {\n')
tmp_file.write(' rankdir=\"LR\";\n')
for mod in self.module_list:
mod.dependency_generate(self, tmp_file, 1, rules)
# TODO : do it better ==> system library hook (do a oad of all avillable system library)
tmp_file.write(' node [\n');
tmp_file.write(' shape=square;\n');
tmp_file.write(' style=filled;\n');
tmp_file.write(' color=gray;\n');
tmp_file.write(' ];\n');
# TODO : End hook
for mod in self.module_list:
mod.dependency_generate(self, tmp_file, 2, rules)
tmp_file.write('}\n')
tmp_file.flush()
tmp_file.close()
debug.print_element("dot", "", "---", "dependency.dot")
return
if name == "all":
debug.info("build all")
self.load_all()
for mod in self.module_list:
if self._name=="Android":
if self._name == "Android":
if mod.get_type() == "PACKAGE":
mod.build(self, None)
else:
@@ -892,6 +923,18 @@ class Target:
tools.copy_file(path_src,
path_dst,
in_list=copy_list)
try:
path_src = self.get_build_file_bin(pkg_name)
path_src = path_src[:len(path_src)-4] + "js"
path_dst = os.path.join(path_package_bin, pkg_name + self.suffix_binary2)
debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src,
path_dst,
in_list=copy_list)
except:
debug.extreme_verbose("can not find : " + path_src)
pass
#real copy files
ret_copy = tools.copy_list(copy_list)
ret_remove = False

View File

@@ -170,6 +170,51 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
"need_copy":True}
return True
##
## @brief Get list of all Files in a specific path (with a regex)
## @param[in] path (string) Full path of the machine to search files (start with / or x:)
## @param[in] regex (string) Regular expression to search data
## @param[in] recursive (bool) List file with recursive search
## @param[in] remove_path (string) Data to remove in the path
## @return (list) return files requested
##
def get_list_of_file_in_path(path, regex="*", recursive = False, remove_path=""):
out = []
debug.verbose(" List all in : '" + str(path) + "'")
if os.path.isdir(os.path.realpath(path)):
tmp_path = os.path.realpath(path)
tmp_rule = regex
else:
debug.error("path does not exist : '" + str(path) + "'")
debug.verbose(" " + str(tmp_path) + ":")
for root, dirnames, filenames in os.walk(tmp_path):
deltaRoot = root[len(tmp_path):]
while len(deltaRoot) > 0 \
and ( deltaRoot[0] == '/' \
or deltaRoot[0] == '\\' ):
deltaRoot = deltaRoot[1:]
if recursive == False \
and deltaRoot != "":
return
debug.verbose(" root='" + str(deltaRoot) + "'")
debug.extreme_verbose(" files=" + str(filenames))
tmpList = filenames
if len(tmp_rule) > 0:
tmpList = fnmatch.filter(filenames, tmp_rule)
# Import the module :
for cycleFile in tmpList:
#for cycleFile in filenames:
add_file = os.path.join(tmp_path, deltaRoot, cycleFile)
if len(remove_path) != 0:
if add_file[:len(remove_path)] != remove_path:
debug.error("Request remove start of a path that is not the same: '" + add_file[:len(remove_path)] + "' demand remove of '" + str(remove_path) + "'")
else:
add_file = add_file[len(remove_path)+1:]
debug.verbose(" '" + add_file + "'")
out.append(add_file)
return out;
##
## @brief Copy a compleate directory in a specific folder
## @param[in] src Input folder path
@@ -381,16 +426,19 @@ def get_version_from_file_or_direct(path_module, filename_or_version):
line = lines[0]
debug.debug("Parse line: '" + line + "'")
#check if we have "-dev"
dev_mode = False
if line[-4:] == "-dev":
dev_mode = True
line = line[:-4]
dev_mode = ""
list_tiret = line.split('-')
if len(list_tiret) > 2:
debug.warning("more than one '-' in version file " + str(filename_or_version) + " : '" + str(list_tiret) + "' in '" + path_module + "'")
if len(list_tiret) >= 2:
dev_mode = list_tiret[1]
line = list_tiret[0]
out = []
list_elem = line.split('.')
for elem in list_elem:
out.append(int(elem))
if dev_mode == True:
out.append("dev")
if dev_mode != "":
out.append(dev_mode)
debug.debug(" ==> " + str(out))
return out

View File

@@ -40,8 +40,12 @@ class Target(target.Target):
if config["simulation"] == True:
arch = "i386"
else:
arch="arm64" # for ipad air
#arch="armv7" # for Iphone 4
if config["bus-size"] == "32":
# for Iphone 4
arch="armv7"
else:
# for ipad air
arch="arm64"
target.Target.__init__(self, ["IOs"] + sub_name, config, arch)
if self.config["simulation"] == True:
self.set_cross_base("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/")

View File

@@ -0,0 +1,229 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import target
from lutin import tools
from lutin import env
import os
import stat
import re
from lutin import host
from lutin import depend
from lutin import zip
from lutin import multiprocess
import lutinTarget_Linux
class Target(lutinTarget_Linux.Target):
def __init__(self, config, sub_name=[]):
lutinTarget_Linux.Target.__init__(self, config, ["Web"] + sub_name)
self.cross ="/home/heero/dev/perso/emsdk_portable/emscripten/master/em"
debug.debug("== Target='em'");
self.java = "javac"
self.javah = "javah"
self.jar = "jar"
self.ar = self.cross + "ar"
self.ranlib = self.cross + "ranlib"
self.cc = self.cross + "cc"
self.xx = self.cross + "++"
self.ar = self.cross + "ar"
self.xx_version = [0,0,0]
self.ld = self.cross + "ld"
self.nm = self.cross + "nm"
self.strip = ""#self.cross + "strip"
self.dlltool = self.cross + "dlltool"
self._update_path_tree()
self.stdlib_name_libgcc = ""
self.stdlib_name_libsupc = "";
self.suffix_binary = '.html'
self.suffix_binary2 = '.js'
self.pkg_path_bin = ""
# Disable capabiliteis to compile in shared mode
self.support_dynamic_link = False
# create temporary file:
self._file_data_tmp = "tmp_file_data.zip"
tools.file_write_data(os.path.join(self.get_build_path_temporary_generate(""), self._file_data_tmp), "coucou", only_if_new=True)
# add default file (need to generate a empty file to add it before loading:
self.add_flag("link", [
"--preload-file " + os.path.join(self.get_build_path_temporary_generate(""), self._file_data_tmp) + "@tmp_file_data.zip",
#" -s FULL_ES2=1 "
])
# in the output.js this generate a section '{"audio": 0, "start": 0, "crunched": 0, "end": 6, "filename": "tmp_file_data.zip"}], "remote_package_size": 6' ==> that will be replaced by the corretc data in the file 'module.data'
"""
.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_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------")
debug.debug("-- Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
debug.debug("------------------------------------------------------------------------")
#output path
target_outpath = os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app")
tools.create_directory_of_file(target_outpath)
## Create share datas:
ret_share = self.make_package_binary_data(target_outpath, "zz_generic_zz", base_pkg_path, heritage_list, static)
## copy binary files:
ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## Create libraries:
ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## Create generic files:
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
## end of the package generation
build_package_path_done = os.path.join(self.get_build_path(pkg_name), "generatePackageDone.txt")
#Check date between the current file "list of action to generate package and the end of package generation
need_generate_package = depend.need_re_package(build_package_path_done, [__file__], True)
## create the package:
if ret_share \
or ret_bin \
or ret_lib \
or ret_file \
or need_generate_package or True:
# Zip the data
debug.print_element("zip", "data.zip", "<==", os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app/share/*"))
zip_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + ".data")
zip.create_zip([
self.get_staging_path(pkg_name, tmp=True) + "/" + pkg_name + ".app/share/",
target_outpath + "/pkg"
], zip_path)
# copy if needed the binary:
tools.copy_file(
os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app", pkg_name + self.suffix_binary),
os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary),
force_identical=True)
# patch the .js file to update the new real data ...
js_file_data = tools.file_read_data(os.path.join(self.get_staging_path(pkg_name, tmp=True), pkg_name + ".app", pkg_name + self.suffix_binary2))
data_to_replace = '"end": 6, "filename": "/' + self._file_data_tmp + '"}], "remote_package_size": 6'
data_size = str(tools.file_size(zip_path))
replace_with = '"end": ' + data_size + ', "filename": "/data.zip"}], "remote_package_size": ' + data_size
debug.print_element("js", pkg_name + ".data", "<==", "correct zip name and data")
tools.file_write_data(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary2),
js_file_data.replace(data_to_replace, replace_with),
only_if_new = True)
zip_path_final = os.path.join(self.get_final_path(), pkg_name + ".data")
# generate deployed zip (for user)
debug.print_element("zip", pkg_name + ".zip", "<==", self.get_staging_path(pkg_name), pkg_name + ".zip")
zip.create_zip_file([
zip_path,
os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary)
],
pkg_name + ".app",
zip_path_final)
tools.file_write_data(build_package_path_done, "done...")
## create the package:
"""
if ret_share \
or ret_bin \
or ret_lib \
or ret_file \
or need_generate_package:
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")
#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(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg"))
# package is done corectly ...
tools.file_write_data(build_package_path_done, "done...")
"""
def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
# 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):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Un-Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
# this is temporary ... Will call:
if False:
os.system("lutin-pkg -r " + pkg_name)
else:
#Copy directly from staging path:
target_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app")
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)
def run(self, pkg_name, option_list):
debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
debug.debug("------------------------------------------------------------------------")
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + ".html")
cmd = "firefox " + appl_path + " "
for elem in option_list:
cmd += elem + " "
multiprocess.run_command_no_lock_out(cmd)
debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "' Finished")
debug.debug("------------------------------------------------------------------------")

View File

@@ -16,7 +16,7 @@ def readme():
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
setup(name='lutin',
version='2.2.0',
version='2.2.2',
description='Lutin generic builder (might replace makefile, CMake ...)',
long_description=readme(),
url='http://github.com/HeeroYui/lutin',

View File

@@ -10,11 +10,11 @@ def get_desc():
return "Test C compilation"
def configure(target, my_module):
my_module.add_extra_compile_flags()
my_module.add_extra_flags()
my_module.add_src_file([
'test.c'
])
if target.name=="Android":
if "Android" in target.get_type():
my_module.compile_version("c", 1999)
return my_module