mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated setup file for pip install
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
14063a87e2
commit
5026e9f9c6
3 changed files with 44 additions and 40 deletions
67
setup.py
67
setup.py
|
@ -54,32 +54,6 @@ def print_logo():
|
|||
print(logo)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
current = os.getcwd() + "/"
|
||||
print current
|
||||
conf_file = [
|
||||
"conf/slpkg.conf",
|
||||
"conf/repositories.conf",
|
||||
"conf/blacklist",
|
||||
"conf/slackware-mirrors",
|
||||
"conf/default-repositories",
|
||||
"conf/custom-repositories",
|
||||
"conf/rlworkman.deps",
|
||||
"conf/pkg_security"
|
||||
]
|
||||
if not os.path.exists(_meta_.conf_path):
|
||||
os.makedirs(_meta_.conf_path)
|
||||
for i, conf in enumerate(conf_file):
|
||||
filename = conf.split("/")[-1]
|
||||
if os.path.isfile(_meta_.conf_path + filename):
|
||||
old = md5(_meta_.conf_path + filename)
|
||||
new = md5(conf)
|
||||
if old != new:
|
||||
shutil.move(_meta_.conf_path + filename,
|
||||
_meta_.conf_path + filename + ".old")
|
||||
shutil.move(current + conf, current + conf + ".new")
|
||||
conf_file[i] = conf + ".new"
|
||||
|
||||
print_logo()
|
||||
|
||||
setup(
|
||||
|
@ -95,18 +69,10 @@ setup(
|
|||
author_email=_meta_.__email__,
|
||||
url="https://github.com/dslackw/slpkg",
|
||||
package_data={"": ["LICENSE", "README.rst", "CHANGELOG"]},
|
||||
install_requires=INSTALLATION_REQUIREMENTS,
|
||||
data_files=[("man/man8", ["man/slpkg.8"]),
|
||||
("/etc/bash_completion.d", ["conf/slpkg.bash-completion"]),
|
||||
("/etc/fish/completions", ["conf/slpkg.fish"]),
|
||||
(_meta_.conf_path, [conf_file[0]]),
|
||||
(_meta_.conf_path, ["conf/repositories.conf"]),
|
||||
(_meta_.conf_path, ["conf/blacklist"]),
|
||||
(_meta_.conf_path, ["conf/slackware-mirrors"]),
|
||||
(_meta_.conf_path, ["conf/default-repositories"]),
|
||||
(_meta_.conf_path, ["conf/custom-repositories"]),
|
||||
(_meta_.conf_path, ["conf/rlworkman.deps"]),
|
||||
(_meta_.conf_path, ["conf/pkg_security"])],
|
||||
("/etc/fish/completions", ["conf/slpkg.fish"])],
|
||||
install_requires=INSTALLATION_REQUIREMENTS,
|
||||
extras_require={
|
||||
"optional": OPTIONAL_REQUIREMENTS,
|
||||
"docs": DOCS_REQUIREMENTS,
|
||||
|
@ -129,6 +95,29 @@ setup(
|
|||
long_description=open("README.rst").read()
|
||||
)
|
||||
|
||||
for f in os.listdir(_meta_.conf_path):
|
||||
if f.endswith(".old"):
|
||||
shutil.move(_meta_.conf_path + f, _meta_.conf_path + f[:-4])
|
||||
# Install man page and configuration files with pip.
|
||||
if "install" in sys.argv:
|
||||
conf_file = [
|
||||
"conf/slpkg.conf",
|
||||
"conf/repositories.conf",
|
||||
"conf/blacklist",
|
||||
"conf/slackware-mirrors",
|
||||
"conf/default-repositories",
|
||||
"conf/custom-repositories",
|
||||
"conf/rlworkman.deps",
|
||||
"conf/pkg_security"
|
||||
]
|
||||
if not os.path.exists(_meta_.conf_path):
|
||||
os.makedirs(_meta_.conf_path)
|
||||
for conf in conf_file:
|
||||
filename = conf.split("/")[-1]
|
||||
print("Installing '{0}' file".format(filename))
|
||||
if os.path.isfile(_meta_.conf_path + filename):
|
||||
old = md5(_meta_.conf_path + filename)
|
||||
new = md5(conf)
|
||||
if old != new:
|
||||
shutil.copy2(conf, _meta_.conf_path + filename + ".new")
|
||||
else:
|
||||
shutil.copy2(conf, _meta_.conf_path)
|
||||
shutil.copy2(conf_file[0],
|
||||
_meta_.conf_path + conf_file[0].split("/")[-1] + ".orig")
|
||||
|
|
|
@ -80,7 +80,10 @@ find -L . \
|
|||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
# Python 3 support temporarily is out until new Slackware version release
|
||||
# avoid pip installs
|
||||
sed -i 's/if "install"/if ""/' setup.py
|
||||
|
||||
# Python 3 support temporarily is out until new Slackware version
|
||||
# will be release
|
||||
# if [ "$PYTHON3" = "yes" ]; then
|
||||
# sh convert-py3k
|
||||
|
@ -92,6 +95,17 @@ $PYTHON setup.py install --root=$PKG
|
|||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
mkdir -p $PKG/etc/slpkg
|
||||
# install configurations files
|
||||
CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors default-repositories \
|
||||
custom-repositories rlworkman.deps pkg_security"
|
||||
for file in $CONFIGS; do
|
||||
install -D -m0644 conf/$file $PKG/etc/slpkg/${file}.new
|
||||
done
|
||||
|
||||
# keep original configuration file for reset
|
||||
cp -p conf/slpkg.conf $PKG/etc/slpkg/slpkg.conf.orig
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a README.rst ChangeLog.txt LICENSE TESTING ISSUES KNOWN_ISSUES REPOSITORIES \
|
||||
requirements.txt $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
# 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 os
|
||||
|
||||
from slpkg.utils import Utils
|
||||
|
|
Loading…
Reference in a new issue