commit 1df0e5c3597bebd752bbf70cc28c152b88af22bf Author: Mike Hiretsky Date: Mon Sep 13 18:08:54 2010 +0000 Init calculate-builder. Added cl-kernel script. Started some variables. diff --git a/i18n/cl_builder_ru.mo b/i18n/cl_builder_ru.mo new file mode 100644 index 0000000..9b4e74b Binary files /dev/null and b/i18n/cl_builder_ru.mo differ diff --git a/pym/__init__.py b/pym/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pym/cl_fill_builder.py b/pym/cl_fill_builder.py new file mode 100644 index 0000000..f641d6c --- /dev/null +++ b/pym/cl_fill_builder.py @@ -0,0 +1,64 @@ +#-*- coding: utf-8 -*- + +# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import re +import cl_overriding +from cl_datavars import glob_attr +from cl_kernel import cl_kernel +from os import access, R_OK +from os import path + +class fillVars(object, glob_attr): + + def get_cl_kernel_directory(self): + defaultKernelPath = '/usr/src' + if not access(defaultKernelPath,R_OK): + return "" + kernel = cl_kernel() + kernelDirs = filter(kernel._testKernelDirectory,os.listdir('/usr/src')) + if kernelDirs: + if "linux" in kernelDirs: + return path.join(defaultKernelPath,"linux") + else: + return path.join(defaultKernelPath,kernelDirs[0]) + return "" + + def get_cl_kernel_version(self): + kernelMakefile = path.join(self.Get('cl_kernel_directory'),'Makefile') + reVerPart = re.compile("^(?:VERSION|^PATCHLEVEL|^SUBLEVEL)\s*=",re.I) + if access(kernelMakefile,R_OK): + try: + return "%(VERSION)s.%(PATCHLEVEL)s.%(SUBLEVEL)s"% \ + dict(map(lambda x:(x[0].strip(),x[2].strip()), + map(lambda x:x.partition('='), + filter(reVerPart.search, + open(kernelMakefile,'r'))))) + except: + pass + return "" + + def get_cl_kernel_config(self): + kernelDirs = self.Get('cl_kernel_config_path') + if not access(kernelDirs,R_OK): + return "" + configName = "config-%(system)s-%(march)s-%(ver)s" % \ + {'system':self.Get('os_linux_system'), + 'march':self.Get('os_arch_machine'), + 'ver':self.Get('cl_kernel_version')} + if path.exists(configName): + return path.join(kernelDirs,configName) + return "" diff --git a/pym/cl_kernel.py b/pym/cl_kernel.py new file mode 100644 index 0000000..755d81b --- /dev/null +++ b/pym/cl_kernel.py @@ -0,0 +1,73 @@ +#-*- coding: utf-8 -*- + +# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__version__ = "2.2.0.0" +__app__ = "calculate-builder" + +import os +import re +import sys +import traceback +from os import path +from cl_utils import process +from cl_print import color_print +from cl_datavars import DataVars + +from cl_kernel_utils import KernelConfig,InitRamFs + +from cl_lang import lang + +class printNoColor: + def colorPrint(self,attr,fg,bg,string): + sys.stdout.write(string) + +class DataVarsBuilder(DataVars): + """Variable class for installation""" + + def importBuilder(self, **args): + '''Get variables for builder''' + # section name in calculate.env + envSection = "builder" + # import builder variables + self.importData(envSection, ('cl_vars_builder','cl_fill_builder')) + +class cl_kernel(color_print): + """Primary class for kernel manipulation""" + + def __init__(self): + self.clVars = None + self.startMessage = "" + + def _testKernelDirectory(self,dirpath): + """Test directory for kernel sources""" + makefilepath = path.join(dirpath,'Makefile') + kbuildpath = path.join(dirpath,'Kbuild') + if not path.exists(makefilepath) \ + or not path.exists(kbuildpath) \ + or not "Kbuild for top-level directory of the kernel" in \ + open(kbuildpath,'r').read(): + return False + return True + + def setNoColor(self): + self.color = False + + def initVars(self): + """Primary initialization of variables""" + self.clVars = DataVarsBuilder() + self.clVars.importBuilder() + self.clVars.flIniFile() + diff --git a/pym/cl_kernel_cmd.py b/pym/cl_kernel_cmd.py new file mode 100644 index 0000000..0896be6 --- /dev/null +++ b/pym/cl_kernel_cmd.py @@ -0,0 +1,129 @@ +#-*- coding: utf-8 -*- + +# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from cl_kernel import cl_kernel, __app__, __version__ +from cl_opt import opt +from cl_share_cmd import share_cmd +from os import path +from os import access,R_OK +import re +import sys + +from cl_lang import lang +lang().setLanguage(sys.modules[__name__]) + +DESCRIPTION = _("The Calculate Linux kernel builder") +CMD_OPTIONS = [{'shortOption':"c", + 'longOption':"kernel-config", + 'optVal':"FILE", + 'help':_("Kernel configuration file to use for compilation") + }, + {'longOption':"dmraid", + 'help':_("Include DMRAID support") + }, + {'shortOption':"e", + 'longOption':"extraversion", + 'optVal':"VER", + 'help':_("Specify extraversion for kernel") + }, + {'shortOption':"k", + 'longOption':"kerneldir", + 'optVal':"DIR", + 'help':_("Location of the kernel sources") + }, + {'longOption':"lvm", + 'help':_("Include LVM support") + }, + { 'longOption':"mdadm", + 'help':_("Copy /etc/mdadm.conf to initramfs") + }, + {'shortOption':"m", + 'longOption':"menuconfig", + 'help':_("Run menuconfig after oldconfig") + }, + {'longOption':"no-clean", + 'help':_("Do not run make clean before compilation") + }, + {'shortOption':"o", + 'longOption':"use-own-config", + 'help':_("Use config from kernel directory") + }, + {'shortOption':"q", + 'help':_("Do not display kernel compilation process") + }] + + +class kernel_cmd(share_cmd): + """Class for work with cl_install by console""" + def __init__(self): + self.optobj = opt(package=__app__, + version=__version__, + description=DESCRIPTION, + option_list= CMD_OPTIONS + opt.variable_control + + opt.color_control, + check_values=self.checkOpts) + self.logicObj = cl_kernel() + + def _getNamesAllSetOptions(self): + """Get list set options""" + setOptDict = self.optobj.values.__dict__.items() + defaultOptDict = self.optobj.get_default_values().__dict__.items() + return reduce(lambda x,y: x+[y[0][0]], + filter(lambda x:x[0][1] != x[1][1], + zip(setOptDict,defaultOptDict)), []) + + def getStringIncompatibleOptions(self,listOpt): + """Форматированная строка несовместимых опций разделенных ','""" + return ", ".join(map(lambda x: len(x) == 1 and "'-%s'"%x or "'--%s'"%x, + listOpt)) + + def checkIncompatibleLive(self): + """Check incompatible options for option --live""" + incompatible = list(set(self._getNamesAllSetOptions()) & + set(self.optionsLiveIncompatible)) + if incompatible: + self.optobj.error(_("incompatible options")+":"+" %s"\ + %self.getStringIncompatibleOptions(incompatible+["live"])) + + def checkOpts(self, values, args): + """Check values all specified options.""" + if values.k: + if not self.logicObj._testKernelDirectory(values.k): + self.optobj.error("%s:'%s'"% + (_("Wrong kernel source directory"),values.k)) + else: + self.logic.clVars.Set('os_kernel_directory',values.k,True) + if values.c and values.o: + self.optobj.error(self.getStringIncompatibleOptions(["c","o"])) + if values.c: + if not path.exists(values.c): + self.optobj.error(_("Kernel config '%s' not found")%values.c) + else: + self.logic.clVars.Set('os_kernel_config',values.c,True) + elif values.o: + if not path.exists( + path.join(self.logic.clVars.Get('os_kernel_directory'), + ".config")): + self.optobj.error(_("Kernel directory has not config")) + else: + self.logic.clVars.Set('os_kernel_config', + path.join(self.logic.clVars.Get('os_kernel_directory'), + ".config.bak"),True) + + return (values, args) + + def makeKernel(self): + return self.logicObj.makeKernel() diff --git a/pym/cl_share_cmd.py b/pym/cl_share_cmd.py new file mode 100644 index 0000000..0fbfdf3 --- /dev/null +++ b/pym/cl_share_cmd.py @@ -0,0 +1,87 @@ +#-*- coding: utf-8 -*- + +# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import os + +from cl_print import color_print +from cl_utils import _error + +# Перевод сообщений для программы +from cl_lang import lang +lang().setLanguage(sys.modules[__name__]) + +class share_cmd(color_print, _error): + """Класс общих методов обработки опций командной строки""" + def isRoot(self, printError=True): + """Detect root user""" + if os.getuid() == 0 and os.getgid() == 0: + return True + else: + if printError: + self.printERROR(_("The user is not root")) + return False + + def printVars(self, optObj): + """Process displaying variables""" + if optObj.v: + varsFilter = None + varsNames = [] + format = "default" + # Фильтрование переменных + if "filter" in optObj.__dict__.keys() and optObj.filter: + optCmd = optObj.filter + if ',' in optCmd: + varsNames = optCmd.split(",") + elif '*' in optCmd: + varsFilter = optCmd.replace("*", ".*") + else: + varsNames.append(optCmd) + if "xml" in optObj.__dict__.keys() and optObj.xml: + format = "xml" + self.logicObj.clVars.printVars(varsFilter, varsNames, + outFormat=format) + + def setVars(self, optObj): + """Установка переменных""" + if optObj.set: + for vals in optObj.set: + for val in vals.split(','): + k,o,v = val.partition('=') + if self.logicObj.clVars.exists(k): + if not self.logicObj.clVars.SetWriteVar(k,v): + return False + else: + self.printERROR(_('variable %s not found')%k) + return False + return True + + def writeVars(self, optObj): + """Запись переменных""" + if not self.logicObj.clVars.WriteVars(header="install"): + errMsg = self.getError() + if errMsg: + self.printERROR(errMsg.strip()) + self.printERROR(_('Can not write template variables')) + return False + return True + + def setPrintNoColor(self, optObj): + """Установка печати сообщений без цвета""" + if optObj.color and optObj.color=="never": + color_print.colorPrint = lambda *arg : sys.stdout.write(arg[-1]) or\ + sys.stdout.flush() + diff --git a/pym/cl_vars_builder.py b/pym/cl_vars_builder.py new file mode 100644 index 0000000..99cf77b --- /dev/null +++ b/pym/cl_vars_builder.py @@ -0,0 +1,41 @@ +#-*- coding: utf-8 -*- + +# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#Допустимые ключи значений +# mode - read only or writeable variable +# value - default variable value +# select - list of posible values for variable +# official - flag, if it is True, then the variable is not printable +# printval - print value of variable +from cl_install import __version__, __app__ + +class Data: + # relative path for apply templates on files of system + cl_root_path = {} + + # program name + cl_name = {'value':__app__} + + # program version + cl_ver = {'value':__version__} + + cl_kernel_directory = {} + + cl_kernel_config = {} + + cl_kernel_config_path = {'mode':'w', + 'value':'/var/lib/layman/calculate/profiles/kernel'} + + cl_kernel_version = {} diff --git a/scripts/cl-builder b/scripts/cl-builder new file mode 100755 index 0000000..eed6b36 --- /dev/null +++ b/scripts/cl-builder @@ -0,0 +1,207 @@ +#!/bin/bash +#------------------------------------------------------------------------------ +# cl-builder +# Copyright ©2009 Mir Calculate Ltd. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +#------------------------------------------------------------------------------ + +# выбор строки перемонтирования разделов в зависимости от используемого модуля +BUILDER=/mnt/builder +if [[ -n `mount | grep " / type aufs"` ]]; +then + REMOUNT="mount -t aufs -o remount,br:/ none /" + REMOUNTBUILDER="mount -t aufs -o remount,br:/ none $BUILDER" +else + REMOUNT="mount -t unionfs -o remount,dirs=/ unionfs /" + REMOUNTBUILDER=":" +fi +TIMERUN=`date +%s` +EMERGELOG=${BUILDER}/var/log/emerge.log +TAILEMERGELOG="tail -f ${EMERGELOG}" + +#------------------------------------------------------------------------------ +# Обновление Unionfs в течение сборки пакетов +#------------------------------------------------------------------------------ +watching() { + $TAILEMERGELOG | + while read line; + do + if [ `echo "$line" | awk -F: '{print $1;}'` -ge $TIMERUN ] && + [ "`echo "$line" | grep -e "unemerge success" -e "completed emerge"`" ] + then + $REMOUNT &>/dev/null + fi + done +} + +#------------------------------------------------------------------------------ +# Монтируем ресурсы +#------------------------------------------------------------------------------ +mountres() { + mount -o bind /var/calculate/remote ${BUILDER}/var/calculate/remote + mount -o bind /usr/calculate/share ${BUILDER}/usr/calculate/share + mount -t proc none ${BUILDER}/proc && mount -o bind /dev ${BUILDER}/dev && + mount -t sysfs none ${BUILDER}/sys && + mount -o bind /dev/pts ${BUILDER}/dev/pts && return 0 + return 1 +} + +#------------------------------------------------------------------------------ +# Выполним emerge +#------------------------------------------------------------------------------ +runchroot() { + touch $EMERGELOG + watching & 2>/dev/null + chroot $BUILDER /bin/bash --rcfile /usr/calculate/install/config/chroot.rc + WATCHINGPID=`ps axo pid,cmd | sed -nr "s|^\s*([0-9]+)\s+${TAILEMERGELOG}.*|\1|p"` + [ "${WATCHINGPID}" ] && kill -9 $WATCHINGPID &>/dev/null + $REMOUNT &>/dev/null +} + +#------------------------------------------------------------------------------ +# Отмонтируем ресурсы +#------------------------------------------------------------------------------ +umountres() { + # перебираем строку в обратном порядке + MOUNTDIRS=`mount | grep -Po "${BUILDER}/[^ ]+" | sed "{N;s/\n/ /}"` + for MOUNTDIR in $( echo $MOUNTDIRS | rev ) + do + umount $(echo $MOUNTDIR | rev) || exit + done +} + + +#------------------------------------------------------------------------------ +# Выполним проверки +#------------------------------------------------------------------------------ +checkrun() { + if [[ `/usr/bin/id -u` -ne 0 ]] + then + echo "Only root can perform system building." + exit; + fi + #не запустим если загрузка не в Scrach режиме + if ! mount | grep /mnt/scratch &>/dev/null + then + echo "This program only works in the system, installed by Calculate with the option '--build'." + exit; + fi + + #не запустим второй раз + if mount | grep "/dev/pts on /mnt/builder/dev/pts " &>/dev/null + then + if [ `ps ax | grep -v grep | grep -c "/bin/bash /usr/bin/cl-builder"` -gt 3 ]; + then + echo "This program is already run." + exit; + else + umountres + fi + fi + + #не запустим из chroot + if [ `mount | grep -c "devpts on /dev/pts "` -ne 1 ]; + then + echo "This program can't be run from Scratch layer." + exit; + fi +} + +#------------------------------------------------------------------------------ +# Выполним предварительные настройки +#------------------------------------------------------------------------------ +configure() { + # Перенесем resolv.conf + if [ -f /etc/resolv.conf ] + then + mkdir -p ${BUILDER}/etc + cp /etc/resolv.conf ${BUILDER}/etc/ + fi +} + +checkrun +configure +$REMOUNTBUILDER &>/dev/null +mountres && runchroot +umountres + +ROOTDIR=/ +UPDATE_DIRS="/boot /lib/modules /lib/firmware" +#------------------------------------------------------------------------------ +# Ask: whether to replace the old file +#------------------------------------------------------------------------------ +ask_replace() { + [[ $REPLACE_ANSWER == "yes" ]] && return 0 + [[ $REPLACE_ANSWER == "no" ]] && return 1 + local destfile=$1 + echo "File '$destfile' in builder is newer than in workspace" + local line + while true + do + echo -n "Do you want replace old file (Yes/No/All/None):" + read line <&1 + case $line in + All|all) REPLACE_ANSWER=yes;return 0;; + None|none) REPLACE_ANSWER=no;return 1;; + Y*|y*) return 0 ;; + N*|n*) return 1 ;; + esac + done +} + +#------------------------------------------------------------------------------ +# Compare modify time of the first and second file +#------------------------------------------------------------------------------ +test_newer() { + # [[ file1 -nt file2 ]] not correct work with symbolic link, because + # get modify time of target file + if [[ -L $1 || -L $2 ]] + then + [[ `stat -c %Y $1` -gt `stat -c %Y $2` ]] + else + [[ $1 -nt $2 ]] + fi +} + +#------------------------------------------------------------------------------ +# Compare modify time, ask user for update and update file +#------------------------------------------------------------------------------ +try_update_file() { + [[ -e $2 || -L $2 ]] && test_newer $1 $2 && + ask_replace $2 && cp -P $1 $2 +} + +#------------------------------------------------------------------------------ +# Find in first directory files and symbolic links with modify time great than +# same files in the second directory +#------------------------------------------------------------------------------ +update_from_builder() { + basesrc=${1%/} + basedest=${2%/} + shift 2 + for place in $* + do + src=$basesrc/${place#/} + dest=$basedest/${place#/} + find $src -type f -o -type l | + while read srcfile; + do + dstfile=${dest}/${srcfile#${src}/} + try_update_file $srcfile $dstfile + done + done +} + +update_from_builder $BUILDER $ROOTDIR $UPDATE_DIRS diff --git a/scripts/cl-kernel b/scripts/cl-kernel new file mode 100644 index 0000000..427edbc --- /dev/null +++ b/scripts/cl-kernel @@ -0,0 +1,56 @@ +#!/usr/bin/python +#-*- coding: utf-8 -*- + +# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import os +from os import path +sys.path.insert(0, path.abspath('/usr/lib/calculate-2.2/calculate-lib/pym')) +sys.path.insert(0, path.abspath('/usr/lib/calculate-2.2/calculate-install/pym')) +sys.path.insert(0, path.abspath('/usr/lib/calculate-2.2/calculate-builder/pym')) + +from cl_kernel_cmd import kernel_cmd + +from cl_lang import lang +tr = lang() +tr.setGlobalDomain('cl_builder') +tr.setLanguage(sys.modules[__name__]) + +if __name__ == "__main__": + kernel = kernel_cmd() + kernel.logicObj.initVars() + # set lang + ret = kernel.optobj.parse_args() + if ret is False: + sys.exit(1) + options, args = ret + # set color/nocolor for display messages + kernel.setPrintNoColor(options) + # set values to variables + if not kernel.setVars(options): + sys.exit(1) + # print variables + if options.v or options.filter or options.xml: + kernel.printVars(options) + sys.exit(0) + # check root + if not kernel.isRoot(): + sys.exit(1) + + if not kernel.makeKernel(): + sys.exit(1) + + sys.exit(0) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..5f5b0f1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[install] +install-scripts=/usr/bin +install-purelib=/usr/lib/calculate-2.2 +install-platlib=/usr/lib/calculate-2.2 +#install-data=/usr/lib/calculate-2.2/calculate-builder diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..271b59e --- /dev/null +++ b/setup.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# setup.py --- Setup script for calculate-builder + +# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import stat +from distutils.core import setup, Extension +from distutils.command.install_data import install_data + +data_files = [] + +var_data_files = [] + +share_calculate_dir = "/usr/share/calculate" +data_dirs_share = ['i18n'] + + +def __scanDir(scanDir, prefix, replace_dirname, dirData, flagDir=False): + """Scan directory""" + files = [] + dirs = [] + if flagDir or stat.S_ISDIR(os.stat(scanDir)[stat.ST_MODE]): + for fileOrDir in os.listdir(scanDir): + absPath = os.path.join(scanDir,fileOrDir) + statInfo = os.stat(absPath)[stat.ST_MODE] + if stat.S_ISREG(statInfo): + files.append(absPath) + elif stat.S_ISDIR(statInfo): + dirs.append(absPath) + if replace_dirname: + listDirs = list(scanDir.partition("/"))[1:] + listDirs.insert(0,replace_dirname) + scanDir = "".join(listDirs) + if prefix: + scanDir = os.path.join(prefix,scanDir) + dirData.append((scanDir, files)) + for sDir in dirs: + __scanDir(sDir, prefix, replace_dirname,dirData, True) + return dirData + +def create_data_files(data_dirs, prefix="", replace_dirname=""): + """Create data_files""" + data_files = [] + for data_dir in data_dirs: + data = [] + data_files += __scanDir(data_dir, prefix, replace_dirname, data) + return data_files + +data_files += create_data_files (data_dirs_share, share_calculate_dir) + +setup( + name = 'calculate-builder', + version = "2.2.0", + description = "Calculate Linux builder", + author = "Calculate Ltd.", + author_email = "support@calculate.ru", + url = "http://calculate-linux.org", + license = "http://www.apache.org/licenses/LICENSE-2.0", + package_dir = {'calculate-builder': "."}, + packages = ['calculate-builder.pym'], + data_files = data_files, + scripts=["./scripts/cl-kernel", + "./scripts/cl-builder"] +)