Update import paths.

master3.3
Mike Hiretsky 13 years ago
parent 1dfa1da75f
commit eafaf6db3f

@ -21,43 +21,30 @@ from cl_install import InstallError
__version__ = cl_install.__version__ __version__ = cl_install.__version__
__app__ = cl_install.__app__ __app__ = cl_install.__app__
from cl_datavars import DataVars from calculate.lib.cl_datavars import DataVars
from cl_template import template, templateClt from calculate.lib.cl_template import template, templateClt
from cl_print import color_print from calculate.lib.cl_print import color_print
import cl_overriding from calculate.lib import cl_overriding
import cl_lang from calculate.lib.cl_lang import setLocalTranslate
tr = cl_lang.lang() setLocalTranslate('cl_install',sys.modules[__name__])
tr.setLocalDomain('cl_install')
tr.setLanguage(sys.modules[__name__])
#sys.path.insert(0, "/usr/lib/calculate-2.2/calculate-lib/pym")
#packagePath = "/usr/lib/calculate-2.2"
#for path in os.listdir(packagePath):
#realPath = os.path.join(packagePath,path)
#if os.path.isdir(realPath):
#pymPath = os.path.join(realPath,"pym")
#if len(filter(lambda x:x.startswith("cl_vars_") and\
#x.endswith(".py") or x.startswith("cl_fill_") and\
#x.endswith(".py"), os.listdir(pymPath)))==2:
#sys.path.insert(0, os.path.abspath(pymPath))
cl_overriding.exit = cl_install.defaultExit cl_overriding.exit = cl_install.defaultExit
cl_overriding.printERROR = cl_install.defaultPrintERROR cl_overriding.printERROR = cl_install.defaultPrintERROR
class DataVarsObject(DataVars): class DataVarsObject(DataVars):
"""Класс переменных для десктопа""" """Share class for variables"""
def __init__(self, section): def __init__(self, section):
DataVars.__init__(self) DataVars.__init__(self)
self.section=section self.section=section
def importDataObject(self, **args): def importDataObject(self, **args):
'''Заполнить конфигурацию переменных, для десктопа''' """Filling variables for section"""
# Имя секции в calculate.env self.importData(self.section,
#envSection = "calculate-desktop" ('calculate.{package}.cl_vars_{package}'.format(
# заполнить переменные окружения алгоритмом по умолнанию package=self.section),
self.importData(self.section, ('cl_vars_%s' %self.section, 'calculate.{package}.cl_fill_{package}'.format(
'cl_fill_%s' %self.section)) package=self.section)))
self.flIniFile() self.flIniFile()
class updateConfFiles(color_print): class updateConfFiles(color_print):

@ -15,14 +15,15 @@
# limitations under the License. # limitations under the License.
import os, sys, re import os, sys, re
from os import path
from cl_apply_template import updateConfFiles, __app__, __version__ from cl_apply_template import updateConfFiles, __app__, __version__
from cl_opt import opt from calculate.lib.cl_opt import opt
from cl_share_cmd import share_cmd from calculate.install.cl_share_cmd import share_cmd
from cl_lang import lang from calculate.lib.utils.files import listDirectory,pathJoin
from cl_utils import listDirectory,pathJoin
from os import path from calculate.lib.cl_lang import setLocalTranslate
lang().setLanguage(sys.modules[__name__]) setLocalTranslate('cl_install',sys.modules[__name__])
USAGE = _("%prog [options] path_to_clt_file") USAGE = _("%prog [options] path_to_clt_file")

