Browse Source

git-svn-id: http://svn.calculate.ru/calculate2/calculate-lib/trunk@1 c91db197-33c1-4113-bf15-f8a5c547ca64

tags/0.0.2
atratsevsky 13 years ago
commit
8d32480d79
11 changed files with 5623 additions and 0 deletions
  1. +202
    -0
      LICENCE
  2. +13
    -0
      README
  3. BIN
      i18n/cl_lib_ru.mo
  4. +0
    -0
      pym/__init__.py
  5. +1926
    -0
      pym/cl_base.py
  6. +66
    -0
      pym/cl_devices.py
  7. +2815
    -0
      pym/cl_profile.py
  8. +182
    -0
      pym/cl_utils.py
  9. +381
    -0
      pym/cl_vars.py
  10. +3
    -0
      setup.cfg
  11. +35
    -0
      setup.py

+ 202
- 0
LICENCE View File

@@ -0,0 +1,202 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

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.

+ 13
- 0
README View File

@@ -0,0 +1,13 @@
AUTHOR: Calculate Pack <support@calculate.ru>

INSTALL
-------

calculate-lib needs the following library version installed, in order to run:
Python >= 2.3
python-ldap >= 2.0.0

To install calculate-lib , just execute the install script 'install.py'.
Example:

./install.py

BIN
i18n/cl_lib_ru.mo View File


+ 0
- 0
pym/__init__.py View File


+ 1926
- 0
pym/cl_base.py
File diff suppressed because it is too large
View File


+ 66
- 0
pym/cl_devices.py View File

@@ -0,0 +1,66 @@
#-*- coding: utf-8 -*-

#Copyright 2008 Calculate Pack, http://www.calculate-linux.ru
#
# 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 glob
import cl_utils

#класс для работы с видео устройствами
class Video:
#получить список видеокарт
def getcards(self):
card_names=[]
g_path=cl_utils.getpathenv()
s_cmd='%s lspci | grep VGA' % g_path
lines=os.popen(s_cmd).readlines()
if lines:
for line in lines:
re_res=re.search(\
'[0-9\:\.]+\sVGA compatible controller:(.+)$',line)
if re_res:
card_names.append(re_res.group(1))
if len(card_names)>0:
return card_names
else:
return None

#работа с блочными устройствами
class block_dev:
_dev_list=[]

def __init__(self):
self._getlist()

def _getlist(self):
devlist=[]
for dev in ('sd','hd'):
devlist+=glob.glob('/sys/block/%s*'%dev)
for dev in devlist:
self._dev_list.append(dev.split('/')[-1])

#получить список устройств
def get_listdev(self):
return self._dev_list

#проверить на извлекаемое устройство
def isremovable(self, dev):
if dev in self.get_listdev():
res=int(open('/sys/block/%s/removable'%dev).read().split()[0])
return res
else:
return None


+ 2815
- 0
pym/cl_profile.py
File diff suppressed because it is too large
View File


+ 182
- 0
pym/cl_utils.py View File

@@ -0,0 +1,182 @@
#-*- coding: utf-8 -*-

#Copyright 2008 Calculate Pack, http://www.calculate-linux.ru
#
# 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 filecmp
import string
from random import choice
from re import search
import os

def getdirlist(s_path):
#Получить список директорий по указаному пути
fdir=filecmp.dircmp(s_path, s_path)
dir_list=fdir.common_dirs
return dir_list

#вернуть случайный пароль
def genpassword():
res=''.join([choice(string.ascii_letters+string.digits)\
for i in xrange(9)])
return res

#заполнить строку указанным количеством символов
def fillstr(char, width):
tstr=""
nstr=string.zfill(tstr,width)
nstr=nstr.replace("0",char)
return nstr

#вернуть пути для запуска утилит
def getpathenv():
bindir=['/sbin','/bin','/usr/sbin','/usr/bin']
env=os.environ
if env and env.has_key('PATH'):
lpath=env['PATH'].split(":")
npath=[]
for dirname in bindir:
if os.path.exists(dirname) and dirname not in lpath:
npath.append(dirname)
lpath=npath+lpath
return "PATH="+":".join(lpath)+" && "

