diff --git a/setup.py b/setup.py index b67d23c6..f0ef3952 100755 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ from slpkg.__metadata__ import ( __email__, __author__ ) -from slpkg.checksum import md5sum +from slpkg.md5sum import md5 try: @@ -98,8 +98,8 @@ if "install" in sys.argv: 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) + old = md5(conf_path + filename) + new = md5(conf) if old != new: shutil.copy2(conf, conf_path + filename + ".new") else: diff --git a/slpkg/md5sum.py b/slpkg/md5sum.py new file mode 100644 index 00000000..bc534387 --- /dev/null +++ b/slpkg/md5sum.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# md5sum.py file is part of slpkg. + +# Copyright 2014 Dimitris Zlatanidis +# All rights reserved. + +# Utility for easy management packages in Slackware + +# https://github.com/dslackw/slpkg + +# Slpkg is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import hashlib + + +def md5(source): + ''' + Return MD5 Checksum + ''' + with open(source) as file_to_check: + data = file_to_check.read() + return hashlib.md5(data).hexdigest()