Browse Source

fix merge

master
serkus01 10 months ago
parent
commit
2e5b1de675
  1. 8
      recovers.txt
  2. 6
      server.py
  3. 34
      utils/utils.py

8
recovers.txt

@ -29,6 +29,14 @@ nano
vscode
jedit
gedit
tornado
[Dev-util]
pycharm-community
dev-python/django
dev-python/flask
net-libs/nodejs
dev-lang/erlang
app-containers/docker
[Графика]
gimp
blender

6
server.py

@ -24,6 +24,7 @@ def run():
config = load_config()
if len(config) == 0:
print("Файл конфигурации пустой.")
return 1
try:
print(config['PORT'])
except KeyError:
@ -45,10 +46,9 @@ def run():
try:
server.serve_forever()
except KeyboardInterrupt:
pass
logging.info('Stopping httpd...\n')
server.server_close()
logging.info('Stopping httpd...\n')
if __name__ == '__main__':
#https_server()
run()

34
utils/utils.py

@ -147,6 +147,7 @@ def sort_install_pkg():
#pkg =scan_config_portage()
INSTALL = {}
pkg_name =""
TrePortage = ScanTreePortage()
path = '/var/db/pkg/'
for d, dirs, files in os.walk(path):
for f in files:
@ -163,8 +164,9 @@ def sort_install_pkg():
#print(pkg_name)
if pkg_name not in INSTALL:
INSTALL[d.replace(path, "").split('/')[0]] = []
if
INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1], ver = f.replace(pkg_name, "")))
"""
else:
INSTALL[d.replace(path,
"").split('/')[0]].append(dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
@ -174,28 +176,32 @@ def sort_install_pkg():
INSTALL[d.replace(path, "").split('/')[0]].append(f.replace(".ebuild", "") )
INSTALL[d.replace(path,
"").split('/')[0]].append(f.replace(".ebuild", "")) #dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
"""
#print(str(len(INSTALL)))
#return json.dumps({'install_pkgs':INSTALL})
return INSTALL
def ScanTreePortage():
DirsRoot = ["/var/db/repos", "/usr/portage"]
d, ListTree, f for in os.walk('/usr/portage') and d, ListTree, f for in os.walk("/var/db/repos")
return ListTree
def scan_config_portage():
dirs_root = ["/var/db/repos", "/usr/portage"]
config = {}
i = 0
dr = {}
data = {}
pf = {}
for dir_root in dirs_root:
for d, dirs, files in os.walk(dir_root):
print(str(d))
i += 1
Dirs_root = ["/var/db/repos", "/usr/portage"]
Config = {}
I = 0
Dr = {}
Data = {}
Pf = {}
for Dir_root in Dirs_root:
for d, dirs, files in os.walk(Dir_root):
#print(str(d))
I += 1
for fl in files:
with open(d + "/" + fl) as f:
pf[str(d.split('/')[-1]) + "/"+ fl]= f.read().split('\n')
Pf[str(d.split('/')[-1]) + "/"+ fl]= f.read().split('\n')
str(d.split('/')[-1])
#print(dr)
#config = {'portage': pf}
#print("config:\t" + str(config))
return config
return Config

Loading…
Cancel
Save