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__
__app__ = cl_install.__app__
from cl_datavars import DataVars
from cl_template import template, templateClt
from cl_print import color_print
import cl_overriding
from calculate.lib.cl_datavars import DataVars
from calculate.lib.cl_template import template, templateClt
from calculate.lib.cl_print import color_print
from calculate.lib import cl_overriding
import cl_lang
tr = cl_lang.lang()
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))
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_install',sys.modules[__name__])
cl_overriding.exit = cl_install.defaultExit
cl_overriding.printERROR = cl_install.defaultPrintERROR
class DataVarsObject(DataVars):
"""Класс переменных для десктопа"""
"""Share class for variables"""
def __init__(self, section):
DataVars.__init__(self)
self.section=section
def importDataObject(self, **args):
'''Заполнить конфигурацию переменных, для десктопа'''
# Имя секции в calculate.env
#envSection = "calculate-desktop"
# заполнить переменные окружения алгоритмом по умолнанию
self.importData(self.section, ('cl_vars_%s' %self.section,
'cl_fill_%s' %self.section))
"""Filling variables for section"""
self.importData(self.section,
('calculate.{package}.cl_vars_{package}'.format(
package=self.section),
'calculate.{package}.cl_fill_{package}'.format(
package=self.section)))
self.flIniFile()
class updateConfFiles(color_print):

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

@ -18,28 +18,27 @@ from os import path
from random import choice
import string
import os
import types
from time import sleep
import re
import sys
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 cl_template import _terms
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
from cl_lang import lang
tr = lang()
tr.setLocalDomain('cl_install')
tr.setLanguage(sys.modules[__name__])
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_install',sys.modules[__name__])
class SignalInterrupt:
__interruptProcessObjs = []

@ -18,32 +18,30 @@ import os
import sys
import re
from crypt import crypt
import cl_overriding
from cl_datavars import glob_attr
from calculate.lib.cl_vars_share import varsShare
from os import path
from os import readlink,access,R_OK
from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\
listDirectory, getAvailableVideo, getUUIDDict, \
getUdevDeviceInfo, getPartitionDevice, getPartitionSize, \
isPkgInstalled, process, checkUtils, readLinesFile, \
FStab, lspci, getInstalledVideo,getDeviceType, \
getPartitionType, getOsProberHash, getProgPath, \
getRaidPartitions, getLvmPartitions, getLvmGroups, \
getPasswdUsers
from cl_distr import DistributiveRepository,PartitionDistributive
from cl_fill import clLocale
from calculate.lib.utils.files import (listDirectory, pathJoin,process,
checkUtils, readLinesFile, FStab, getProgPath)
from calculate.lib.utils.common import (getTupleVersion, getAvailableVideo,
getInstalledVideo, getPasswdUsers)
from calculate.lib.utils.portage import isPkgInstalled
from calculate.lib.utils.device import (getUUIDDict, getUdevDeviceInfo,
getPartitionDevice, getPartitionSize, lspci,
getDeviceType, getPartitionType, getOsProberHash,
getRaidPartitions, getLvmPartitions)
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 cl_template import _terms
from subprocess import PIPE, Popen
from cl_install import convertDictOpt
from utils import ip
from cl_lang import lang
tr = lang()
tr.setLocalDomain('cl_install')
tr.setLanguage(sys.modules[__name__])
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_install',sys.modules[__name__])
class fillVars(object, glob_attr):
class fillVars(object, varsShare):
nonTransferedDirs = ["/","/bin", "/dev", "/etc",
"/lib", "/lib32", "/lib64",
"/opt", "/proc", "/sbin",
@ -645,68 +643,12 @@ class fillVars(object, glob_attr):
%(x[0],x[1]), bindData))
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):
if s.startswith("UUID"):
return "# %s was on %s during installation\n%s" % (mp,dev,s)
else:
return s
"""Generate comment for /etc/fstab each line"""
if s.startswith("UUID"):
return "# %s was on %s during installation\n%s" % (mp,dev,s)
else:
return s
def get_os_install_fstab_swap_conf(self):
"""Information about swap for fstab"""

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

@ -19,14 +19,15 @@ import sys
from cl_install import cl_install, InstallError, __app__, __version__,\
get_install_errors
from cl_vars_share import varsShare
from cl_opt import opt
from calculate.lib.cl_vars_share import varsShare
from calculate.lib.cl_opt import opt
from cl_share_cmd import share_cmd
from utils import ip as iputils
from cl_utils import isPkgInstalled
from calculate.lib.utils import ip as iputils
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())
NM_LIST=sorted(varsShare.dictNetworkManagers.keys())

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

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

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

@ -1,6 +1,6 @@
#-*- 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");
# 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
# limitations under the License.
#Допустимые ключи значений
# mode - read only or writeable variable
# value - default variable value
# 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-scripts=/usr/bin
install-purelib=/usr/lib/calculate-2.2
install-platlib=/usr/lib/calculate-2.2
#install-purelib=/usr/lib/calculate-2.2
#install-platlib=/usr/lib/calculate-2.2
#install-data=/usr/lib/calculate-2.2/calculate-install

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

Loading…
Cancel
Save