2014-05-23 07:46:51 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2014-08-27 20:12:17 +02:00
|
|
|
# setup.py file is part of slpkg.
|
2014-08-13 06:28:04 +02:00
|
|
|
|
2017-01-30 08:53:44 +01:00
|
|
|
# Copyright 2014-2017 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
2014-08-13 06:28:04 +02:00
|
|
|
# All rights reserved.
|
|
|
|
|
2014-12-19 05:57:56 +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:12:17 +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/>.
|
|
|
|
|
2015-05-28 05:07:13 +02:00
|
|
|
|
2014-06-20 03:43:40 +02:00
|
|
|
import os
|
|
|
|
import sys
|
2014-10-03 15:57:18 +02:00
|
|
|
import gzip
|
2016-02-09 18:53:51 +01:00
|
|
|
import time
|
2014-06-20 03:43:40 +02:00
|
|
|
import shutil
|
2014-12-07 13:19:30 +01:00
|
|
|
from slpkg.md5sum import md5
|
2015-06-08 14:39:16 +02:00
|
|
|
from slpkg.__metadata__ import MetaData as _meta_
|
2014-11-26 04:42:23 +01: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
|
|
|
|
2015-08-09 14:24:36 +02:00
|
|
|
INSTALLATION_REQUIREMENTS = []
|
2015-08-09 14:56:55 +02:00
|
|
|
DOCS_REQUIREMENTS = []
|
|
|
|
TESTS_REQUIREMENTS = []
|
2015-08-09 14:24:36 +02:00
|
|
|
OPTIONAL_REQUIREMENTS = [
|
2015-08-24 19:25:11 +02:00
|
|
|
"python2-pythondialog >= 3.3.0",
|
2015-09-12 06:10:35 +02:00
|
|
|
"pygraphviz >= 1.3.1"
|
2015-08-09 14:24:36 +02:00
|
|
|
]
|
2015-08-26 02:33:19 +02:00
|
|
|
|
2015-08-22 06:58:41 +02:00
|
|
|
# Non-Python/non-PyPI optional dependencies:
|
|
|
|
# ascii diagram: graph-easy (available from SBo repository)
|
2015-08-09 14:24:36 +02:00
|
|
|
|
2016-02-09 18:53:51 +01:00
|
|
|
logo_fname = os.path.join(os.path.dirname(__file__), 'logo.txt')
|
|
|
|
with open(logo_fname, 'rb') as f:
|
|
|
|
logo = f.read().decode('utf-8')
|
|
|
|
print(logo)
|
|
|
|
time.sleep(1)
|
|
|
|
|
2015-08-25 06:34:40 +02:00
|
|
|
|
2014-05-23 07:46:51 +02:00
|
|
|
setup(
|
2014-09-21 22:08:20 +02:00
|
|
|
name="slpkg",
|
2014-11-07 05:44:16 +01:00
|
|
|
packages=["slpkg", "slpkg/sbo", "slpkg/pkg", "slpkg/slack",
|
2015-01-29 03:21:22 +01:00
|
|
|
"slpkg/binary"],
|
2014-09-21 22:08:20 +02:00
|
|
|
scripts=["bin/slpkg"],
|
2015-06-08 14:39:16 +02:00
|
|
|
version=_meta_.__version__,
|
2015-07-20 13:27:28 +02:00
|
|
|
description="Package manager for Slackware installations",
|
2014-06-20 03:43:40 +02:00
|
|
|
keywords=["slackware", "slpkg", "upgrade", "install", "remove",
|
2014-10-14 05:01:38 +02:00
|
|
|
"view", "slackpkg", "tool", "build"],
|
2015-06-08 14:39:16 +02:00
|
|
|
author=_meta_.__author__,
|
|
|
|
author_email=_meta_.__email__,
|
2014-06-20 03:43:40 +02:00
|
|
|
url="https://github.com/dslackw/slpkg",
|
|
|
|
package_data={"": ["LICENSE", "README.rst", "CHANGELOG"]},
|
2015-08-09 14:24:36 +02:00
|
|
|
install_requires=INSTALLATION_REQUIREMENTS,
|
|
|
|
extras_require={
|
|
|
|
"optional": OPTIONAL_REQUIREMENTS,
|
2015-08-09 14:56:55 +02:00
|
|
|
"docs": DOCS_REQUIREMENTS,
|
|
|
|
"tests": TESTS_REQUIREMENTS,
|
2015-08-09 14:24:36 +02:00
|
|
|
},
|
2014-06-20 03:43:40 +02:00
|
|
|
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
|
|
|
|
2016-05-25 11:14:05 +02:00
|
|
|
# Install man page and configuration files with pip.
|
2014-09-21 22:08:20 +02:00
|
|
|
if "install" in sys.argv:
|
2015-05-26 06:43:56 +02:00
|
|
|
man_path = "/usr/man/man8/"
|
|
|
|
if not os.path.exists(man_path):
|
|
|
|
os.makedirs(man_path)
|
2015-02-17 04:05:47 +01:00
|
|
|
man_page = "man/slpkg.8"
|
|
|
|
gzip_man = "man/slpkg.8.gz"
|
2015-06-05 13:42:52 +02:00
|
|
|
print("Installing '{0}' man pages".format(gzip_man.split("/")[1]))
|
2015-02-17 04:05:47 +01:00
|
|
|
f_in = open(man_page, "rb")
|
2015-06-05 13:42:52 +02:00
|
|
|
f_out = gzip.open(gzip_man, "wb")
|
2015-02-17 04:05:47 +01:00
|
|
|
f_out.writelines(f_in)
|
|
|
|
f_out.close()
|
|
|
|
f_in.close()
|
2015-05-26 06:43:56 +02:00
|
|
|
shutil.copy2(gzip_man, man_path)
|
2015-03-01 12:57:00 +01:00
|
|
|
|
2015-05-26 06:43:56 +02:00
|
|
|
bash_completion = "/etc/bash_completion.d/"
|
|
|
|
fish_completion = "/etc/fish/completions/"
|
2015-03-02 13:38:06 +01:00
|
|
|
completion_file = [
|
2015-06-05 13:42:52 +02:00
|
|
|
"conf/slpkg.bash-completion",
|
|
|
|
"conf/slpkg.fish"
|
2015-03-02 13:38:06 +01:00
|
|
|
]
|
2015-05-26 06:43:56 +02:00
|
|
|
if not os.path.exists(bash_completion):
|
|
|
|
os.makedirs(bash_completion)
|
2015-06-05 13:42:52 +02:00
|
|
|
print("Installing '{0}' file".format(completion_file[0].split("/")[1]))
|
2015-05-26 06:43:56 +02:00
|
|
|
shutil.copy2(completion_file[0], bash_completion)
|
2015-06-05 13:42:52 +02:00
|
|
|
os.chmod(bash_completion + completion_file[0].split("/")[1], 744)
|
2015-05-26 06:43:56 +02:00
|
|
|
if os.path.exists(fish_completion):
|
2015-06-05 13:42:52 +02:00
|
|
|
print("Installing '{0}' file".format(completion_file[1].split("/")[1]))
|
2015-05-26 06:43:56 +02:00
|
|
|
shutil.copy2(completion_file[1], fish_completion)
|
2015-06-05 13:42:52 +02:00
|
|
|
os.chmod(fish_completion + completion_file[1].split("/")[1], 744)
|
2014-11-22 10:16:39 +01:00
|
|
|
conf_file = [
|
2015-06-05 13:42:52 +02:00
|
|
|
"conf/slpkg.conf",
|
2015-09-07 03:33:31 +02:00
|
|
|
"conf/repositories.conf",
|
2015-06-05 13:42:52 +02:00
|
|
|
"conf/blacklist",
|
|
|
|
"conf/slackware-mirrors",
|
2015-09-23 07:57:36 +02:00
|
|
|
"conf/default-repositories",
|
2016-10-19 23:29:33 +02:00
|
|
|
"conf/custom-repositories",
|
2017-02-22 21:12:49 +01:00
|
|
|
"conf/rlworkman.deps",
|
|
|
|
"conf/pkg_security"
|
2014-11-22 10:16:39 +01:00
|
|
|
]
|
2015-06-08 14:39:16 +02:00
|
|
|
if not os.path.exists(_meta_.conf_path):
|
|
|
|
os.makedirs(_meta_.conf_path)
|
2015-04-23 12:04:15 +02:00
|
|
|
for conf in conf_file:
|
2014-11-26 04:42:23 +01:00
|
|
|
filename = conf.split("/")[-1]
|
|
|
|
print("Installing '{0}' file".format(filename))
|
2015-06-08 14:39:16 +02:00
|
|
|
if os.path.isfile(_meta_.conf_path + filename):
|
|
|
|
old = md5(_meta_.conf_path + filename)
|
2014-12-07 13:19:30 +01:00
|
|
|
new = md5(conf)
|
2014-11-26 04:42:23 +01:00
|
|
|
if old != new:
|
2015-06-08 14:39:16 +02:00
|
|
|
shutil.copy2(conf, _meta_.conf_path + filename + ".new")
|
2014-11-26 04:42:23 +01:00
|
|
|
else:
|
2015-06-08 14:39:16 +02:00
|
|
|
shutil.copy2(conf, _meta_.conf_path)
|
2015-09-07 04:25:17 +02:00
|
|
|
shutil.copy2(conf_file[0],
|
|
|
|
_meta_.conf_path + conf_file[0].split("/")[-1] + ".orig")
|