From 801e2e82093d1b1e0b4322f37b84374938dd4ff7 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 8 May 2015 13:13:50 +0200 Subject: [PATCH] [DEV] start create a pip installable lutin --- bin/lutin | 210 +++++++++++++++ lutin.py | 241 ------------------ lutin/__init__.py | 41 +++ lutinArg.py => lutin/arg.py | 2 +- lutinBuilder.py => lutin/builder.py | 14 +- .../builder}/lutinBuilder_binary.py | 0 {builder => lutin/builder}/lutinBuilder_c.py | 0 .../builder}/lutinBuilder_cpp.py | 0 .../builder}/lutinBuilder_java.py | 0 .../builder}/lutinBuilder_libraryDynamic.py | 0 .../builder}/lutinBuilder_libraryStatic.py | 0 {builder => lutin/builder}/lutinBuilder_m.py | 0 {builder => lutin/builder}/lutinBuilder_mm.py | 0 {builder => lutin/builder}/lutinBuilder_s.py | 0 lutinDebug.py => lutin/debug.py | 2 +- lutinDepend.py => lutin/depend.py | 4 +- lutinEnv.py => lutin/env.py | 2 +- lutinHeritage.py => lutin/heritage.py | 2 +- lutinHost.py => lutin/host.py | 2 +- lutinImage.py => lutin/image.py | 9 +- lutinModule.py => lutin/module.py | 18 +- lutinMultiprocess.py => lutin/multiprocess.py | 6 +- lutinSystem.py => lutin/system.py | 10 +- .../system}/lutinSystem_IOs_CoreAudio.py | 0 .../system}/lutinSystem_Linux_alsa.py | 0 .../system}/lutinSystem_Linux_boost.py | 0 .../system}/lutinSystem_Linux_jack.py | 0 .../system}/lutinSystem_Linux_oss.py | 0 .../system}/lutinSystem_Linux_pulse.py | 0 .../system}/lutinSystem_Linux_z.py | 0 .../system}/lutinSystem_MacOs_CoreAudio.py | 0 .../system}/lutinSystem_Windows_asio.py | 0 .../system}/lutinSystem_Windows_ds.py | 0 lutinTarget.py => lutin/target.py | 17 +- {target => lutin/target}/AndroidDebugKey.jks | Bin .../target}/lutinTarget_Android.py | 0 {target => lutin/target}/lutinTarget_IOs.py | 0 {target => lutin/target}/lutinTarget_Linux.py | 0 {target => lutin/target}/lutinTarget_MacOs.py | 0 .../target}/lutinTarget_Windows.py | 0 lutinTools.py => lutin/tools.py | 6 +- lutinZip.py => lutin/zip.py | 15 +- setup.py | 13 + 43 files changed, 315 insertions(+), 299 deletions(-) create mode 100755 bin/lutin delete mode 100755 lutin.py create mode 100755 lutin/__init__.py rename lutinArg.py => lutin/arg.py (99%) rename lutinBuilder.py => lutin/builder.py (91%) rename {builder => lutin/builder}/lutinBuilder_binary.py (100%) rename {builder => lutin/builder}/lutinBuilder_c.py (100%) rename {builder => lutin/builder}/lutinBuilder_cpp.py (100%) rename {builder => lutin/builder}/lutinBuilder_java.py (100%) rename {builder => lutin/builder}/lutinBuilder_libraryDynamic.py (100%) rename {builder => lutin/builder}/lutinBuilder_libraryStatic.py (100%) rename {builder => lutin/builder}/lutinBuilder_m.py (100%) rename {builder => lutin/builder}/lutinBuilder_mm.py (100%) rename {builder => lutin/builder}/lutinBuilder_s.py (100%) rename lutinDebug.py => lutin/debug.py (98%) rename lutinDepend.py => lutin/depend.py (98%) rename lutinEnv.py => lutin/env.py (98%) rename lutinHeritage.py => lutin/heritage.py (99%) rename lutinHost.py => lutin/host.py (95%) rename lutinImage.py => lutin/image.py (96%) rename lutinModule.py => lutin/module.py (98%) rename lutinMultiprocess.py => lutin/multiprocess.py (98%) rename lutinSystem.py => lutin/system.py (97%) rename {system => lutin/system}/lutinSystem_IOs_CoreAudio.py (100%) rename {system => lutin/system}/lutinSystem_Linux_alsa.py (100%) rename {system => lutin/system}/lutinSystem_Linux_boost.py (100%) rename {system => lutin/system}/lutinSystem_Linux_jack.py (100%) rename {system => lutin/system}/lutinSystem_Linux_oss.py (100%) rename {system => lutin/system}/lutinSystem_Linux_pulse.py (100%) rename {system => lutin/system}/lutinSystem_Linux_z.py (100%) rename {system => lutin/system}/lutinSystem_MacOs_CoreAudio.py (100%) rename {system => lutin/system}/lutinSystem_Windows_asio.py (100%) rename {system => lutin/system}/lutinSystem_Windows_ds.py (100%) rename lutinTarget.py => lutin/target.py (98%) rename {target => lutin/target}/AndroidDebugKey.jks (100%) rename {target => lutin/target}/lutinTarget_Android.py (100%) rename {target => lutin/target}/lutinTarget_IOs.py (100%) rename {target => lutin/target}/lutinTarget_Linux.py (100%) rename {target => lutin/target}/lutinTarget_MacOs.py (100%) rename {target => lutin/target}/lutinTarget_Windows.py (100%) rename lutinTools.py => lutin/tools.py (97%) rename lutinZip.py => lutin/zip.py (72%) create mode 100755 setup.py diff --git a/bin/lutin b/bin/lutin new file mode 100755 index 0000000..feda9ee --- /dev/null +++ b/bin/lutin @@ -0,0 +1,210 @@ +#!/usr/bin/python +## +## @author Edouard DUPIN +## +## @copyright 2012, Edouard DUPIN, all right reserved +## +## @license APACHE v2.0 (see license file) +## + +# for path inspection: +import sys +import os +import lutin.debug as debug +import lutin.arg as arguments +import lutin.host as host +import lutin.module as module +import lutin.target as target +import lutin.multiprocess as multiprocess + +myArgs = arguments.LutinArg() +myArgs.add(arguments.ArgDefine("h", "help", desc="display this help")) +myArgs.add_section("option", "Can be set one time in all case") +myArgs.add(arguments.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2")) +myArgs.add(arguments.ArgDefine("C", "color", desc="display makefile output in color")) +myArgs.add(arguments.ArgDefine("f", "force", desc="Force the rebuild without checking the dependency")) +myArgs.add(arguments.ArgDefine("P", "pretty", desc="print the debug has pretty display")) +myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously")) +myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements")) + +myArgs.add_section("properties", "keep in the sequency of the cible") +myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'")) +myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)")) +myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)")) +myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile")) +myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)")) +myArgs.add(arguments.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)")) +myArgs.add(arguments.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code")) +myArgs.add(arguments.ArgDefine("", "simulation", desc="simulater mode (availlable only for IOS)")) +myArgs.add(arguments.ArgDefine("", "list-target", desc="list all availlables targets ==> for auto completion")) +myArgs.add(arguments.ArgDefine("", "list-module", desc="list all availlables module ==> for auto completion")) + +myArgs.add_section("cible", "generate in order set") +localArgument = myArgs.parse() + +""" + display the help of this makefile +""" +def usage(): + # generic argument displayed : + myArgs.display() + print(" All target can finish with '?clean' '?dump' ... ?action") + print(" all") + print(" build all (only for the current selected board) (bynary and packages)") + print(" clean") + print(" clean all (same as previous)") + print(" dump") + print(" Dump all the module dependency and properties") + listOfAllModule = module.list_all_module_with_desc() + for mod in listOfAllModule: + print(" " + mod[0]) + if mod[1] != "": + print(" " + mod[1]) + print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all") + exit(0) + +# preparse the argument to get the verbose element for debug mode +def parseGenericArg(argument, active): + if argument.get_option_nName() == "help": + #display help + if active==False: + usage() + return True + if argument.get_option_nName() == "list-module": + if active==False: + listOfModule = module.list_all_module() + retValue = "" + for moduleName in listOfModule: + if retValue != "": + retValue += " " + retValue += moduleName + print(retValue) + exit(0) + return True + if argument.get_option_nName() == "list-target": + if active==False: + listOfTarget = target.list_all_target() + retValue = "" + for targetName in listOfTarget: + if retValue != "": + retValue += " " + retValue += targetName + print(retValue) + exit(0) + return True + elif argument.get_option_nName()=="jobs": + if active==True: + lutinMultiprocess.set_core_number(int(argument.get_arg())) + return True + elif argument.get_option_nName() == "verbose": + if active==True: + debug.set_level(int(argument.get_arg())) + return True + elif argument.get_option_nName() == "color": + if active==True: + debug.enable_color() + return True + elif argument.get_option_nName() == "force": + if active==True: + lutinEnv.set_force_mode(True) + return True + elif argument.get_option_nName() == "pretty": + if active==True: + lutinEnv.set_print_pretty_mode(True) + return True + elif argument.get_option_nName() == "force-strip": + if active==True: + lutinEnv.set_force_strip_mode(True) + return True + return False + +# parse default unique argument: +for argument in localArgument: + parseGenericArg(argument, True) + + +import lutin + + +import lutin.host as lutinHost +import lutin.tools as lutinTools + +#available target : Linux / MacOs / Windows / Android ... +targetName = host.OS +config = { + "compilator":"gcc", + "mode":"release", + "bus-size":"auto", + "arch":"auto", + "generate-package":True, + "simulation":False, + "gcov":False + } +# load the default target : +my_target = None +actionDone=False +# parse all argument +for argument in localArgument: + if parseGenericArg(argument, False) == True: + continue + elif argument.get_option_nName() == "package": + config["generate-package"]=False + elif argument.get_option_nName() == "simulation": + config["simulation"]=True + elif argument.get_option_nName() == "gcov": + config["gcov"]=True + elif argument.get_option_nName() == "bus": + config["bus-size"]=argument.get_arg() + elif argument.get_option_nName() == "arch": + config["arch"]=argument.get_arg() + elif argument.get_option_nName() == "compilator": + if config["compilator"] != argument.get_arg(): + debug.debug("change compilator ==> " + argument.get_arg()) + config["compilator"] = argument.get_arg() + #remove previous target + my_target = None + elif argument.get_option_nName() == "target": + # No check input ==> this will be verify automaticly chen the target will be loaded + if targetName != argument.get_arg(): + targetName = argument.get_arg() + debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release") + #reset properties by defauult: + config = { + "compilator":"gcc", + "mode":"release", + "bus-size":"auto", + "arch":"auto", + "generate-package":True, + "simulation":False, + "gcov":False + } + #remove previous target + my_target = None + elif argument.get_option_nName() == "mode": + if config["mode"] != argument.get_arg(): + config["mode"] = argument.get_arg() + debug.debug("change mode ==> " + config["mode"]) + #remove previous target + my_target = None + else: + if argument.get_option_nName() != "": + debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'") + usage() + else: + #load the target if needed : + if my_target == None: + my_target = target.load_target(targetName, config) + my_target.build(argument.get_arg()) + actionDone=True + +# if no action done : we do "all" ... +if actionDone==False: + #load the target if needed : + if my_target == None: + my_target = target.load_target(targetName, config) + my_target.build("all") + +# stop all started threads; +multiprocess.un_init() + + diff --git a/lutin.py b/lutin.py deleted file mode 100755 index 5aa4629..0000000 --- a/lutin.py +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/python -## -## @author Edouard DUPIN -## -## @copyright 2012, Edouard DUPIN, all right reserved -## -## @license APACHE v2.0 (see license file) -## - -# for path inspection: -import sys -import os -import inspect -import fnmatch -import lutinDebug as debug -import lutinEnv -import lutinModule -import lutinMultiprocess -import lutinArg - -myLutinArg = lutinArg.LutinArg() -myLutinArg.add(lutinArg.ArgDefine("h", "help", desc="display this help")) -myLutinArg.add_section("option", "Can be set one time in all case") -myLutinArg.add(lutinArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2")) -myLutinArg.add(lutinArg.ArgDefine("C", "color", desc="display makefile output in color")) -myLutinArg.add(lutinArg.ArgDefine("f", "force", desc="Force the rebuild without checking the dependency")) -myLutinArg.add(lutinArg.ArgDefine("P", "pretty", desc="print the debug has pretty display")) -myLutinArg.add(lutinArg.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously")) -myLutinArg.add(lutinArg.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements")) - -myLutinArg.add_section("properties", "keep in the sequency of the cible") -myLutinArg.add(lutinArg.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'")) -myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)")) -myLutinArg.add(lutinArg.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)")) -myLutinArg.add(lutinArg.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile")) -myLutinArg.add(lutinArg.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)")) -myLutinArg.add(lutinArg.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)")) -myLutinArg.add(lutinArg.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code")) -myLutinArg.add(lutinArg.ArgDefine("", "simulation", desc="simulater mode (availlable only for IOS)")) -myLutinArg.add(lutinArg.ArgDefine("", "list-target", desc="list all availlables targets ==> for auto completion")) -myLutinArg.add(lutinArg.ArgDefine("", "list-module", desc="list all availlables module ==> for auto completion")) - -myLutinArg.add_section("cible", "generate in order set") -localArgument = myLutinArg.parse() - -""" - display the help of this makefile -""" -def usage(): - # generic argument displayed : - myLutinArg.display() - print(" All target can finish with '?clean' '?dump' ... ?action") - print(" all") - print(" build all (only for the current selected board) (bynary and packages)") - print(" clean") - print(" clean all (same as previous)") - print(" dump") - print(" Dump all the module dependency and properties") - listOfAllModule = lutinModule.list_all_module_with_desc() - for mod in listOfAllModule: - print(" " + mod[0]) - if mod[1] != "": - print(" " + mod[1]) - print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all") - exit(0) - -# preparse the argument to get the verbose element for debug mode -def parseGenericArg(argument,active): - if argument.get_option_nName() == "help": - #display help - if active==False: - usage() - return True - if argument.get_option_nName() == "list-module": - if active==False: - listOfModule = lutinModule.list_all_module() - retValue = "" - for moduleName in listOfModule: - if retValue != "": - retValue += " " - retValue += moduleName - print(retValue) - exit(0) - return True - if argument.get_option_nName() == "list-target": - if active==False: - listOfTarget = lutinTarget.list_all_target() - retValue = "" - for targetName in listOfTarget: - if retValue != "": - retValue += " " - retValue += targetName - print(retValue) - exit(0) - return True - elif argument.get_option_nName()=="jobs": - if active==True: - lutinMultiprocess.set_core_number(int(argument.get_arg())) - return True - elif argument.get_option_nName() == "verbose": - if active==True: - debug.set_level(int(argument.get_arg())) - return True - elif argument.get_option_nName() == "color": - if active==True: - debug.enable_color() - return True - elif argument.get_option_nName() == "force": - if active==True: - lutinEnv.set_force_mode(True) - return True - elif argument.get_option_nName() == "pretty": - if active==True: - lutinEnv.set_print_pretty_mode(True) - return True - elif argument.get_option_nName() == "force-strip": - if active==True: - lutinEnv.set_force_strip_mode(True) - return True - return False - -# parse default unique argument: -if __name__ == "__main__": - for argument in localArgument: - parseGenericArg(argument, True) - -# now import other standard module (must be done here and not before ... -import lutinTarget -import lutinBuilder -import lutinSystem -import lutinHost -import lutinTools - -""" - Run everything that is needed in the system -""" -def Start(): - #available target : Linux / MacOs / Windows / Android ... - targetName=lutinHost.OS - config = { - "compilator":"gcc", - "mode":"release", - "bus-size":"auto", - "arch":"auto", - "generate-package":True, - "simulation":False, - "gcov":False - } - # load the default target : - target = None - actionDone=False - # parse all argument - for argument in localArgument: - if True==parseGenericArg(argument, False): - continue - elif argument.get_option_nName() == "package": - config["generate-package"]=False - elif argument.get_option_nName() == "simulation": - config["simulation"]=True - elif argument.get_option_nName() == "gcov": - config["gcov"]=True - elif argument.get_option_nName() == "bus": - config["bus-size"]=argument.get_arg() - elif argument.get_option_nName() == "arch": - config["arch"]=argument.get_arg() - elif argument.get_option_nName() == "compilator": - if config["compilator"] != argument.get_arg(): - debug.debug("change compilator ==> " + argument.get_arg()) - config["compilator"] = argument.get_arg() - #remove previous target - target = None - elif argument.get_option_nName() == "target": - # No check input ==> this will be verify automaticly chen the target will be loaded - if targetName!=argument.get_arg(): - targetName=argument.get_arg() - debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release") - #reset properties by defauult: - config = { - "compilator":"gcc", - "mode":"release", - "bus-size":"auto", - "arch":"auto", - "generate-package":True, - "simulation":False, - "gcov":False - } - #remove previous target - target = None - elif argument.get_option_nName() == "mode": - if config["mode"]!=argument.get_arg(): - config["mode"] = argument.get_arg() - debug.debug("change mode ==> " + config["mode"]) - #remove previous target - target = None - else: - if argument.get_option_nName() != "": - debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'") - usage() - else: - #load the target if needed : - if target == None: - target = lutinTarget.load_target(targetName, config) - target.build(argument.get_arg()) - actionDone=True - # if no action done : we do "all" ... - if actionDone==False: - #load the target if needed : - if target == None: - target = lutinTarget.load_target(targetName, config) - target.build("all") - # stop all started threads - lutinMultiprocess.un_init() - -""" - When the user use with make.py we initialise ourself -""" -if __name__ == '__main__': - debug.verbose("Use Make as a make stadard") - sys.path.append(lutinTools.get_run_folder()) - debug.verbose(" try to impoert module 'lutinBase.py'") - if os.path.exists("lutinBase.py" )==True: - __import__("lutinBase") - else: - debug.debug("missing file lutinBase.py ==> loading subPath..."); - # Import all sub path without out and archive - for folder in os.listdir("."): - if os.path.isdir(folder)==True: - if folder.lower()!="android" \ - and folder.lower()!="archive" \ - and folder.lower()!="out" : - debug.debug("Automatic load path: '" + folder + "'") - lutinBuilder.import_path(folder) - lutinModule.import_path(folder) - lutinSystem.import_path(folder) - lutinTarget.import_path(folder) - #lutinSystem.display() - lutinBuilder.init() - Start() - - - diff --git a/lutin/__init__.py b/lutin/__init__.py new file mode 100755 index 0000000..4492016 --- /dev/null +++ b/lutin/__init__.py @@ -0,0 +1,41 @@ +#!/usr/bin/python + +import os +import sys + +# now import other standard module (must be done here and not before ... +from . import target +from . import builder +from . import system +from . import host +from . import tools +from . import debug +from . import module + +is_init = False + +if is_init == False: + """ + When the user use with make.py we initialise ourself + """ + debug.verbose("Use Make as a make stadard") + sys.path.append(tools.get_run_folder()) + + debug.debug("missing file lutinBase.py ==> loading subPath..."); + # Import all sub path without out and archive + for folder in os.listdir("."): + if os.path.isdir(folder)==True: + if folder.lower()!="android" \ + and folder.lower()!="archive" \ + and folder.lower()!="out" : + debug.debug("Automatic load path: '" + folder + "'") + builder.import_path(folder) + module.import_path(folder) + system.import_path(folder) + target.import_path(folder) + + builder.init() + + is_init = True + + diff --git a/lutinArg.py b/lutin/arg.py similarity index 99% rename from lutinArg.py rename to lutin/arg.py index 2737a9e..a9dd75b 100644 --- a/lutinArg.py +++ b/lutin/arg.py @@ -8,7 +8,7 @@ ## import sys -import lutinDebug as debug +from . import debug class ArgElement: def __init__(self, option, value=""): diff --git a/lutinBuilder.py b/lutin/builder.py similarity index 91% rename from lutinBuilder.py rename to lutin/builder.py index 99f51d2..7c3b418 100644 --- a/lutinBuilder.py +++ b/lutin/builder.py @@ -11,14 +11,14 @@ import sys import os import inspect import fnmatch -import lutinDebug as debug -import lutinHeritage as heritage +from . import debug +from . import heritage import datetime -import lutinTools -import lutinModule -import lutinSystem -import lutinImage -import lutinHost +from . import tools as lutinTools +from . import module as lutinModule +from . import system as lutinSystem +from . import image as lutinImage +from . import host as lutinHost ## ## constitution of dictionnary: diff --git a/builder/lutinBuilder_binary.py b/lutin/builder/lutinBuilder_binary.py similarity index 100% rename from builder/lutinBuilder_binary.py rename to lutin/builder/lutinBuilder_binary.py diff --git a/builder/lutinBuilder_c.py b/lutin/builder/lutinBuilder_c.py similarity index 100% rename from builder/lutinBuilder_c.py rename to lutin/builder/lutinBuilder_c.py diff --git a/builder/lutinBuilder_cpp.py b/lutin/builder/lutinBuilder_cpp.py similarity index 100% rename from builder/lutinBuilder_cpp.py rename to lutin/builder/lutinBuilder_cpp.py diff --git a/builder/lutinBuilder_java.py b/lutin/builder/lutinBuilder_java.py similarity index 100% rename from builder/lutinBuilder_java.py rename to lutin/builder/lutinBuilder_java.py diff --git a/builder/lutinBuilder_libraryDynamic.py b/lutin/builder/lutinBuilder_libraryDynamic.py similarity index 100% rename from builder/lutinBuilder_libraryDynamic.py rename to lutin/builder/lutinBuilder_libraryDynamic.py diff --git a/builder/lutinBuilder_libraryStatic.py b/lutin/builder/lutinBuilder_libraryStatic.py similarity index 100% rename from builder/lutinBuilder_libraryStatic.py rename to lutin/builder/lutinBuilder_libraryStatic.py diff --git a/builder/lutinBuilder_m.py b/lutin/builder/lutinBuilder_m.py similarity index 100% rename from builder/lutinBuilder_m.py rename to lutin/builder/lutinBuilder_m.py diff --git a/builder/lutinBuilder_mm.py b/lutin/builder/lutinBuilder_mm.py similarity index 100% rename from builder/lutinBuilder_mm.py rename to lutin/builder/lutinBuilder_mm.py diff --git a/builder/lutinBuilder_s.py b/lutin/builder/lutinBuilder_s.py similarity index 100% rename from builder/lutinBuilder_s.py rename to lutin/builder/lutinBuilder_s.py diff --git a/lutinDebug.py b/lutin/debug.py similarity index 98% rename from lutinDebug.py rename to lutin/debug.py index d8048b2..0905877 100644 --- a/lutinDebug.py +++ b/lutin/debug.py @@ -8,7 +8,7 @@ ## import os -import lutinMultiprocess +from . import multiprocess as lutinMultiprocess import threading import re diff --git a/lutinDepend.py b/lutin/depend.py similarity index 98% rename from lutinDepend.py rename to lutin/depend.py index d7c0ec5..6a12d8f 100644 --- a/lutinDepend.py +++ b/lutin/depend.py @@ -8,8 +8,8 @@ ## import os -import lutinDebug as debug -import lutinEnv as environement +from . import debug +from . import env as environement def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""): diff --git a/lutinEnv.py b/lutin/env.py similarity index 98% rename from lutinEnv.py rename to lutin/env.py index 83a0ec6..d28ded8 100644 --- a/lutinEnv.py +++ b/lutin/env.py @@ -7,7 +7,7 @@ ## @license APACHE v2.0 (see license file) ## -import lutinDebug as debug +from . import debug diff --git a/lutinHeritage.py b/lutin/heritage.py similarity index 99% rename from lutinHeritage.py rename to lutin/heritage.py index aeac200..d8c0cd0 100644 --- a/lutinHeritage.py +++ b/lutin/heritage.py @@ -9,7 +9,7 @@ import sys import copy -import lutinDebug as debug +from . import debug def append_to_list(listout, list): diff --git a/lutinHost.py b/lutin/host.py similarity index 95% rename from lutinHost.py rename to lutin/host.py index 931c864..3af23a6 100644 --- a/lutinHost.py +++ b/lutin/host.py @@ -9,7 +9,7 @@ import platform import sys -import lutinDebug as debug +from . import debug # print os.name # ==> 'posix' if platform.system() == "Linux": diff --git a/lutinImage.py b/lutin/image.py similarity index 96% rename from lutinImage.py rename to lutin/image.py index a2caec7..c2bb198 100644 --- a/lutinImage.py +++ b/lutin/image.py @@ -7,12 +7,13 @@ ## @license APACHE v2.0 (see license file) ## -import lutinDebug as debug -import lutinTools as tools +from . import debug +from . import tools import platform import os -import lutinMultiprocess -import lutinDepend as dependency +from . import multiprocess as lutinMultiprocess +from . import depend as dependency + enableResizeImage = True try: if platform.system() == "Darwin": diff --git a/lutinModule.py b/lutin/module.py similarity index 98% rename from lutinModule.py rename to lutin/module.py index ed82a01..cc58993 100644 --- a/lutinModule.py +++ b/lutin/module.py @@ -11,15 +11,15 @@ import sys import os import inspect import fnmatch -import lutinModule as module -import lutinHost as host -import lutinTools -import lutinDebug as debug -import lutinHeritage as heritage -import lutinDepend as dependency -import lutinBuilder as builder -import lutinMultiprocess -import lutinEnv +from . import module +from . import host +from . import tools as lutinTools +from . import debug +from . import heritage +from . import depend as dependency +from . import builder +from . import multiprocess as lutinMultiprocess +from . import env as lutinEnv class Module: diff --git a/lutinMultiprocess.py b/lutin/multiprocess.py similarity index 98% rename from lutinMultiprocess.py rename to lutin/multiprocess.py index b101e82..a3fb60d 100644 --- a/lutinMultiprocess.py +++ b/lutin/multiprocess.py @@ -8,7 +8,6 @@ ## import sys -import lutinDebug as debug import threading import time import sys @@ -18,9 +17,10 @@ else: import Queue as queue import os import subprocess -import lutinTools -import lutinEnv import shlex +from . import debug +from . import tools as lutinTools +from . import env as lutinEnv queueLock = threading.Lock() workQueue = queue.Queue() diff --git a/lutinSystem.py b/lutin/system.py similarity index 97% rename from lutinSystem.py rename to lutin/system.py index 1d29574..bf18d4d 100644 --- a/lutinSystem.py +++ b/lutin/system.py @@ -11,12 +11,12 @@ import sys import os import inspect import fnmatch -import lutinDebug as debug +from . import debug import datetime -import lutinTools -import lutinModule as module -import lutinImage -import lutinHost +from . import tools as lutinTools +from . import module +from . import image as lutinImage +from . import host as lutinHost class System: def __init__(self): diff --git a/system/lutinSystem_IOs_CoreAudio.py b/lutin/system/lutinSystem_IOs_CoreAudio.py similarity index 100% rename from system/lutinSystem_IOs_CoreAudio.py rename to lutin/system/lutinSystem_IOs_CoreAudio.py diff --git a/system/lutinSystem_Linux_alsa.py b/lutin/system/lutinSystem_Linux_alsa.py similarity index 100% rename from system/lutinSystem_Linux_alsa.py rename to lutin/system/lutinSystem_Linux_alsa.py diff --git a/system/lutinSystem_Linux_boost.py b/lutin/system/lutinSystem_Linux_boost.py similarity index 100% rename from system/lutinSystem_Linux_boost.py rename to lutin/system/lutinSystem_Linux_boost.py diff --git a/system/lutinSystem_Linux_jack.py b/lutin/system/lutinSystem_Linux_jack.py similarity index 100% rename from system/lutinSystem_Linux_jack.py rename to lutin/system/lutinSystem_Linux_jack.py diff --git a/system/lutinSystem_Linux_oss.py b/lutin/system/lutinSystem_Linux_oss.py similarity index 100% rename from system/lutinSystem_Linux_oss.py rename to lutin/system/lutinSystem_Linux_oss.py diff --git a/system/lutinSystem_Linux_pulse.py b/lutin/system/lutinSystem_Linux_pulse.py similarity index 100% rename from system/lutinSystem_Linux_pulse.py rename to lutin/system/lutinSystem_Linux_pulse.py diff --git a/system/lutinSystem_Linux_z.py b/lutin/system/lutinSystem_Linux_z.py similarity index 100% rename from system/lutinSystem_Linux_z.py rename to lutin/system/lutinSystem_Linux_z.py diff --git a/system/lutinSystem_MacOs_CoreAudio.py b/lutin/system/lutinSystem_MacOs_CoreAudio.py similarity index 100% rename from system/lutinSystem_MacOs_CoreAudio.py rename to lutin/system/lutinSystem_MacOs_CoreAudio.py diff --git a/system/lutinSystem_Windows_asio.py b/lutin/system/lutinSystem_Windows_asio.py similarity index 100% rename from system/lutinSystem_Windows_asio.py rename to lutin/system/lutinSystem_Windows_asio.py diff --git a/system/lutinSystem_Windows_ds.py b/lutin/system/lutinSystem_Windows_ds.py similarity index 100% rename from system/lutinSystem_Windows_ds.py rename to lutin/system/lutinSystem_Windows_ds.py diff --git a/lutinTarget.py b/lutin/target.py similarity index 98% rename from lutinTarget.py rename to lutin/target.py index 26a730a..6028900 100644 --- a/lutinTarget.py +++ b/lutin/target.py @@ -11,15 +11,15 @@ import sys import os import inspect import fnmatch -import lutinDebug as debug -import lutinHeritage as heritage +from . import debug +from . import heritage import datetime -import lutinTools -import lutinModule -import lutinSystem -import lutinImage -import lutinHost -import lutinMultiprocess as multiprocess +from . import tools as lutinTools +from . import module as lutinModule +from . import system as lutinSystem +from . import image as lutinImage +from . import host as lutinHost +from . import multiprocess class Target: def __init__(self, name, config, arch): @@ -436,6 +436,7 @@ def load_target(name, config): #create the target tmpTarget = theTarget.Target(config) return tmpTarget + raise KeyError("No entry for : " + name) def list_all_target(): global targetList diff --git a/target/AndroidDebugKey.jks b/lutin/target/AndroidDebugKey.jks similarity index 100% rename from target/AndroidDebugKey.jks rename to lutin/target/AndroidDebugKey.jks diff --git a/target/lutinTarget_Android.py b/lutin/target/lutinTarget_Android.py similarity index 100% rename from target/lutinTarget_Android.py rename to lutin/target/lutinTarget_Android.py diff --git a/target/lutinTarget_IOs.py b/lutin/target/lutinTarget_IOs.py similarity index 100% rename from target/lutinTarget_IOs.py rename to lutin/target/lutinTarget_IOs.py diff --git a/target/lutinTarget_Linux.py b/lutin/target/lutinTarget_Linux.py similarity index 100% rename from target/lutinTarget_Linux.py rename to lutin/target/lutinTarget_Linux.py diff --git a/target/lutinTarget_MacOs.py b/lutin/target/lutinTarget_MacOs.py similarity index 100% rename from target/lutinTarget_MacOs.py rename to lutin/target/lutinTarget_MacOs.py diff --git a/target/lutinTarget_Windows.py b/lutin/target/lutinTarget_Windows.py similarity index 100% rename from target/lutinTarget_Windows.py rename to lutin/target/lutinTarget_Windows.py diff --git a/lutinTools.py b/lutin/tools.py similarity index 97% rename from lutinTools.py rename to lutin/tools.py index b5d44e8..a6e0465 100644 --- a/lutinTools.py +++ b/lutin/tools.py @@ -10,10 +10,10 @@ import os import shutil import errno -import lutinDebug as debug +from . import debug import fnmatch -import lutinMultiprocess -import lutinDepend as dependency +from . import multiprocess as lutinMultiprocess +from . import depend as dependency """ diff --git a/lutinZip.py b/lutin/zip.py similarity index 72% rename from lutinZip.py rename to lutin/zip.py index f29a67a..49a7932 100644 --- a/lutinZip.py +++ b/lutin/zip.py @@ -6,12 +6,13 @@ ## ## @license APACHE v2.0 (see license file) ## -import lutinDebug as debug -import lutinTools as tools import platform import os import zipfile +from . import debug +from . import tools + def create_zip(path, outputFile): debug.debug("Create Zip : '" + outputFile + "'") @@ -26,14 +27,4 @@ def create_zip(path, outputFile): zf.write(file, file[basePathlen:]) zf.close() -""" -print('creating archive') -zf = zipfile.ZipFile('zipfile_write.zip', mode='w') -try: - print('adding README.md') - zf.write('README.md') -finally: - print('closing') - zf.close() -""" diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..d4dfde1 --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +from setuptools import setup + +setup(name='lutin', + version='0.5.0', + description='Lutin generic builder', + url='http://github.com/HeeroYui/lutin', + author='Edouard DUPIN', + author_email='yui.heero@gmail.com', + license='APACHE-2', + packages=['lutin'], + scripts=['bin/lutin'], + zip_safe=False)