@ -18,28 +18,27 @@ from os import path
from random import choice from random import choice
import string import string
import os import os
import types
from time import sleep from time import sleep
import re import re
import sys import sys
import operator import operator
from cl_utils import runOsCommand,isMount,removeDir,typeFile,pathJoin, \
process,getRunCommands,getTupleVersion,cmpVersion, \
detectDeviceForPartition, getProgPath,listDirectory, \
checkUtils,STDOUT,getUdevDeviceInfo, countPartitions
from cl_vars_share import varsShare
from shutil import copyfile,copytree from shutil import copyfile,copytree
from cl_template import _terms
from subprocess import Popen,PIPE,STDOUT from subprocess import Popen,PIPE,STDOUT
from cl_fill import fillVars
from cl_vars_share import varsShare from calculate.lib.utils.files import (runOsCommand,isMount,removeDir,
typeFile,pathJoin,process,getRunCommands,
getProgPath,listDirectory,checkUtils)
from calculate.lib.utils.common import getTupleVersion,cmpVersion
from calculate.lib.utils.device import (detectDeviceForPartition,
getUdevDeviceInfo, countPartitions)
from calculate.lib.cl_vars_share import varsShare
from calculate.lib.cl_template import _terms
from calculate.lib.cl_fill import fillVars
import threading import threading
from cl_lang import lang from calculate.lib.cl_lang import setLocalTranslate
tr = lang() setLocalTranslate('cl_install',sys.modules[__name__])
tr.setLocalDomain('cl_install')
tr.setLanguage(sys.modules[__name__])
class SignalInterrupt: class SignalInterrupt:
__interruptProcessObjs = [] __interruptProcessObjs = []

@ -18,32 +18,30 @@ import os
import sys import sys
import re import re
from crypt import crypt from crypt import crypt
import cl_overriding from calculate.lib.cl_vars_share import varsShare
from cl_datavars import glob_attr
from os import path from os import path
from os import readlink,access,R_OK from os import readlink,access,R_OK
from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\ from calculate.lib.utils.files import (listDirectory, pathJoin,process,
listDirectory, getAvailableVideo, getUUIDDict, \ checkUtils, readLinesFile, FStab, getProgPath)
getUdevDeviceInfo, getPartitionDevice, getPartitionSize, \ from calculate.lib.utils.common import (getTupleVersion, getAvailableVideo,
isPkgInstalled, process, checkUtils, readLinesFile, \ getInstalledVideo, getPasswdUsers)
FStab, lspci, getInstalledVideo,getDeviceType, \ from calculate.lib.utils.portage import isPkgInstalled
getPartitionType, getOsProberHash, getProgPath, \ from calculate.lib.utils.device import (getUUIDDict, getUdevDeviceInfo,
getRaidPartitions, getLvmPartitions, getLvmGroups, \ getPartitionDevice, getPartitionSize, lspci,
getPasswdUsers getDeviceType, getPartitionType, getOsProberHash,
from cl_distr import DistributiveRepository,PartitionDistributive getRaidPartitions, getLvmPartitions)
from cl_fill import clLocale from calculate.lib.utils import ip
from calculate.lib.cl_fill import clLocale
from calculate.lib.cl_template import _terms
from calculate.install.cl_distr import (DistributiveRepository,
PartitionDistributive)
from calculate.install.cl_install import convertDictOpt
from operator import itemgetter from operator import itemgetter
from cl_template import _terms
from subprocess import PIPE, Popen
from cl_install import convertDictOpt
from utils import ip
from cl_lang import lang from calculate.lib.cl_lang import setLocalTranslate
tr = lang() setLocalTranslate('cl_install',sys.modules[__name__])
tr.setLocalDomain('cl_install')
tr.setLanguage(sys.modules[__name__])
class fillVars(object, glob_attr): class fillVars(object, varsShare):
nonTransferedDirs = ["/","/bin", "/dev", "/etc", nonTransferedDirs = ["/","/bin", "/dev", "/etc",
"/lib", "/lib32", "/lib64", "/lib", "/lib32", "/lib64",
"/opt", "/proc", "/sbin", "/opt", "/proc", "/sbin",
@ -645,68 +643,12 @@ class fillVars(object, glob_attr):
%(x[0],x[1]), bindData)) %(x[0],x[1]), bindData))
return "\n".join(filter(lambda x: x, [rootLine,otherLines,bindLines])) return "\n".join(filter(lambda x: x, [rootLine,otherLines,bindLines]))
#def get_os_net_config_info(self):
#"""Content of /etc/conf.d/net file"""
#def getNetGateways():
#"""Get the network gateways"""
#execStr = 'route -n'
#res = self._runos(execStr,env={"LANG":"C"})
#if res is False:
#cl_overriding.printERROR("Failed to execute '%s'"%execStr)
#cl_overriding.exit(1)
#flagData = False
## retData = {'eth0':'10.0.0.1' ...}
#retData = {}
#for line in res:
#if flagData:
#routeData = map(lambda y: y.strip(),
#filter(lambda x: x, line.split(" ")))
#if len(routeData) == 8:
#if routeData[3] == "UG" and routeData[7]!="lo":
#retData[routeData[7]] = routeData[1]
#if line.startswith('Destination'):
#flagData = True
#return retData
#strIpAllow = self.Get('os_net_ip')
#strNetAllow = self.Get('os_net_allow')
#strInterfInfo = self.Get('os_net_interfaces_info')
#systemName = self.Get('os_linux_shortname')
#ret = ""
#retList = []
#gatewaysData = getNetGateways()
#if strIpAllow and strNetAllow:
#listDevInfo = map(lambda x: x.split(" "),strInterfInfo.split(","))
#listDevInfo = map(lambda x: (x[0], x[1][1:-1]),listDevInfo)
#listDevInfo = filter(lambda x: x[1]!="Off" ,listDevInfo)
#listIpNet = map(lambda x: (x[0],"%s/%s"%(x[1],x[2])),
#zip(listDevInfo,strIpAllow.split(","),
#map(lambda x: x.partition("/")[2],
#strNetAllow.split(","))))
#flagNotPlug = not systemName in ("CLS")
#for info, ipNet in listIpNet:
#dev, data = info
#if data=="DHCP":
#retList.append('config_%s=( "dhcp" )'%dev)
#if flagNotPlug:
#retList.append('modules_%s=( "!plug" )'%dev)
#else:
#retList.append('config_%s=( %s )'%(dev,ipNet))
#if gatewaysData and dev in gatewaysData:
#retList.append('routes_%s=( "default gw %s" )'\
#%(dev,gatewaysData[dev]))
#if flagNotPlug:
#retList.append('modules_%s=( "!plug" )'%dev)
#return "\n".join(retList)
def _comment(self,s,mp,dev): def _comment(self,s,mp,dev):
if s.startswith("UUID"): """Generate comment for /etc/fstab each line"""
return "# %s was on %s during installation\n%s" % (mp,dev,s) if s.startswith("UUID"):
else: return "# %s was on %s during installation\n%s" % (mp,dev,s)
return s else:
return s
def get_os_install_fstab_swap_conf(self): def get_os_install_fstab_swap_conf(self):
"""Information about swap for fstab""" """Information about swap for fstab"""

