From 26d18ac4b8854b422ed0e13aaf87b63d74bc4f67 Mon Sep 17 00:00:00 2001 From: Cyrille LOUARN Date: Fri, 29 Sep 2023 16:51:41 +0200 Subject: [PATCH] Cleaner code, start/stop domain by user, user directories creations --- CHANGELOG.md | 8 +++ src/usr/bin/tyto | 61 +++++++++++++++++- .../program/__pycache__/check.cpython-311.pyc | Bin 736 -> 730 bytes .../program/__pycache__/debug.cpython-311.pyc | Bin 3191 -> 3247 bytes .../__pycache__/domain.cpython-311.pyc | Bin 23959 -> 23498 bytes .../program/__pycache__/tools.cpython-311.pyc | Bin 5989 -> 5056 bytes .../__pycache__/userset.cpython-311.pyc | Bin 1016 -> 1016 bytes src/var/lib/tyto/program/check.py | 7 +- src/var/lib/tyto/program/debug.py | 1 + src/var/lib/tyto/program/domain.py | 58 ++++++----------- src/var/lib/tyto/program/tools.py | 29 ++------- src/var/lib/tyto/program/userset.py | 5 +- .../__pycache__/logs_fr.cpython-311.pyc | Bin 2765 -> 2805 bytes src/var/lib/tyto/translations/logs_fr.py | 1 + 14 files changed, 100 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a51a171..0c500c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ Tyto - Littérateur # CURRENTLY IN DEV ! +## [1.9.10] +- cleaner code +- start/stop domain by user +- User directories check/create when domain activated + +## [1.9.9] +- cleaner code with new check/update domain process + ## [1.9.8] - Check/create/update a domain is ready diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index b8255aa..abf0518 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Version: 1.9.9 -# Updated: 2023-09-29 1695992721 +# Version: 1.9.10 +# Updated: 2023-09-29 1695998917 # Tyto - Littérateur # Copyright (C) 2023 Cyrille Louarn @@ -41,6 +41,37 @@ # file program : #-------------------------- +import os + + +#===============# +# Error message # +#---------------# +def error_message(path): + print("! Installation error, unused:", path) + sys.exit(1) + + +#======================================================# +# A little checker to be sure, all files are installed # +#------------------------------------------------------# +def check_install(): + if not os.path.exists(libs): error_message(libs) + if not os.path.exists(trfs): error_message(trfs) + + for f in prog_files: + f = os.path.join(libs, f + ".py") + if not os.path.exists(f): + error_message(f) + + # Only default lang files + for f in lang_files: + f = os.path.join(trfs, f + ".py") + if not os.path.exists(f): + error_message(f) + + + #======#======================================================================= # MAIN # #======# @@ -49,9 +80,35 @@ if not __name__ == "__main__": print("! Error: '%s' not '%s'"%(__name__, "__main__")) sys.exit(1) +# files list in /program/ +prog_files = { + "args", + "check", + "debug", + "domain", + "forms", + "help", + "langs", + "new", + "post", + "show", + "tools", + "tyto", + "userset" + } +lang_files = { + "logs_en", + "logs_fr", + "website_en", + "website_fr" + } + # Set librairies to import app files libs = "/var/lib/tyto/program" trfs = "/var/lib/tyto/translations" + +check_install() + sys.path.insert(0, libs) sys.path.insert(0, trfs) diff --git a/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc index ef739a781c5dfc71ac3580bb1fa7f5f98368396d..fb381948213cf97090ec40d43c5e05be8b9c0518 100644 GIT binary patch delta 317 zcmaFBdW)5BIWI340}!NM7fWqto5)wjxMpIju2u;nNDu;_h9k|Mp^F*@@7!PWOf0JK7*X4$$pEuxU#s21<1a|nvcQ(OeHZY4tzACM~InHS{(%9L04o6i37$_l delta 304 zcmcb``hb;hIWI340}wbB3a2u#Pvk3OTsE;)m!*br0n@}gs{Fzw>>ybP$YPl+z$nF6 z!VME(V8~*dctAohg&~+hliAO$idC>^Geaf>x2HK{bc2;`qztR?yRImJaFdsZ?O@q^UxP7Yzpl3`<%`M`ilfRz9M1K&>b diff --git a/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc index 28e7f8b2691dc65b3eb3a9c8e0fde5d8662914e8..d42cd392e3673a15ec757141e54237c553b31338 100644 GIT binary patch delta 537 zcmZwDJxc>I7zgl#HrH#echy$=e%EWSFQ}7~i@FKEfcOElR%i!b+G4Gv^b1&2vN(vF zij#=np_@a&RVae{vxwkio)$A1$e-kwCokkX@szY4Op_DYD#KXau&%5My?$;C{Gv+Z zQ4bfe)zUZC9X$(o*2F41HaEtKc~BC4)~A-}X-jk<`kF(_FQ3{a<-uC3vA5scZ8b$l zzvnx$cwY9CS5XMwc0E5E`dP1dKKsTqz~mG(!n85i5J1osWFUyZ6{NvH2q|#EM6eWO zA&fAgz=cVK$OyW4uMJU@DOHk#X@nSIf$>9Jh$AEv@IertOMqlke& j{Ycss9B<3`(H9%7+UZe!xm^|6&_ZsL(g=|MbF}Rj;K+?8 delta 503 zcmZ24`CWo(6)IdO% z>f~pv#~67huVu5H{GLsUQEf99`vk_xOF5QuMFW)>0&(%t$swHc>XlenAF#0Ys`hAI z;gb2l3gmuZV_;>22*`e52MKV%1!O*Of&{qW0@5G2K>|E*0fi5|AOSwOfcyu3kbnSO zK;eTRNI(cIP!FodK^7z+2N#h2AP*8yVqoQf8LF%V5>bJRD1T4|38=vZFkmOa+5nvwgxUZA diff --git a/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc index c5f7f011412a5637051f47888be4657a9466c3a8..2598c44ca5eb0691bbe48aaebfde921de0abbe78 100644 GIT binary patch delta 1413 zcmaKqO=uHQ5Xa~3ZnjCj!lABwGOjHraZJs82lW>pl$ z2qK~fm4_dQhk8-5cq)E?7d;7{66vW>s7S%$B_Ki(6z3%*rfYD>{CAl5oA+Mk&HcCJ z<7?u1swi$i`|?>eGJ|(KA>p@pr|X*21p*k5@v+ZdRi(-WL{ffC1USrXQf1!Ffj-X@ z0x*SMwp8$Rv>ga97BitrmNwHB)Jt3N+rmgwL^Ax7VO}2hEib1KuGBy(QhOXbKvd0$ zP~Q^)&qFU;Dq0Wn+o0BZP{0PQst2hyXmvd(XoEC6v<5F8vO#UN(Bv9MG{0wAs-33< zBf>mltG9!OQ=PTTydOJ_h|y`=b}e?^k%?9MW2~hS8_{LoMl*tRr45Sz3&m;F26fkg zj4s;BhsB1jqhu7~tEM+e4@ZL4X+h43E~0-|37bB2+)3r~M6eSPm3`~(MQHF`RXn zMw*^CRgBFME{$B8P~zgO%&R9(&kA&6R?b>!>r6Jw|GCC;ddR=XA>1!}4}%;OW$=aA zbG_$s%k7N?Av`05^Fnw|Xt)x)8q3Az9gWw|eR8OIhdQS;-_mdBxA#3bRZzNTlA@4n(W_Q{livVdxDQr! z1@G6-w8I;E(xT=1o6R^XF%_v~RoeL2R~$R z`-&ilL*%~=dr{LcT95{3q`|y2$QF{XNP;~&qRaf9%mpT--ny4C*4ofB|9z@n^NP@l#&M0I&JJIl^PJjvnFy}%UvmP zC=Qmv6#BwW=0l;lBp;0%+OH633+Ye4TG}702pR-}l#oIT1(!CUkAC!C$#$ZR?lNa) z?w*-DbLP(c^bO75qskYu>?B|(e%6fGYgd&H!6{uGe&5674H9o-3ZTb91Y(c{FTdl{ zH0FK}=y44k?KlwaW(WUU_P(y}P(r?fQnR>kDbPnK4i*&ElcPG|fWmYD{al(7GGb zIxMuF#x$RW*4voYX`%Ji(fVj@uqh(dg zJFhvfuf1?HT2M!d>PRk9R=q{F=hoou{(?GIRL63W`!;p!qiBBvFta5Ec&2|`mujlJFD^5bsw#SF(WuFen+MIRdZw330!vp_;@h(wt$)G4DHP@? zG;-uYYdimO_K3^59^MG&svnfoLHao-QOJPjpFEwlS55bYgT(2#05Z(%fzZjKe6m#F;Ce22B zRAJiu2t2xNe~tXx=<~sc;4u--;DSy-?K diff --git a/src/var/lib/tyto/program/__pycache__/tools.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/tools.cpython-311.pyc index 3129a0bbfb24f727cbdbc5a488eebd45c3e13200..df7a87c7e641048cd07e4af5333aa04b8ac5ff95 100644 GIT binary patch delta 337 zcmaE=cR-zQIWI340}ymv7EAptFp*D!F>RuH8Y@#UgC^(38Bcf_pG>ahJIcs8*^%Fp zD^Et5fsvtxWdY~pg+d~emoo|oFfv3k3Q%0wuV>5|jAF8O0~B;#X$m0rMa6 z$20Oyb`o&l;Z96Ri7!q~F3HT#o7^Z6!4(3uyA6no%_lz=i1cJ(R=B~=+g{aFH9>ub z@kMs|E9~+Mj4!dPU0_$c!N${&_JNs!L;c4G7Dk{#7Ov|oVwYINCX`=fk-x$se*uPm z{P;0BN^qu%9MIr{N>YyY3D~bSe8G*R?_~dr6%`(D_A|Dtq39wcGK~G#F delta 1097 zcmaJ=O=ufO6rNe_?5=iKqaRDDR22Qhwt^@$h9nRQPHU@HeF#0+fe=F?6z@8yS-b8^ zg~qI6^K7V;7hIJKz*!i2W=j=C%K$3l_12OTA{wBNg$D4*HDWi#0(L zEzfnVNtOWUwa9h+t6(8b))Y;?AwVbe5PyFq^{w9lR&;aHrEST+#Hb@iyGZp!nqzIRTpMqzzP0>H{-?>+$=XC) z4X&M9In@le)P$oZY7;xb*tO)x49f5I(1Yi0H!ofIC)ba{ zh{n4L6x&tyt^W6p{VKb=yKhUPtg949GOdTpQ8?fA@sV8Iu2AG qJ`vpOX%^Z2(7Un@q5G$lAF$`4zupVra2LIS5kIC~^lvZ|u;Vq~qYV83 diff --git a/src/var/lib/tyto/program/__pycache__/userset.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/userset.cpython-311.pyc index f0eeefd6569d9a14289e8015b21325df3bf56de7..beda49e2b97bb7e9a767b201c8a594e5d0195df0 100644 GIT binary patch delta 104 zcmeyt{)3%&IWI340}w2`DVAC_kvDZ>of=OKLkeRy6G*fuV&f8RCh@0C94&emnS`z| o30+_kdcexvQQ8#W5I^}DlMmyA$;QkpWds?OJ}_VsMKVA`06K*n#{d8T delta 104 zcmeyt{)3%&IWI340}yr`c;&7IWI340}#YL5KGOT$ScXXYNGmbjwp>3jbH{%&5f7VG70korCsuK6EpKt z6%vz6GRqFH++4?O!NRDyc{_U(BNt~1STa68Z?XmF5-tOvaz-F7elqzP=Qd`g2F}T| Kxb#`{fI