#класс для работы с установленными пакетами
class pakages:
#путь к директории установленнх пакетов
pkgdir="/var/db/pkg/"
#список установленных пакетов
pkglist={}
#Объект содержащий параметры пакета
class pakage(object):
#имя пакета с версией
fullname=""
#имя пакета
name=""
#версия
ver=""
#тип пакета в портижах
portdir=""
def __init__(self, **args):
for atname,atvalue in args.items():
setattr(self,atname, atvalue)

def __init__(self):
self.pkglist=self.__getpkglist()

#разбить имя пакета на тип и имя
def __getpkgver(self, fname):
res=search('^(.+)\-([0-9]+.*)$',fname)
if res:
return res.groups()
else:
return (None,None)

#собрать установленные в системе пакеты
def __getpkglist(self):
portageDirs=[]
instaledPkg={}
#проверим на существование директории с установленными пакетами
if os.path.exists(self.pkgdir):
#получим список типов пакетов
portageDirs=getdirlist(self.pkgdir)
if len(portageDirs)>0:
#обрабатываем содержимое каждого из типов
for portageDir in portageDirs:
pkgList=getdirlist(self.pkgdir+portageDir)
for pkg in pkgList:
fullname=pkg
pkgName,pkgVer= self.__getpkgver(pkg)
pobj=self.pakage(fullname=fullname,
name=pkgName, \
ver=pkgVer,\
portdir=portageDir)
fpkg=portageDir+"/"+pkgName
if instaledPkg.has_key(fpkg):
instaledPkg[fpkg].append(pobj)
else:
instaledPkg[fpkg]=[pobj]
return instaledPkg

#разбить pkgname на составляющие имени пакета
def __partname(self, pkgname):
if not pkgname.strip():
return False
res=search('^(.+\/)?(.+)',pkgname)
tname=None
if res.group(1):
tname=res.group(1)
if res.group(2):
res2=search('^(.+)(\-[0-9]+.+$)',res.group(2))
if res2:
name=res2.group(1)
ver=res2.group(2)
else:
name=res.group(2)
ver=None
if res:
if name and name[-1:]=='-':
name=name[:-1]
if tname and tname[-1:]=='/':
tname=tname[:-1]
if ver and ver[0]=='-':
ver=ver[1:]
return [tname, name, ver]


#проверить установленн ли пакет
#isinstalled('dev-db/postgresql')
def isinstalled(self, pkgname):
res=self.getinstpkg(pkgname)
if len(res)>0:
return True
else:
return False

#вернуть список объектов pakage() соответствующих pkgname
#getinstpkg('dev-db/postgresql')
#в случае отсутствия пакетов возвращает пустой список
def getinstpkg(self, pkgname):
pinfo=self.__partname(pkgname)
if pinfo:
ret=[]
if pinfo[0] and pinfo[1] and pinfo[2]:
if not self.pkglist.has_key(pinfo[0]+'/'+pinfo[1]):
return []
fpkg=self.pkglist[pinfo[0]+'/'+pinfo[1]]
ret=[]
for i in fpkg:
if i.ver==pinfo[2]:
ret.append(i)
return ret
elif pinfo[0] and pinfo[1]:
if not self.pkglist.has_key(pinfo[0]+'/'+pinfo[1]):
return []
return self.pkglist[pinfo[0]+'/'+pinfo[1]]
elif pinfo[1] and pinfo[2]:
for i in self.pkglist.keys():
if search('^.+\/%s$'%(pinfo[1]),i):
for el in self.pkglist[i]:
if el.ver==pinfo[2]:
ret.append(el)
return ret
elif pinfo[1]:
for i in self.pkglist.keys():
if search('^.+\/%s$'%(pinfo[1]),i):
ret+=self.pkglist[i]
return ret
return []

def getListPkg(self):
return self.pkglist