@ -22,21 +22,25 @@ import re
import sys import sys
import traceback import traceback
from os import path from os import path
from cl_utils import runOsCommand,appendProgramToEnvFile, \ from StringIO import StringIO
removeProgramToEnvFile,pathJoin, \ from time import sleep
scanDirectory,process,getTupleVersion, \ from subprocess import PIPE,STDOUT
detectDeviceForPartition,listDirectory, \ from shutil import copy2
cmpVersion,STDOUT,getUdevDeviceInfo, \ from calculate.lib.utils.files import (runOsCommand,pathJoin,scanDirectory,
getLvmPartitions,getInstalledVideo, \ process,listDirectory,STDOUT)
getSupportArch, refreshLVM, refreshUdev from calculate.lib.utils.common import (appendProgramToEnvFile,
from cl_vars_share import varsShare removeProgramToEnvFile, getTupleVersion,
cmpVersion,getUserPassword,
getSupportArch, getInstalledVideo )
from calculate.lib.utils.device import (detectDeviceForPartition,
getUdevDeviceInfo, getLvmPartitions, refreshLVM,
refreshUdev)
from calculate.lib.cl_vars_share import varsShare
from calculate.lib import cl_overriding
from calculate.lib.utils import ip
from cl_kernel_utils import KernelConfig,InitRamFs from cl_kernel_utils import KernelConfig,InitRamFs
import cl_overriding
from StringIO import StringIO
from utils import ip
install_errors = "" install_errors = ""
def installExit(*args,**kwars): def installExit(*args,**kwars):
raise InstallError(globals()["install_errors"]) raise InstallError(globals()["install_errors"])
@ -55,26 +59,21 @@ def pop_install_errors():
defaultExit = cl_overriding.exit defaultExit = cl_overriding.exit
defaultPrintERROR = cl_overriding.printERROR defaultPrintERROR = cl_overriding.printERROR
from cl_lang import lang from calculate.lib.cl_fill import clLocale
from cl_fill import clLocale from calculate.lib.cl_template import template
from cl_template import template from calculate.lib.cl_datavars import DataVars
from cl_datavars import DataVars from calculate.lib.cl_print import color_print
from cl_print import color_print from cl_distr import (PartitionDistributive,DistributiveRepository,
from cl_distr import PartitionDistributive,DistributiveRepository,\ DistributiveError, ScratchPartitionDistributive,
DistributiveError, ScratchPartitionDistributive, \ MultiPartitions, Spinner, FlashDistributive, SignalInterrupt,
MultiPartitions, Spinner, FlashDistributive, SignalInterrupt,\ Distributive)
Distributive from calculate.lib.utils.text import tableReport
from cl_string import tableReport from calculate.lib.server.utils import dialogYesNo
from time import sleep
from subprocess import PIPE,STDOUT
from server.utils import dialogYesNo
from cl_migrate_users import migrate, currentUsers from cl_migrate_users import migrate, currentUsers
from cl_utils import getUserPassword from calculate.lib.encrypt import encrypt
from encrypt import encrypt
from shutil import copy2
from cl_lang import lang from calculate.lib.cl_lang import setLocalTranslate
lang().setLanguage(sys.modules[__name__]) setLocalTranslate('cl_install',sys.modules[__name__])
class InstallError(Exception): class InstallError(Exception):
"""Installation Error""" """Installation Error"""
@ -92,7 +91,8 @@ class DataVarsInstall(DataVars):
# Имя секции в calculate.env # Имя секции в calculate.env
envSection = "install" envSection = "install"
# заполнить переменные окружения алгоритмом по умолнанию # заполнить переменные окружения алгоритмом по умолнанию
self.importData(envSection, ('cl_vars_install','cl_fill_install')) self.importData(envSection, ('calculate.install.cl_vars_install',
'calculate.install.cl_fill_install'))
class convertDictOpt: class convertDictOpt:

