From c3e0af470773b6756d65538981e8060ccdbce914 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 29 Jun 2023 22:51:13 +0300 Subject: [PATCH] Updated for package build --- ChangeLog.txt | 1 + install.sh | 8 ++---- pyproject.toml | 12 ++++---- setup.cfg | 56 ------------------------------------- setup.py | 5 ---- slackbuild/doinst.sh | 2 +- slackbuild/slpkg.SlackBuild | 10 ++----- 7 files changed, 13 insertions(+), 81 deletions(-) delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/ChangeLog.txt b/ChangeLog.txt index 1d1c76a4..3f2c2409 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ - Updated: * Bullet progress bar color * Logging path to /var/log/slpkg/ + * Package build with pyproject.toml file (require python3-build) - Added: * Process log file under /var/log/slpkg/filename_date_time.log diff --git a/install.sh b/install.sh index 7f65fabf..11c6032a 100755 --- a/install.sh +++ b/install.sh @@ -22,13 +22,8 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version() { -# Grab version from __metadata_.py file -cat setup.cfg | grep "version =" | tr -d "[:space:]" | cut -c9-13 | tr , . -} - PRGNAM=slpkg -VERSION=${VERSION:-$(__version)} +VERSION=$(cat pyproject.toml | grep "version =" | grep -oe "\([0-9.]*\)") ARCHIVES="$PRGNAM-$VERSION.tar.gz $PRGNAM-$VERSION.tar.bz2 $PRGNAM-$VERSION.zip" @@ -40,5 +35,6 @@ for file in $ARCHIVES; do chmod +x $PRGNAM.SlackBuild ./$PRGNAM.SlackBuild rm $file + break fi done diff --git a/pyproject.toml b/pyproject.toml index 4f8841f3..2799f732 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["setuptools", "setuptools-scm"] -build-backend = "setuptools.build_meta" +requires = ["flit_core>=3.2.0,<4"] +build-backend = "flit_core.buildapi" [project] name = "slpkg" @@ -20,8 +20,6 @@ classifiers = [ "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", "Programming Language :: Unix Shell", "Topic :: Utilities", "Topic :: Software Development :: Build Tools", @@ -38,11 +36,13 @@ dependencies = [ "progress>=1.6", ] -[tool.setuptools] -packages = ["slpkg", "slpkg.models", "slpkg.views", "slpkg.sbos", "slpkg.binaries"] +[tool.flit_core] +name = "slpkg" [project.urls] homepage = "https://dslackw.gitlab.io/slpkg/" +repository = "https://gitlab.com/dslackw/slpkg.git" +changelog = "https://gitlab.com/dslackw/slpkg/-/blob/master/ChangeLog.txt" [project.optional-dependencies] socks = ["PySocks>=1.7.1"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8272b978..00000000 --- a/setup.cfg +++ /dev/null @@ -1,56 +0,0 @@ -[metadata] -name = slpkg -version = 4.9.1 -license_file = LICENSE -author = Dimitris Zlatanidis -author_email = dslackw@gmail.com -description = Package manager utility for Slackware Linux. -long_description = file:README.md -url = https://dslackw.gitlab.io/slpkg/ -project_urls = - Source = https://dslackw.gitlab.io/slpkg/ - Documentation = https://dslackw.gitlab.io/slpkg/ -classifiers = - License :: OSI Approved :: MIT License - Natural Language :: English - Operating System :: POSIX - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Unix Shell - Topic :: Utilities - Topic :: Software Development :: Build Tools - Topic :: System :: Archiving :: Packaging - Topic :: System :: Software Distribution - Topic :: System :: Installation/Setup - Topic :: System :: Systems Administration - Topic :: System :: Software Distribution - -[options] -packages = - slpkg - slpkg.models - slpkg.views - slpkg.sbos - slpkg.binaries -python_requires = >= 3.9 -install_requires = - SQLAlchemy >= 1.4.46 - pythondialog >= 3.5.3 - progress >= 1.6 -include_package_data = True - -[options.entry_points] -console_scripts = - slpkg = slpkg.main:main - slpkg_new-configs = slpkg.new_configs:main - -[options.extras_require] -socks = - PySocks >= 1.7.1 - -[options.packages.find] -where = . diff --git a/setup.py b/setup.py deleted file mode 100755 index 0ae45559..00000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -from setuptools import setup - - -if __name__ == '__main__': - setup() diff --git a/slackbuild/doinst.sh b/slackbuild/doinst.sh index c6a3943f..59e3dcdc 100644 --- a/slackbuild/doinst.sh +++ b/slackbuild/doinst.sh @@ -10,5 +10,5 @@ config() { FILES="slpkg repositories blacklist rules" for file in $FILES; do - install -D -m0644 configs/$file.toml $PKG/etc/slpkg/$file.toml.new + config etc/slpkg/$file.toml.new done \ No newline at end of file diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index 334a2211..9d821b57 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -22,15 +22,10 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version() { -# Grab version from __metadata_.py file -cat ../setup.cfg | grep "version =" | tr -d "[:space:]" | cut -c9-13 | tr , . -} - cd $(dirname $0) ; CWD=$(pwd) PRGNAM=slpkg -VERSION=${VERSION:-$(__version)} +VERSION=$(cat ../pyproject.toml | grep "version =" | grep -oe "\([0-9.]*\)") BUILD=${BUILD:-1} TAG=${TAG:-_dsw} PKGTYPE=${PKGTYPE:-txz} @@ -86,7 +81,8 @@ 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 {} \; -python3 setup.py install --root=$PKG +python3 -m build --wheel --no-isolation +python3 -m installer --destdir "$PKG" dist/*.whl # Move executables to the /usr/sbin folder. mkdir -p $PKG/usr/sbin