mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-17 06:11:35 +01:00
fix setup
This commit is contained in:
parent
3b31bd1085
commit
aa84ae9b68
2 changed files with 36 additions and 3 deletions
6
setup.py
6
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:
|
||||
|
|
33
slpkg/md5sum.py
Normal file
33
slpkg/md5sum.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# md5sum.py file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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()
|
Loading…
Reference in a new issue