fix: make semantic changes to commands

* add missing __main__ call to commands.py
* remove unnecessary imports
* fix backup WITH_FILES logic
* follow python semantics (?)

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai
2020-04-29 01:45:59 +05:30
parent 5a5a79f206
commit 884a82d814
11 changed files with 103 additions and 55 deletions

View File

@@ -1,7 +1,8 @@
import os, frappe, compileall, re
import os
import frappe
from frappe.utils.backups import scheduled_backup
from frappe.utils import now
from frappe.utils import get_sites
from frappe.utils import cint, get_sites, now
def backup(sites, with_files=False):
for site in sites:
@@ -20,13 +21,15 @@ def backup(sites, with_files=False):
print("private files backup taken -", odb.backup_path_private_files, "- on", now())
frappe.destroy()
def main():
installed_sites = ":".join(get_sites())
sites = os.environ.get("SITES", installed_sites).split(":")
with_files=True if os.environ.get("WITH_FILES") else False
with_files = cint(os.environ.get("WITH_FILES"))
backup(sites, with_files)
exit(0)
if __name__ == "__main__":
main()