mirror of
https://github.com/Derisis13/barusu.git
synced 2025-12-06 19:42:48 +01:00
Changed setup.py to install dependencies and provide more information of the program
Also cleaned up main.py
This commit is contained in:
38
main.py
38
main.py
@@ -76,15 +76,15 @@ def restore():
|
|||||||
|
|
||||||
|
|
||||||
def check_progs():
|
def check_progs():
|
||||||
apt = distutils.spawn.find_executable("apt-get")
|
apt_present = distutils.spawn.find_executable("apt-get")
|
||||||
dconf = distutils.spawn.find_executable("dconf")
|
dconf_present = distutils.spawn.find_executable("dconf")
|
||||||
if apt == False:
|
if apt_present is False:
|
||||||
print("Your system is not using apt as a package manager! Barusu uses apt to back up your packages. Barusu IS "
|
print("Your system is not using apt as a package manager! Barusu uses apt to back up your packages. Barusu IS "
|
||||||
"NOT designed to work with other packaging tools.")
|
"NOT designed to work with other packaging tools.")
|
||||||
if dconf = False:
|
if dconf_present is False:
|
||||||
print("Your system is not using dconf! Barusu uses dconf to back up your settings. Barusu IS "
|
print("Your system is not using dconf! Barusu uses dconf to back up your settings. Barusu IS "
|
||||||
"NOT designed to work with other settings manager.")
|
"NOT designed to work with other settings manager.")
|
||||||
return apt, dconf
|
return apt_present, dconf_present
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@@ -94,19 +94,20 @@ if __name__ == '__main__':
|
|||||||
except getopt.GetoptError as err:
|
except getopt.GetoptError as err:
|
||||||
print("Error: ", err.msg)
|
print("Error: ", err.msg)
|
||||||
exit(1)
|
exit(1)
|
||||||
for option, value in options:
|
else:
|
||||||
if option in ("-h", "help"):
|
for option, value in options:
|
||||||
print("usage: backup_assistant [opts]\n\
|
if option in ("-h", "help"):
|
||||||
Options:\n\
|
print("usage: backup_assistant [opts]\n\
|
||||||
\t-h --help: show this\n\
|
Options:\n\
|
||||||
\t-d --backup-dir [directory]: set the directory for the backup/restoration (default is ~/.backups)\n\
|
\t-h --help: show this\n\
|
||||||
\t-r --restore: run the restoration (from backupdir)\n")
|
\t-d --backup-dir [directory]: set the directory for the backup/restoration (default is ~/.backups)\n\
|
||||||
exit()
|
\t-r --restore: run the restoration (from backupdir)\n")
|
||||||
elif option in ("-d", "backup-dir"):
|
exit()
|
||||||
backupdir = os.path.expanduser(value)
|
elif option in ("-d", "backup-dir"):
|
||||||
elif option in ("-r", "restore"):
|
backupdir = os.path.expanduser(value)
|
||||||
restore()
|
elif option in ("-r", "restore"):
|
||||||
exit()
|
restore()
|
||||||
|
exit()
|
||||||
|
|
||||||
apt, dconf = check_progs()
|
apt, dconf = check_progs()
|
||||||
if apt and dconf:
|
if apt and dconf:
|
||||||
@@ -122,4 +123,3 @@ if __name__ == '__main__':
|
|||||||
run_daily()
|
run_daily()
|
||||||
list_pkgs()
|
list_pkgs()
|
||||||
save_settings()
|
save_settings()
|
||||||
|
|
||||||
|
|||||||
7
setup.py
7
setup.py
@@ -1,5 +1,8 @@
|
|||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
|
import setuptools
|
||||||
|
|
||||||
setup(name="backup_assistant",
|
setup(name="backup_assistant",
|
||||||
version='1.0',
|
version='1.0', description="Python apt and dconf backup tool", author="Derisis13",
|
||||||
py_modules=["main"])
|
py_modules=["main"],
|
||||||
|
packages=setuptools.find_packages())
|
||||||
|
|||||||
Reference in New Issue
Block a user