@ -19,14 +19,15 @@ import sys
from cl_install import cl_install, InstallError, __app__, __version__,\ from cl_install import cl_install, InstallError, __app__, __version__,\
get_install_errors get_install_errors
from cl_vars_share import varsShare from calculate.lib.cl_vars_share import varsShare
from cl_opt import opt from calculate.lib.cl_opt import opt
from cl_share_cmd import share_cmd from cl_share_cmd import share_cmd
from utils import ip as iputils from calculate.lib.utils import ip as iputils
from cl_utils import isPkgInstalled from calculate.lib.utils.portage import isPkgInstalled
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_install',sys.modules[__name__])
from cl_lang import lang
lang().setLanguage(sys.modules[__name__])
OSSYSTEM_LIST=sorted(varsShare.dictNameSystem.keys()) OSSYSTEM_LIST=sorted(varsShare.dictNameSystem.keys())
NM_LIST=sorted(varsShare.dictNetworkManagers.keys()) NM_LIST=sorted(varsShare.dictNetworkManagers.keys())

@ -14,14 +14,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from cl_utils import typeFile, process, listDirectory
import gzip
import re import re
import os import os
from os import path from os import path
from os import access,R_OK from os import access,R_OK
from subprocess import PIPE from shutil import copy2
from shutil import rmtree,copy2 import gzip
from calculate.lib.utils.files import typeFile, process, listDirectory
class KernelConfig: class KernelConfig:
"""Object for work with kernel config """Object for work with kernel config

@ -15,14 +15,13 @@
# limitations under the License. # limitations under the License.
import os, sys, re, time import os, sys, re, time
from cl_utils import pathJoin from calculate.lib.encrypt import encrypt
from cl_print import color_print
from encrypt import encrypt
from os import path from os import path
from cl_utils import pathJoin from calculate.lib.utils.files import pathJoin
from calculate.lib.cl_print import color_print
from cl_lang import lang from calculate.lib.cl_lang import setLocalTranslate
lang().setLanguage(sys.modules[__name__]) setLocalTranslate('cl_install',sys.modules[__name__])
class _shareData: class _shareData:

@ -17,14 +17,15 @@
import sys import sys
import os import os
from cl_print import color_print from calculate.lib.cl_print import color_print
from cl_utils import _error from calculate.lib.utils.common import _error
import cl_install import cl_install
# Перевод сообщений для программы # Перевод сообщений для программы
from cl_lang import lang from calculate.lib.cl_lang import setLocalTranslate
lang().setLanguage(sys.modules[__name__]) setLocalTranslate('cl_install',sys.modules[__name__])
import cl_overriding
from calculate.lib import cl_overriding
class share_cmd(color_print, _error): class share_cmd(color_print, _error):
"""Класс общих методов обработки опций командной строки""" """Класс общих методов обработки опций командной строки"""

