2014-05-23 07:46:51 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2014-08-27 20:45:00 +02:00
|
|
|
# setup.py file is part of slpkg.
|
2014-08-13 06:28:04 +02:00
|
|
|
|
|
|
|
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
|
|
|
# All rights reserved.
|
|
|
|
|
2014-12-27 11:59:31 +01:00
|
|
|
# Slpkg is a user-friendly package manager for Slackware installations
|
2014-08-13 06:28:04 +02:00
|
|
|
|
|
|
|
# https://github.com/dslackw/slpkg
|
|
|
|
|
2014-08-27 20:45:00 +02:00
|
|
|
# Slpkg is free software: you can redistribute it and/or modify
|
2014-08-13 06:28:04 +02:00
|
|
|
# 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/>.
|
|
|
|
|
2014-06-20 03:43:40 +02:00
|
|
|
import os
|
|
|
|
import sys
|
2014-10-04 01:12:48 +02:00
|
|
|
import gzip
|
2014-06-20 03:43:40 +02:00
|
|
|
import shutil
|
2014-05-23 07:46:51 +02:00
|
|
|
|
2014-11-22 11:04:11 +01:00
|
|
|
from slpkg.__metadata__ import (
|
|
|
|
__version__,
|
|
|
|
__email__,
|
|
|
|
__author__
|
|
|
|
)
|
2014-12-04 14:43:22 +01:00
|
|
|
from slpkg.md5sum import md5
|
2014-11-26 10:27:58 +01:00
|
|
|
|
2014-07-16 05:21:47 +02:00
|
|
|
|
2014-07-17 04:46:34 +02:00
|
|
|
try:
|
|
|
|
from setuptools import setup
|
|
|
|
except ImportError:
|
|
|
|
from distutils.core import setup
|
2014-05-23 07:46:51 +02:00
|
|
|
|
|
|
|
setup(
|
2014-09-21 23:47:08 +02:00
|
|
|
name="slpkg",
|
2014-11-07 06:05:23 +01:00
|
|
|
packages=["slpkg", "slpkg/sbo", "slpkg/pkg", "slpkg/slack",
|
|
|
|
"slpkg/others"],
|
2014-09-21 23:47:08 +02:00
|
|
|
scripts=["bin/slpkg"],
|
2014-07-16 05:21:47 +02:00
|
|
|
version=__version__,
|
2014-06-20 03:43:40 +02:00
|
|
|
description="Python tool to manage Slackware packages",
|
|
|
|
keywords=["slackware", "slpkg", "upgrade", "install", "remove",
|
2014-10-16 04:39:18 +02:00
|
|
|
"view", "slackpkg", "tool", "build"],
|
2014-07-16 05:21:47 +02:00
|
|
|
author=__author__,
|
|
|
|
author_email=__email__,
|
2014-06-20 03:43:40 +02:00
|
|
|
url="https://github.com/dslackw/slpkg",
|
|
|
|
package_data={"": ["LICENSE", "README.rst", "CHANGELOG"]},
|
|
|
|
classifiers=[
|
2014-07-17 04:46:34 +02:00
|
|
|
"Development Status :: 5 - Production/Stable",
|
|
|
|
"Environment :: Console",
|
2014-05-23 07:46:51 +02:00
|
|
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
|
|
"Operating System :: POSIX :: Linux",
|
2014-07-17 04:46:34 +02:00
|
|
|
"Operating System :: Unix",
|
2014-05-23 07:46:51 +02:00
|
|
|
"Programming Language :: Python",
|
2014-07-17 04:46:34 +02:00
|
|
|
"Programming Language :: Python :: 2",
|
2014-05-23 07:46:51 +02:00
|
|
|
"Programming Language :: Python :: 2.7",
|
2014-07-17 04:46:34 +02:00
|
|
|
"Programming Language :: Unix Shell",
|
|
|
|
"Topic :: Software Development :: Build Tools",
|
|
|
|
"Topic :: System :: Archiving :: Packaging",
|
|
|
|
"Topic :: System :: Software Distribution",
|
|
|
|
"Topic :: Utilities"],
|
2014-05-23 07:46:51 +02:00
|
|
|
long_description=open("README.rst").read()
|
2014-07-16 05:21:47 +02:00
|
|
|
)
|
2014-05-23 07:46:51 +02:00
|
|
|
|
2014-10-16 04:39:18 +02:00
|
|
|
# install man page and blacklist configuration
|
2014-10-04 01:12:48 +02:00
|
|
|
# file if not exists.
|
2014-09-21 23:47:08 +02:00
|
|
|
if "install" in sys.argv:
|
2014-05-23 07:46:51 +02:00
|
|
|
man_path = "/usr/man/man8/"
|
2014-09-27 23:06:45 +02:00
|
|
|
os.system("mkdir -p {0}".format(man_path))
|
2014-05-23 07:46:51 +02:00
|
|
|
if os.path.exists(man_path):
|
|
|
|
man_page = "man/slpkg.8"
|
2014-10-04 01:12:48 +02:00
|
|
|
gzip_man = "man/slpkg.8.gz"
|
|
|
|
print("Installing man pages")
|
|
|
|
f_in = open(man_page, "rb")
|
|
|
|
f_out = gzip.open(gzip_man, 'wb')
|
|
|
|
f_out.writelines(f_in)
|
|
|
|
f_out.close()
|
|
|
|
f_in.close()
|
|
|
|
shutil.copy2(gzip_man, man_path)
|
2014-09-21 23:47:08 +02:00
|
|
|
os.chmod(man_path, int("444", 8))
|
2014-11-18 14:28:09 +01:00
|
|
|
|
2014-10-04 01:12:48 +02:00
|
|
|
conf_path = "/etc/slpkg/"
|
2014-11-22 11:04:11 +01:00
|
|
|
conf_file = [
|
|
|
|
'conf/slpkg.conf',
|
|
|
|
'conf/blacklist',
|
2015-01-08 08:26:58 +01:00
|
|
|
'conf/slackware-mirrors',
|
|
|
|
'conf/custom-repositories'
|
2014-11-22 11:04:11 +01:00
|
|
|
]
|
2014-10-04 01:12:48 +02:00
|
|
|
if not os.path.exists(conf_path):
|
|
|
|
os.system("mkdir -p {0}".format(conf_path))
|
2014-11-22 11:04:11 +01:00
|
|
|
for conf in conf_file:
|
2014-11-26 10:27:58 +01:00
|
|
|
filename = conf.split("/")[-1]
|
|
|
|
print("Installing '{0}' file".format(filename))
|
|
|
|
if os.path.isfile(conf_path + filename):
|
2014-12-04 14:43:22 +01:00
|
|
|
old = md5(conf_path + filename)
|
|
|
|
new = md5(conf)
|
2014-11-26 10:27:58 +01:00
|
|
|
if old != new:
|
|
|
|
shutil.copy2(conf, conf_path + filename + ".new")
|
|
|
|
else:
|
|
|
|
shutil.copy2(conf, conf_path)
|