+ 381
- 0
pym/cl_vars.py View File

@@ -0,0 +1,381 @@
#-*- coding: utf-8 -*-

#Copyright 2008 Calculate Pack, http://www.calculate-linux.ru
#
# 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 - режим переменной r-не переназначается из командной строки,
# w-переназначается из командной строки
# type - тип переменной состоит из двух элементов(что это и для чего
# это)
# value - дефоултное значение переменной
# select - список допустимых значений переменной
# official - флаг того, что данная переменная служебная и не отображается
# при печати списка значений переменных
# printval - печатное значение переменной(значение выводимое при печати
# списка значений переменных)

class Data:
#старое значение файла grub_device.map
boot_devicemap_old={'mode':"r",
'type':('conf','boot'),
}
#новое значение файла device.map
boot_devicemap= {'mode':"w",
'type':('conf','boot'),
}
#альтернативные строчки загрузчика grub
boot_grub_another= {'mode':"r",
'type':('conf','boot'),
}
#диск с которого загружена система в формате загрузчика grub
boot_grub_loaddev= {'mode':"r",
'type':('param','boot'),
}
#раздел с которого загружена система в формате загрузчика grub
boot_grub_loadnum= {'mode':"r",
'type':('param','boot'),
}
#диск для установки системы в формате загрузчика grub
boot_grub_setupdev={'mode':"r",
'type':('param','boot'),
}
#раздел для установки системы в формате загрузчика grub
boot_grub_setupnum={'mode':"r",
'type':('param','boot'),
}
#модель материнской платы
hrd_board_model= {'mode':"r",
'type':('info','matherboard'),
}
#производитель материнской платы
hrd_board_vendor= {'mode':"r",
'type':('info','matherboard'),
}
#количество процессоров на ПК
hrd_cpu_num= {'mode':"w",
'type':('param','cpu'),
}
#количество процессоров на ПК
hrd_laptop_model= {'mode':"r",
'type':('info','hardware'),
}
#производитель ноутбука
hrd_laptop_vendor= {'mode':"r",
'type':('info','hardware'),
}
#обозначение видео карты для настроек OpenGL
hrd_opengl_set= {'mode':"r",
'type':('param','video'),
}
#описание материнской платы
hrd_pc_vendor= {'mode':"r",
'type':('info','matherboard'),
}
#видео драйвер
hrd_video_drv= {'mode':"w",
'type':('param','video'),
}
#видео карта
hrd_video_name= {'mode':"r",
'type':('info','video'),
}
#разрешение экрана
hrd_video_res= {'mode':"w",
'type':('param','screen'),
}
#DNS имя сервера CDS
net_cds= {'mode':"w",
'type':('param','lan'),
}
#сетевые настройки файла /etc/conf.d/net
net_conf= {'mode':"r",
'type':('conf','lan'),
}
#сетевое устройство, через которое пакеты попадают на шлюз
net_gw_dev= {'mode':"r",
'type':('param','network'),
}
#адрес шлюза
net_gw= {'mode':"w",
'type':('param','lan'),
}
#имя компьютера
net_host= {'mode':"w",
'type':('param','lan'),
}
#разрешенная сеть
net_hosts_allow= {'mode':"r",
'type':('param','lan'),
}
#активное сетевое устройство (выбириется в порядке приоритета eth0-9,
#wlan0-9)
net_lan= {'mode':"r",
'type':('param','lan'),
}
#текущая сеть
net_networks= {'mode':"r",
'type':('conf','lan'),
}
#DNS имя NFS сервера
net_nfs= {'mode':"w",
'type':('conf','lan'),
}
#DNS имя сервера времени
net_ntp= {'mode':"w",
'type':('conf','lan'),
}
#порт proxy сервера
net_proxy_port= {'mode':"w",
'type':('param','lan'),
}
#строка для настройки proxy сервера
net_proxy_url= {'mode':"r",
'type':('param','lan'),
}
#DNS имя proxy сервера
net_proxy= {'mode':"w",
'type':('param','lan'),
}
#файловая система root раздела
setup_formatfs= {'mode':"w",
'type':('param','install'),
}
#диск и раздел для установки
setup_installdev= {'mode':"w",
'type':('param','install'),
}
#имя ISO-файла для создания загружаемого образа системы
setup_iso_name= {'mode':"r",
'type':('param','install'),
}
#версия системы (в зависимости от операции - обновление установка, сборка)
setup_linux_ver= {'mode':"w",
'type':('param','system'),
}
#имя tar-архива с образом устанавливаемой системы
setup_linuxpkg= {'mode':"r",
'type':('param','install'),
}
#установлено в ram в случае, если установка профиля производится в RAM-диск
#(настройка сеанса CDROM)
setup_location= {'mode':"r",
'type':('param','system'),
'value':""}
#значение флага -j команды make
setup_makeopts= {'mode':"w",
'type':('param','install'),
}
#архитектура процессора (в зависимости от операции - обновление установка,
#сборка)
setup_march= {'mode':"w",
'type':('param','system'),
}
#имя и версия программы
setup_name= {'mode':"r",
'type':('info','install'),
}
#название системы из-под которой запущена программа
setup_os_current= {'mode':"r",
'type':('info','system'),
}
#этап запуска (установка, сборка или обновление)
setup_pass= {'mode':"r",
'type':('param','install'),
}
#путь к директории с профилями
setup_path_profuser={'mode':"r",
'type':('path','install'),
}
#путь к спискам пакетов для сборки новой системы
setup_path_constpkg={'mode':"r",
'type':('path','install'),
}
#директория сборки новой системы
setup_path_constructor={'mode':"w",
'type':('path','install'),
'value':'/mnt/calculate'}
#путь к исходным файлам пакетов программ
setup_path_distfiles={'mode':"r",
'type':('path','install'),
}
#пути переменной окружения PATH (изменяются в случае запуска программы на
#сильно измененной Linux системе)
setup_path_env= {'mode':"r",
'type':('cmd','install'),
}
#путь к директории точки монтирования для установки новой системы
setup_path_install={'mode':"w",
'type':('path','install'),
'value':'/mnt/install'}
#путь к дистрибутивам
setup_path_linuxpkg={'mode':"r",
'type':('path','install'),
}
#директория к патчам (выполняемым скриптам, содержащим определенные
#инструкции для внесения изменений в систему)
setup_path_patch= {'mode':"w",
'type':('path','install'),
}
#путь к бинарным пакетам программ
setup_path_pkg= {'mode':"r",
'type':('path','install'),
}
#путь к портежам
setup_path_portage={'mode':"r",
'type':('path','install'),
}
#директория временных файлов
setup_path_tmp= {'mode':"w",
'type':('path','install'),
}
#список накладываемых профилей при установке, наложении профилей
setup_path_profinstall= {'mode':"r",
'type':('path','install'),
}
#флаг установки MBR записи для загрузки системы (по умолчанию установлен)
setup_set_mbr= {'mode':"w",
'type':('bool','install'),
}
#имя сборки
setup_sys_fullname={'mode':"r",
'type':('info','system'),
}
#короткое название системы (CLD)
setup_sys_shortname={'mode':"r",
'type':('param','system'),
}
#emerge флаг размаскировки пакетов (меняется при установке, сборке,
#обновлении)
setup_unmask= {'mode':"r",
'type':('param','install'),
}
#номер версии программы
setup_ver= {'mode':"r",
'type':('param','install'),
'value':"0.0.1 alpha 1"}
#версия загруженной системы
sys_current_ver= {'mode':"r",
'type':('param','system'),
}
#домен
sys_domain= {'mode':"w",
'type':('param','system'),
}
#тип операционной системы
sys_linux_type= {'mode':"r",
'type':('param','system'),
}
#носитель в значение ram в случае загрузки с CD_DVD
sys_load= {'mode':"r",
'type':('param','system'),
}
#монтируемые диски (в т.ч. сетевые) в системе
sys_mount_dev= {'mode':"r",
'type':('param','system'),
}
#дополнительные настройки монтируемых дисков файла /etc/fstab
sys_mount_line= {'mode':"r",
'type':('param','system'),
}
#флаг переноса подключений из fstab
sys_set_movefstab= {'mode':"w",
'type':('bool','system'),
'value':True}
#раздел подкачки (swap)
sys_swap_dev= {'mode':"w",
'type':('param','system'),
}
#строка инициализации swap-раздела файла /etc/fstab
sys_swap_line= {'mode':"r",
'type':('conf','system'),
}
#-----------------------------------------------------
#Служебные переменные
#-----------------------------------------------------
#хэш доступных grub-у дисков
boot_grub_map= {'mode':"r",
'type':('param','install'),
'official':True}
#путь к программе host
cmd_exec_host= {'mode':"r",
'type':('cmd','install'),
'official':True}
#путь к программе nmap
cmd_exec_nmap= {'mode':"r",
'type':('cmd','install'),
'official':True}
#строка запуска emerge при сборке новой системы
cmd_run_emerge1= {'mode':"r",
'type':('cmd','install'),
'official':True}
#строка запуска emerge при сборке новой системы
cmd_run_emerge2= {'mode':"r",
'type':('cmd','install'),
'official':True}
#команда форматирования диска
cmd_run_format= {'mode':"r",
'type':('cmd','install'),
'official':True}
#команда инициализации OpenGL
cmd_run_opengl= {'mode':"r",
'type':('cmd','install'),
'official':True}
#хэш конвертации устаревшего формата hda на sda
setup_ata= {'mode':"r",
'type':('param','install'),
'official':False}
#версии сборок с сокращенным и полным именем
setup_dist_ver= {'mode':"r",
'type':('param','system'),
'value':{'CLD':"Calculate Linux Desktop",
'CDS':"Calculate Directory Server",
'CWS':"Calculate Web Server",
'AcoolA':"Calculate Web Server"},
'official':True}
#версии сборок с сокращенным и полным именем
setup_path_other= {'mode':"r",
'type':('param','system'),
'value':{'profile':["/usr/calculate2/profile/",
"/usr/share/calculate/profile/"]
},
'official':True}
#разделительная линия в комментариях
setup_mesline= {'mode':"w",
'type':('info','install'),
'official':True}
#текст заголовка изменяемых конфигурационных файлов
setup_mestitle= {'mode':"w",
'type':('info','install'),
'official':True}
#символ разделителя версии и патча
setup_ospatchsplit={'mode':"r",
'type':('param','install'),
'official':True}
#список доступных патчей
setup_patches= {'mode':"r",
'type':('param','system'),
'official':True}
#номер патча текущей системы
sys_patchcur= {'mode':"r",
'type':('param','system'),
'official':True}
#номер последнего установленного патча
sys_patchlast= {'mode':"r",
'type':('param','system'),
'official':True}
#директории точек монтирования в системе
sys_path_mounts= {'mode':"r",
'type':('path','system'),
'official':True}

+ 3
- 0
setup.cfg View File

@@ -0,0 +1,3 @@
[install]
install-purelib=/usr/lib/calculate
install-platlib=/usr/lib/calculate

+ 35
- 0
setup.py View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python

# setup.py --- Setup script for calculate-server

#Copyright 2008 Calculate Pack, http://www.calculate-linux.ru
#
# 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
from distutils.core import setup


setup(
name = 'calculate-lib',
version = "0.0.1",
description = "The library for Calculate 2",
author = "Calculate Pack",
author_email = "support@calculate.ru",
url = "http://calculate-linux.ru",
license = "http://www.apache.org/licenses/LICENSE-2.0",
package_dir = {'calculate-lib': "."},
packages = ['calculate-lib.pym'],
data_files = [("/usr/share/calculate/i18n",['i18n/cl_lib_ru.mo'])],
)

Loading…
Cancel
Save