update setup

This commit is contained in:
Dimitris Zlatanidis 2014-11-26 05:42:23 +02:00
parent b9a42d3778
commit 624059f662

View file

@ -31,6 +31,8 @@ from slpkg.__metadata__ import (
__email__, __email__,
__author__ __author__
) )
from slpkg.checksum import md5sum
try: try:
from setuptools import setup from setuptools import setup
@ -93,5 +95,12 @@ if "install" in sys.argv:
if not os.path.exists(conf_path): if not os.path.exists(conf_path):
os.system("mkdir -p {0}".format(conf_path)) os.system("mkdir -p {0}".format(conf_path))
for conf in conf_file: for conf in conf_file:
print("Installing '{0}' file".format(conf.split("/")[-1])) filename = conf.split("/")[-1]
print("Installing '{0}' file".format(filename))
if os.path.isfile(conf_path + filename):
old = md5sum(conf_path + filename)
new = md5sum(conf)
if old != new:
shutil.copy2(conf, conf_path + filename + ".new")
else:
shutil.copy2(conf, conf_path) shutil.copy2(conf, conf_path)