diff --git a/setup.py b/setup.py index 24c7eb14..ef177a42 100755 --- a/setup.py +++ b/setup.py @@ -55,30 +55,32 @@ def print_logo(): time.sleep(1) -def setup_configurations(): - conf_file = [ - "conf/slpkg.conf", - "conf/repositories.conf", - "conf/blacklist", - "conf/slackware-mirrors", - "conf/default-repositories", - "conf/custom-repositories", - "conf/rlworkman.deps", - "conf/pkg_security" - ] - if not os.path.exists(_meta_.conf_path): - os.makedirs(_meta_.conf_path) - for conf in conf_file: - filename = conf.split("/")[-1] - if os.path.isfile(_meta_.conf_path + filename): - old = md5(_meta_.conf_path + filename) - new = md5(conf) - if old != new: - shutil.copy2(_meta_.conf_path + filename, - _meta_.conf_path + filename + ".old") +current = os.getcwd() + "/" +print current +conf_file = [ + "conf/slpkg.conf", + "conf/repositories.conf", + "conf/blacklist", + "conf/slackware-mirrors", + "conf/default-repositories", + "conf/custom-repositories", + "conf/rlworkman.deps", + "conf/pkg_security" +] +if not os.path.exists(_meta_.conf_path): + os.makedirs(_meta_.conf_path) +for i, conf in enumerate(conf_file): + filename = conf.split("/")[-1] + if os.path.isfile(_meta_.conf_path + filename): + old = md5(_meta_.conf_path + filename) + new = md5(conf) + if old != new: + shutil.move(_meta_.conf_path + filename, + _meta_.conf_path + filename + ".old") + shutil.move(current + conf, current + conf + ".new") + conf_file[i] = conf + ".new" print_logo() -setup_configurations() setup( name="slpkg", @@ -97,7 +99,7 @@ setup( data_files=[("man/man8", ["man/slpkg.8"]), ("/etc/bash_completion.d", ["conf/slpkg.bash-completion"]), ("/etc/fish/completions", ["conf/slpkg.fish"]), - (_meta_.conf_path, ["conf/slpkg.conf"]), + (_meta_.conf_path, [conf_file[0]]), (_meta_.conf_path, ["conf/repositories.conf"]), (_meta_.conf_path, ["conf/blacklist"]), (_meta_.conf_path, ["conf/slackware-mirrors"]), @@ -126,3 +128,7 @@ setup( "Topic :: Utilities"], long_description=open("README.rst").read() ) + +for f in os.listdir(_meta_.conf_path): + if f.endswith(".old"): + shutil.move(_meta_.conf_path + f, _meta_.conf_path + f[:-4])