@ -1,6 +1,6 @@
#-*- coding: utf-8 -*- #-*- coding: utf-8 -*-
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org # Copyright 2010-2012 Calculate Ltd. http://www.calculate-linux.org
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
#Допустимые ключи значений
# mode - read only or writeable variable # mode - read only or writeable variable
# value - default variable value # value - default variable value
# select - list of posible values for variable # select - list of posible values for variable

@ -0,0 +1,89 @@
#-*- coding: utf-8 -*-
# Copyright 2010-2012 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 soaplib, sys, time
import lxml.etree
from soaplib.serializers.primitive import String, Integer, Any
from soaplib.serializers.clazz import Array
from soaplib.serializers.clazz import ClassSerializer
from soaplib.service import rpc
class NewType (ClassSerializer):
helper = Integer
value = Any
class UserInfo(ClassSerializer):
name = String
surname = String
class GroupInfo(ClassSerializer):
name = String
gid = Integer
class UserInfoValue (ClassSerializer):
table = UserInfo
class GroupInfoValue (ClassSerializer):
table = GroupInfo
# Класс с выполняемым кодом
class Wsdl:
def install (self, name, times) :
try:
results = []
self.writeFile()
for i in range( 0, times ) :
results.append('Hello!!!, %s %d'%(name, i))
# Помещение данных в словарь процессов
self.setData (results)
# Учёт процесса выполнения
while self.getPercent() < 100:
time.sleep(2)
# Увеличение процента выполнения процесса
self.addPercent (20)
return True
# Обработка сигнала прерывания работы процесса
except KeyboardInterrupt:
# Необходимо передать Fasle для сохранения данных о процессе
return False
import sys, os
#sys.path.insert(0,os.path.abspath('~/Home/mydir/source/my/soap/temp'))
from baseClass import Basic, check_permissions
@rpc( NewType, UserInfoValue, _returns = Array( String ) )
def func (self, a, b):
return []
@rpc( String, Integer, Array(String), Integer, Integer, String,\
#_inVariableNames = {'_stri':'stri', "a" : "a"},\
_returns = NewType, _outVariableName='return') #Array( String ) )
# проверка прав на вызов функции
@check_permissions()
# кэширование параметров
@Basic.cache
# команда для консоли
@Basic.console('cl-say-hello')
@Basic.gui('Misc')
#def say_hello_view
def say_hello ( self, cert, sid, name, times, a = 5, _stri = "stri_"):
install = type("CommonInstall",(self.Common, Wsdl, object), {})
return self.startprocess(sid, target=install,method="install",
args_proc = (name[0], times))

@ -3,6 +3,6 @@ install_dir=/usr/share
[install] [install]
install-scripts=/usr/bin install-scripts=/usr/bin
install-purelib=/usr/lib/calculate-2.2 #install-purelib=/usr/lib/calculate-2.2
install-platlib=/usr/lib/calculate-2.2 #install-platlib=/usr/lib/calculate-2.2
#install-data=/usr/lib/calculate-2.2/calculate-install #install-data=/usr/lib/calculate-2.2/calculate-install

@ -173,11 +173,10 @@ setup(
author_email = "support@calculate.ru", author_email = "support@calculate.ru",
url = "http://calculate-linux.org", url = "http://calculate-linux.org",
license = "http://www.apache.org/licenses/LICENSE-2.0", license = "http://www.apache.org/licenses/LICENSE-2.0",
package_dir = {'calculate-install': "."}, package_dir = {'calculate.install': "install"},
packages = ['calculate-install.pym'], packages = ['calculate.install'],
data_files = data_files, data_files = data_files,
scripts=["./scripts/cl-install", scripts=[],
"./scripts/cl-template"],
cmdclass={'install_data': cl_install_data, cmdclass={'install_data': cl_install_data,
'build':build,'build_man':build_man, 'build':build,'build_man':build_man,
'install':install,'install_man':install_man}, 'install':install,'install_man':install_man},

Loading…
Cancel
Save