Fixed installation

This commit is contained in:
Dimitris Zlatanidis 2022-06-18 21:25:14 +03:00
parent 76952eb391
commit 1e5bcb6a9f
7 changed files with 33 additions and 7 deletions

View file

@ -24,7 +24,7 @@
__version() {
# Grab version from __metadata_.py file
cat slpkg/metadata.py | grep "version_info: tuple = (" \
cat slpkg/version.py | grep "version_info: tuple = (" \
| tr -d [[:space:]] | cut -c21-25 | tr , .
}

View file

@ -3,7 +3,7 @@
from setuptools import setup
from slpkg.metadata import Metadata
from slpkg.version import Version
install_requires = ['SQLAlchemy>=1.4.36']
@ -13,12 +13,12 @@ setup(
name='slpkg',
packages=['slpkg', 'slpkg/models', 'slpkg/views'],
scripts=['bin/slpkg'],
version=Metadata.version,
version=Version.version,
description='Package manager for Slackware installations',
long_description=open('README.rst').read(),
keywords=['slackware', 'slpkg', 'update', 'build', 'install', 'remove',
'slackpkg', 'tool'],
author=Metadata.author,
author='dslackw',
url='https://dslackw.gitlab.io/slpkg/',
package_data={'': ['LICENSE.txt', 'README.rst', 'ChangeLog.txt']},
data_files=[('/etc/slpkg', ['config/slpkg.json']),

View file

@ -9,6 +9,7 @@ config() {
}
config etc/slpkg/slpkg.json.new
config etc/slpkg/blacklist.json.new
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1

View file

@ -24,7 +24,7 @@
__version() {
# Grab version from __metadata_.py file
cat ../slpkg/metadata.py | grep "version_info: tuple = (" \
cat ../slpkg/version.py | grep "version_info: tuple = (" \
| tr -d [[:space:]] | cut -c21-25 | tr , .
}
@ -99,6 +99,7 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr
# install configuration files
mkdir -p $PKG/etc/slpkg
install -D -m0644 config/slpkg.json $PKG/etc/slpkg/slpkg.json.new
install -D -m0644 config/blacklist.json $PKG/etc/slpkg/blacklist.json.new
mkdir -p $PKG/usr/man/man1
cp man/slpkg.1 $PKG/usr/man/man1

View file

@ -12,6 +12,7 @@ from slpkg.remove_packages import RemovePackages
from slpkg.update_repository import UpdateRepository
from slpkg.clean_logs import CleanLogsDependencies
from slpkg.checks import Check
from slpkg.version import Version
@dataclass
@ -49,7 +50,7 @@ class Argparse:
usage(0)
if self.args[0] in ['--version', '-v']:
print(f'{Metadata.prog_name}: {Metadata.version}')
print(f'{Metadata.prog_nama}: {Version.version}')
raise SystemExit()
if self.args[0] == 'clean-logs':

View file

@ -9,12 +9,13 @@ from dataclasses import dataclass
@dataclass
class Metadata:
# Project info
# Programme name
prog_name: str = 'slpkg'
''' Default configurations. '''
# OS architecture by default
os_arch: str = 'x86_64'
# All necessary paths
tmp_path: str = '/tmp'
tmp_slpkg: str = f'{tmp_path}/{prog_name}'
@ -24,8 +25,10 @@ class Metadata:
db_path: str = f'/var/lib/{prog_name}/database'
sbo_repo_path: str = f'/var/lib/{prog_name}/repository'
log_packages: str = '/var/log/packages'
# Database name
database: str = f'database.{prog_name}'
# Repository details
repo_version: str = '15.0'
sbo_url: str = f'http://slackbuilds.org/slackbuilds/{repo_version}'
@ -33,10 +36,12 @@ class Metadata:
tar_suffix: str = '.tar.gz'
pkg_suffix: str = '.tgz'
repo_tag: str = '_SBo'
# Slackware commands
installpkg: str = 'upgradepkg --install-new'
reinstall: str = 'upgradepkg --reinstall'
removepkg: str = 'removepkg'
# Other configs
colors: str = 'on'
wget_options = '-c -N'
@ -47,6 +52,7 @@ class Metadata:
# OS architecture by default
os_arch: str = config['os_arch']
# All necessary paths
tmp_path: str = config['tmp_path']
tmp_slpkg: str = config['tmp_slpkg']
@ -56,8 +62,10 @@ class Metadata:
db_path: str = config['db_path']
sbo_repo_path: str = config['sbo_repo_path']
log_packages: str = config['log_packages']
# Database name
database: str = config['database']
# Repository details
repo_version: str = config['repo_version']
sbo_url: str = config['sbo_url']
@ -65,10 +73,12 @@ class Metadata:
tar_suffix: str = config['tar_suffix']
pkg_suffix: str = config['pkg_suffix']
repo_tag: str = config['repo_tag']
# Slackware commands
installpkg: str = config['installpkg']
reinstall: str = config['reinstall']
removepkg: str = config['removepkg']
# Other configs
colors: str = config['colors']
wget_options: str = config['wget_options']

13
slpkg/version.py Normal file
View file

@ -0,0 +1,13 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from dataclasses import dataclass
@dataclass
class Version:
version_info: tuple = (4, 1, 0)
version: str = '{0}.{1}.{2}'.format(*version_info)
license: str = 'MIT License'
author: str = 'dslackw'