summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2023-10-08 21:57:02 -0700
committerSam James <sam@gentoo.org>2023-10-12 06:04:06 +0100
commit78c8fbe8a35cd2926f37f21235c5d8b587efae46 (patch)
tree90e60104e244ef71e643753b43b083ed0d0f2775
parenteclean: pkg: suppress invalid binary error (diff)
downloadgentoolkit-0.6.3.tar.gz
gentoolkit-0.6.3.tar.bz2
gentoolkit-0.6.3.zip
Migrate to PEP517 meson-python buildgentoolkit-0.6.3
Bug: https://bugs.gentoo.org/909888 Signed-off-by: Zac Medico <zmedico@gentoo.org> Closes: https://github.com/gentoo/gentoolkit/pull/36 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--.github/workflows/ci.yml17
-rw-r--r--MANIFEST.in13
-rwxr-xr-xbin/ebump2
-rwxr-xr-xbin/euse2
-rw-r--r--bin/meson.build55
-rwxr-xr-xbin/revdep-rebuild.sh2
-rw-r--r--data/meson.build20
-rw-r--r--man/meson.build23
-rw-r--r--meson.build68
-rw-r--r--meson_options.txt15
-rw-r--r--pym/gentoolkit/eclean/cli.py2
-rw-r--r--pym/gentoolkit/eclean/meson.build18
-rwxr-xr-xpym/gentoolkit/ekeyword/ekeyword.py2
-rw-r--r--pym/gentoolkit/ekeyword/meson.build26
-rw-r--r--pym/gentoolkit/ekeyword/tests/meson.build12
-rw-r--r--pym/gentoolkit/enalyze/__init__.py4
-rw-r--r--pym/gentoolkit/enalyze/meson.build17
-rw-r--r--pym/gentoolkit/equery/__init__.py4
-rw-r--r--pym/gentoolkit/equery/meson.build26
-rw-r--r--pym/gentoolkit/eshowkw/__init__.py2
-rw-r--r--pym/gentoolkit/eshowkw/meson.build16
-rwxr-xr-xpym/gentoolkit/imlate/imlate.py2
-rw-r--r--pym/gentoolkit/imlate/meson.build14
-rw-r--r--pym/gentoolkit/meson.build35
-rw-r--r--pym/gentoolkit/revdep_rebuild/__init__.py2
-rw-r--r--pym/gentoolkit/revdep_rebuild/meson.build21
-rw-r--r--pym/gentoolkit/test/eclean/meson.build20
-rw-r--r--pym/gentoolkit/test/equery/meson.build7
-rw-r--r--pym/gentoolkit/test/meson.build16
-rw-r--r--pym/meson.build1
-rw-r--r--pyproject.toml17
-rwxr-xr-xsetup.py176
32 files changed, 454 insertions, 203 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 36a636a..c78050d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,6 +25,14 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ set -xe
+ python -VV
+ python -m site
+ python -m pip install --upgrade pip
+ # setuptools needed for 3.12+ because of https://github.com/mesonbuild/meson/issues/7702.
+ python -m pip install meson ninja setuptools
- name: Install portage
run: |
mkdir portage
@@ -38,8 +46,13 @@ jobs:
sudo wget "https://www.gentoo.org/dtd/metadata.dtd" -O /var/cache/distfiles/metadata.dtd
sudo wget "https://gitweb.gentoo.org/proj/portage.git/plain/cnf/repos.conf" -O /etc/portage/repos.conf
sudo ln -s /var/db/repos/gentoo/profiles/default/linux/amd64/17.1/systemd /etc/portage/make.profile
- - name: Run tests
+ - name: Test meson install --destdir /tmp/install-root
+ run: |
+ echo -e "[binaries]\npython = '$(command -v python)'" > /tmp/native.ini
+ meson setup --native-file /tmp/native.ini /tmp/build .
+ meson install -C /tmp/build --destdir /tmp/install-root
+ - name: Run tests for ${{ matrix.python-version }}
run: |
export PYTHONPATH="${PWD}/portage/lib"${PYTHONPATH:+:}${PYTHONPATH}
export PATH="${PWD}/portage/bin":${PATH}
- python setup.py test
+ meson test -C /tmp/build --verbose
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 8f26bea..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,13 +0,0 @@
-include AUTHORS
-include ChangeLog
-include COPYING
-include CREDITS
-include DEVELOPING
-include NEWS
-include README
-include TODO
-include setup.py
-recursive-include data *
-recursive-include bin *
-recursive-include man *
-recursive-include pym *.py *.txt
diff --git a/bin/ebump b/bin/ebump
index 25e9a7c..dc045e7 100755
--- a/bin/ebump
+++ b/bin/ebump
@@ -12,7 +12,7 @@ __description__="Ebuild version bumping tool"
# a given ebuild and auxiliary files in the Portage tree. It is only
# useful for Gentoo developers with CVS commit access.
-VERSION="git"
+VERSION="@VERSION@"
die() {
echo $1 >&2
diff --git a/bin/euse b/bin/euse
index daffd66..f15a36c 100755
--- a/bin/euse
+++ b/bin/euse
@@ -8,7 +8,7 @@ set -f
# Licensed under the GPL v2
PROGRAM_NAME=euse
-VERSION="git"
+VERSION="@VERSION@"
EPREFIX=${EPREFIX:-$(portageq envvar EPREFIX)}
ETC="${EPREFIX}/etc"
diff --git a/bin/meson.build b/bin/meson.build
new file mode 100644
index 0000000..eb99870
--- /dev/null
+++ b/bin/meson.build
@@ -0,0 +1,55 @@
+py_bins = [
+ 'eclean',
+ 'eclean-dist',
+ 'eclean-pkg',
+ 'ekeyword',
+ 'enalyze',
+ 'epkginfo',
+ 'equery',
+ 'eread',
+ 'eshowkw',
+ 'imlate',
+ 'merge-driver-ekeyword',
+ 'revdep-rebuild',
+]
+
+ebump = configure_file(
+ input : 'ebump',
+ output : 'ebump',
+ configuration : conf_data
+)
+
+euse = configure_file(
+ input : 'euse',
+ output : 'euse',
+ configuration : conf_data
+)
+
+revdep_rebuild_sh = configure_file(
+ input : 'revdep-rebuild.sh',
+ output : 'revdep-rebuild.sh',
+ configuration : conf_data
+)
+
+other_bins = [
+ ebump,
+ euse,
+ revdep_rebuild_sh,
+]
+
+# It might seem sensible to use py.install_sources() to install the Python
+# scripts, but it's really just a wrapper around install_data that forces the
+# install_dir. Meson 1.2.0 and later also optimize to bytecode, but Gentoo does
+# this in the ebuild.
+
+install_data(
+ py_bins,
+ install_dir : get_option('bindir'),
+ install_mode : 'rwxr-xr-x',
+)
+
+install_data(
+ other_bins,
+ install_dir : get_option('bindir'),
+ install_mode : 'rwxr-xr-x',
+)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 09b0d1c..457b0f2 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -18,7 +18,7 @@ unset GREP_OPTIONS
# Readonly variables:
declare -r APP_NAME="revdep-rebuild" # # The name of this application
-declare -r VERSION="git"
+declare -r VERSION="@VERSION@"
declare -r OIFS="$IFS" # Save the IFS
declare -r ENV_FILE=0_env.rr # Contains environment variables
declare -r FILES_FILE=1_files.rr # Contains a list of files to search
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..f79ec01
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,20 @@
+install_data(
+ [
+ '99gentoolkit-env',
+ ],
+ install_dir : sysconfdir / 'env.d'
+)
+
+install_data(
+ [
+ 'eclean/packages.exclude',
+ 'eclean/distfiles.exclude',
+ 'revdep-rebuild/99revdep-rebuild',
+ ],
+ install_dir: sysconfdir,
+ preserve_path: true
+)
+
+if not system_wide
+ subdir_done()
+endif
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..aa888f7
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,23 @@
+man_pages_out = []
+man_pages_in = [
+ 'ebump.1',
+ 'eclean.1',
+ 'enalyze.1',
+ 'epkginfo.1',
+ 'equery.1',
+ 'eread.1',
+ 'eshowkw.1',
+ 'euse.1',
+ 'imlate.1',
+ 'revdep-rebuild.1',
+]
+
+foreach man_page : man_pages_in
+ man_pages_out += configure_file(
+ input : man_page,
+ output : man_page,
+ configuration : conf_data
+ )
+endforeach
+
+install_man(man_pages_out)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..b609876
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,68 @@
+project(
+ 'gentoolkit',
+ 'c',
+ version : '0.6.2',
+ license : 'GPL-2.0-or-later',
+ meson_version : '>=0.64.0'
+)
+
+py_mod = import('python')
+py = py_mod.find_installation(pure : true)
+
+sed = find_program('sed', required : true)
+
+system_wide = get_option('system-wide')
+
+eprefix = get_option('eprefix')
+prefixdir = get_option('prefix')
+datadir = get_option('datadir')
+docdir = get_option('docdir')
+
+sysconfdir = system_wide ? get_option('sysconfdir') \
+ : datadir / 'etc'
+
+if docdir == ''
+ docdir = system_wide ? datadir / 'doc' / 'gentoolkit' \
+ : datadir / 'share' / 'gentoolkit' / 'doc'
+endif
+
+conf_data = configuration_data({
+ 'VERSION' : meson.project_version()
+})
+
+if system_wide
+ conf_data.set('INSTALL_TYPE', 'SYSTEM')
+ conf_data.set('EPREFIX', eprefix)
+else
+ conf_data.set('INSTALL_TYPE', 'MODULE')
+ conf_data.set('EPREFIX', '')
+endif
+
+subdir('bin')
+subdir('pym')
+
+test(
+ 'python-unittest',
+ py,
+ args : ['-m', 'unittest', 'discover', meson.current_source_dir() / 'pym'],
+ timeout : 0
+)
+
+if get_option('code-only')
+ subdir_done()
+endif
+
+subdir('data')
+
+install_data(
+ [
+ 'NEWS',
+ ],
+ install_dir : docdir
+)
+
+if not system_wide
+ subdir_done()
+endif
+
+subdir('man')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..265d572
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,15 @@
+option('system-wide', type : 'boolean', value : true,
+ description : 'Install system-wide rather than isolated inside a Python environment'
+)
+
+option('code-only', type : 'boolean', value : false,
+ description : 'Do not install additional files such as configuration or documentation'
+)
+
+option('eprefix', type : 'string',
+ description : 'Prefix directory for gentoolkit to operate under'
+)
+
+option('docdir', type : 'string',
+ description : 'Documentation directory'
+)
diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index b180641..e3dd540 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -9,7 +9,7 @@ __author__ = (
+ "modular re-write by: Brian Dolbec (dol-sen)"
)
__email__ = "degrenier@easyconnect.fr, " + "brian.dolbec@gmail.com"
-__version__ = "git"
+__version__ = "@VERSION@"
__productname__ = "eclean"
__description__ = "A cleaning tool for Gentoo distfiles and binaries."
diff --git a/pym/gentoolkit/eclean/meson.build b/pym/gentoolkit/eclean/meson.build
new file mode 100644
index 0000000..8a28284
--- /dev/null
+++ b/pym/gentoolkit/eclean/meson.build
@@ -0,0 +1,18 @@
+
+cli_py = configure_file(
+ input : 'cli.py',
+ output : 'cli.py',
+ configuration : conf_data
+)
+
+py.install_sources(
+ [
+ '__init__.py',
+ 'clean.py',
+ cli_py,
+ 'exclude.py',
+ 'output.py',
+ 'search.py',
+ ],
+ subdir : 'gentoolkit/eclean'
+)
diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py
index 01946e9..aa4986e 100755
--- a/pym/gentoolkit/ekeyword/ekeyword.py
+++ b/pym/gentoolkit/ekeyword/ekeyword.py
@@ -50,7 +50,7 @@ import portage
from portage.output import colorize, nocolor
-__version__ = "git"
+__version__ = "@VERSION@"
# Operation object that describes how to perform a change.
# Args:
diff --git a/pym/gentoolkit/ekeyword/meson.build b/pym/gentoolkit/ekeyword/meson.build
new file mode 100644
index 0000000..f4f86f8
--- /dev/null
+++ b/pym/gentoolkit/ekeyword/meson.build
@@ -0,0 +1,26 @@
+
+ekeyword_py = configure_file(
+ input : 'ekeyword.py',
+ output : 'ekeyword.py',
+ configuration : conf_data
+)
+
+py.install_sources(
+ [
+ '__init__.py',
+ ekeyword_py,
+ 'test_ekeyword.py',
+ ],
+ subdir : 'gentoolkit/ekeyword'
+)
+
+install_data(
+ [
+ 'Makefile',
+ 'README',
+ 'pytest.ini',
+ ],
+ install_dir : py.get_install_dir() / 'gentoolkit' / 'ekeyword'
+)
+
+subdir('tests')
diff --git a/pym/gentoolkit/ekeyword/tests/meson.build b/pym/gentoolkit/ekeyword/tests/meson.build
new file mode 100644
index 0000000..3926731
--- /dev/null
+++ b/pym/gentoolkit/ekeyword/tests/meson.build
@@ -0,0 +1,12 @@
+install_data(
+ [
+ 'process-1.ebuild',
+ 'profiles/arches-desc/profiles/arch.list',
+ 'profiles/arches-desc/profiles/arches.desc',
+ 'profiles/arches-desc/profiles/profiles.desc',
+ 'profiles/both/profiles/arch.list',
+ 'profiles/both/profiles/profiles.desc',
+ ],
+ preserve_path: true,
+ install_dir : py.get_install_dir() / 'gentoolkit' / 'ekeyword' / 'tests'
+)
diff --git a/pym/gentoolkit/enalyze/__init__.py b/pym/gentoolkit/enalyze/__init__.py
index 1f099ac..875de2e 100644
--- a/pym/gentoolkit/enalyze/__init__.py
+++ b/pym/gentoolkit/enalyze/__init__.py
@@ -12,8 +12,8 @@
__docformat__ = "epytext"
-# version is dynamically set by distutils sdist
-__version__ = "git"
+# version is dynamically set by meson dist
+__version__ = "@VERSION@"
__productname__ = "enalyze"
__authors__ = "Brian Dolbec, <brian.dolbec@gmail.com>"
diff --git a/pym/gentoolkit/enalyze/meson.build b/pym/gentoolkit/enalyze/meson.build
new file mode 100644
index 0000000..2747677
--- /dev/null
+++ b/pym/gentoolkit/enalyze/meson.build
@@ -0,0 +1,17 @@
+
+__init__py = configure_file(
+ input : '__init__.py',
+ output : '__init__.py',
+ configuration : conf_data
+)
+
+py.install_sources(
+ [
+ __init__py,
+ 'analyze.py',
+ 'lib.py',
+ 'output.py',
+ 'rebuild.py',
+ ],
+ subdir : 'gentoolkit/enalyze'
+)
diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py
index 15a9b6a..7beb631 100644
--- a/pym/gentoolkit/equery/__init__.py
+++ b/pym/gentoolkit/equery/__init__.py
@@ -6,8 +6,8 @@
__all__ = ("format_options", "format_package_names", "mod_usage")
__docformat__ = "epytext"
-# version is dynamically set by distutils sdist
-__version__ = "git"
+# version is dynamically set by meson dist
+__version__ = "@VERSION@"
# =======
# Imports
diff --git a/pym/gentoolkit/equery/meson.build b/pym/gentoolkit/equery/meson.build
new file mode 100644
index 0000000..e6a02c8
--- /dev/null
+++ b/pym/gentoolkit/equery/meson.build
@@ -0,0 +1,26 @@
+
+__init__py = configure_file(
+ input : '__init__.py',
+ output : '__init__.py',
+ configuration : conf_data
+)
+
+py.install_sources(
+ [
+ __init__py,
+ 'belongs.py',
+ 'check.py',
+ 'depends.py',
+ 'depgraph.py',
+ 'files.py',
+ 'has.py',
+ 'hasuse.py',
+ 'keywords.py',
+ 'list_.py',
+ 'meta.py',
+ 'size.py',
+ 'uses.py',
+ 'which.py',
+ ],
+ subdir : 'gentoolkit/equery'
+)
diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index 1aa6982..0d65733 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
__package__ = "gentoolkit.eshowkw"
-__version__ = "git"
+__version__ = "@VERSION@"
__author__ = "Tomáš Chvátal <scarabeus@gentoo.org>"
import sys, os, fnmatch
diff --git a/pym/gentoolkit/eshowkw/meson.build b/pym/gentoolkit/eshowkw/meson.build
new file mode 100644
index 0000000..b7a838e
--- /dev/null
+++ b/pym/gentoolkit/eshowkw/meson.build
@@ -0,0 +1,16 @@
+
+__init__py = configure_file(
+ input : '__init__.py',
+ output : '__init__.py',
+ configuration : conf_data
+)
+
+py.install_sources(
+ [
+ __init__py,
+ 'display_pretty.py',
+ 'keywords_content.py',
+ 'keywords_header.py'
+ ],
+ subdir : 'gentoolkit/eshowkw'
+)
diff --git a/pym/gentoolkit/imlate/imlate.py b/pym/gentoolkit/imlate/imlate.py
index 1db322a..0c7ab04 100755
--- a/pym/gentoolkit/imlate/imlate.py
+++ b/pym/gentoolkit/imlate/imlate.py
@@ -4,7 +4,7 @@
# $Id$
# Author: Christian Ruppert <idl0r@gentoo.org>
-__version__ = "git"
+__version__ = "@VERSION@"
# works just with stable keywords!
MAIN_ARCH = "auto" # can be overridden by -m ARCH
diff --git a/pym/gentoolkit/imlate/meson.build b/pym/gentoolkit/imlate/meson.build
new file mode 100644
index 0000000..5208c23
--- /dev/null
+++ b/pym/gentoolkit/imlate/meson.build
@@ -0,0 +1,14 @@
+
+imlate_py = configure_file(
+ input : 'imlate.py',
+ output : 'imlate.py',
+ configuration : conf_data
+)
+
+py.install_sources(
+ [
+ '__init__.py',
+ imlate_py,
+ ],
+ subdir : 'gentoolkit/imlate'
+)
diff --git a/pym/gentoolkit/meson.build b/pym/gentoolkit/meson.build
new file mode 100644
index 0000000..7908d94
--- /dev/null
+++ b/pym/gentoolkit/meson.build
@@ -0,0 +1,35 @@
+
+py.install_sources(
+ [
+ '__init__.py',
+ 'atom.py',
+ 'base.py',
+ 'cpv.py',
+ 'dbapi.py',
+ 'dependencies.py',
+ 'eprefix.py',
+ 'errors.py',
+ 'flag.py',
+ 'formatters.py',
+ 'helpers.py',
+ 'keyword.py',
+ 'module_base.py',
+ 'package.py',
+ 'pprinter.py',
+ 'profile.py',
+ 'query.py',
+ 'sets.py',
+ 'textwrap_.py',
+ 'versionmatch.py',
+ ],
+ subdir : 'gentoolkit'
+)
+
+subdir('eclean')
+subdir('ekeyword')
+subdir('enalyze')
+subdir('equery')
+subdir('eshowkw')
+subdir('imlate')
+subdir('revdep_rebuild')
+subdir('test')
diff --git a/pym/gentoolkit/revdep_rebuild/__init__.py b/pym/gentoolkit/revdep_rebuild/__init__.py
index 7fba30b..66a943f 100644
--- a/pym/gentoolkit/revdep_rebuild/__init__.py
+++ b/pym/gentoolkit/revdep_rebuild/__init__.py
@@ -3,4 +3,4 @@
# Copyright 2003-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-__version__ = "git"
+__version__ = "@VERSION@"
diff --git a/pym/gentoolkit/revdep_rebuild/meson.build b/pym/gentoolkit/revdep_rebuild/meson.build
new file mode 100644
index 0000000..b73eff8
--- /dev/null
+++ b/pym/gentoolkit/revdep_rebuild/meson.build
@@ -0,0 +1,21 @@
+
+__init__py = configure_file(
+ input : '__init__.py',
+ output : '__init__.py',
+ configuration : conf_data
+)
+
+py.install_sources(
+ [
+ __init__py,
+ 'analyse.py',
+ 'assign.py',
+ 'cache.py',
+ 'collect.py',
+ 'rebuild.py',
+ 'runner.py',
+ 'settings.py',
+ 'stuff.py',
+ ],
+ subdir : 'gentoolkit/revdep_rebuild'
+)
diff --git a/pym/gentoolkit/test/eclean/meson.build b/pym/gentoolkit/test/eclean/meson.build
new file mode 100644
index 0000000..fa1390b
--- /dev/null
+++ b/pym/gentoolkit/test/eclean/meson.build
@@ -0,0 +1,20 @@
+py.install_sources(
+ [
+ '__init__.py',
+ 'creator.py',
+ 'distsupport.py',
+ 'test_clean.py',
+ 'test_search.py',
+ ],
+ subdir : 'gentoolkit/test/eclean'
+)
+
+install_data(
+ [
+ 'Packages',
+ 'distfiles.exclude',
+ 'testdistfiles.tar.gz',
+ ],
+ preserve_path: true,
+ install_dir : py.get_install_dir() / 'gentoolkit' / 'test' / 'eclean'
+)
diff --git a/pym/gentoolkit/test/equery/meson.build b/pym/gentoolkit/test/equery/meson.build
new file mode 100644
index 0000000..02a0df2
--- /dev/null
+++ b/pym/gentoolkit/test/equery/meson.build
@@ -0,0 +1,7 @@
+py.install_sources(
+ [
+ '__init__.py',
+ 'test_init.py',
+ ],
+ subdir : 'gentoolkit/test/equery'
+)
diff --git a/pym/gentoolkit/test/meson.build b/pym/gentoolkit/test/meson.build
new file mode 100644
index 0000000..2d8c0e7
--- /dev/null
+++ b/pym/gentoolkit/test/meson.build
@@ -0,0 +1,16 @@
+py.install_sources(
+ [
+ '__init__.py',
+ 'test_atom.py',
+ 'test_cpv.py',
+ 'test_helpers.py',
+ 'test_keyword.py',
+ 'test_profile.py',
+ 'test_query.py',
+ 'test_syntax.py',
+ ],
+ subdir : 'gentoolkit/test'
+)
+
+subdir('eclean')
+subdir('equery')
diff --git a/pym/meson.build b/pym/meson.build
new file mode 100644
index 0000000..9b1b354
--- /dev/null
+++ b/pym/meson.build
@@ -0,0 +1 @@
+subdir('gentoolkit')
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..fae23b5
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,17 @@
+[project]
+name = 'gentoolkit'
+dynamic = ['version']
+description = 'Collection of administration scripts for Gentoo'
+readme = 'README.md'
+requires-python = '>=3.9'
+license = {file = "COPYING"}
+authors = [
+ {name = 'Gentoo Portage tools team', email = 'tools-portage@gentoo.org'},
+]
+
+[build-system]
+build-backend = 'mesonpy'
+requires = ['meson-python']
+
+[tool.meson-python.args]
+setup = ['-Dsystem-wide=false']
diff --git a/setup.py b/setup.py
deleted file mode 100755
index 6299ac8..0000000
--- a/setup.py
+++ /dev/null
@@ -1,176 +0,0 @@
-#!/usr/bin/env python
-
-import re
-import sys
-import subprocess
-from distutils import core
-from distutils.cmd import Command
-from glob import glob
-
-import os
-import io
-
-sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "pym"))
-
-if (len(sys.argv) > 2) and (sys.argv[1] == "set_version"):
- __version__ = sys.argv[2]
-else:
- __version__ = os.getenv("VERSION", default=os.getenv("PVR", default="9999"))
-
-cwd = os.getcwd()
-
-# Load EPREFIX from Portage, fall back to the empty string if it fails
-try:
- from portage.const import EPREFIX
-except ImportError:
- EPREFIX = ""
-
-
-# Bash files that need `VERSION=""` subbed, relative to this dir:
-bash_scripts = [
- (os.path.join(cwd, path), "VERSION=")
- for path in ("bin/ebump", "bin/euse", "bin/revdep-rebuild.sh")
-]
-
-# Python files that need `__version__ = ""` subbed, relative to this dir:
-python_scripts = [
- (os.path.join(cwd, path), "__version__ = ")
- for path in (
- "bin/eclean",
- "bin/eclean-dist",
- "bin/eclean-pkg",
- "bin/epkginfo",
- "pym/gentoolkit/eclean/cli.py",
- "pym/gentoolkit/enalyze/__init__.py",
- "pym/gentoolkit/ekeyword/ekeyword.py",
- "pym/gentoolkit/equery/__init__.py",
- "pym/gentoolkit/eshowkw/__init__.py",
- "pym/gentoolkit/imlate/imlate.py",
- "pym/gentoolkit/revdep_rebuild/__init__.py",
- )
-]
-
-manpages = [
- (os.path.join(cwd, path[0]), path[1])
- for path in (
- ("man/ebump.1", "EBUMP"),
- ("man/eclean.1", "ECLEAN"),
- ("man/enalyze.1", "ENALYZE"),
- ("man/epkginfo.1", "EPKGINFO"),
- ("man/equery.1", "EQUERY"),
- ("man/eread.1", "EREAD"),
- ("man/eshowkw.1", "ESHOWKW"),
- ("man/euse.1", "EUSE"),
- ("man/imlate.1", "IMLATE"),
- ("man/revdep-rebuild.1", "REVDEP-REBUILD"),
- )
-]
-
-
-class set_version(core.Command):
- """Set python __version__ and bash VERSION to our __version__."""
-
- description = "hardcode scripts' version using VERSION from environment"
- user_options = [] # [(long_name, short_name, desc),]
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- ver = "git" if __version__ == "9999" else __version__
- print("Setting version to %s" % ver)
-
- def sub(files, pattern):
- for f in files:
- updated_file = []
- with open(f[0], "r", 1, "utf_8") as s:
- for line in s:
- newline = re.sub(pattern % f[1], '"%s"' % ver, line, 1)
- updated_file.append(newline)
- with open(f[0], "w", 1, "utf_8") as s:
- s.writelines(updated_file)
-
- quote = r'[\'"]{1}'
- bash_re = r"(?<=%s)" + quote + "[^'\"]*" + quote
- sub(bash_scripts, bash_re)
- python_re = r"(?<=^%s)" + quote + "[^'\"]*" + quote
- sub(python_scripts, python_re)
- man_re = r'(?<=^.TH "%s" "[0-9]" )' + quote + "[^'\"]*" + quote
- sub(manpages, man_re)
-
-
-class TestCommand(Command):
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- args = [sys.executable, "-m", "unittest", "discover", "pym"]
- raise SystemExit(subprocess.call(args))
-
-
-packages = [
- str(".".join(root.split(os.sep)[1:]))
- for root, dirs, files in os.walk("pym/gentoolkit")
- if "__init__.py" in files
-]
-
-test_data = {
- "gentoolkit": [
- "test/eclean/Packages",
- "test/eclean/testdistfiles.tar.gz",
- "test/eclean/distfiles.exclude",
- ]
-}
-
-core.setup(
- name="gentoolkit",
- version=__version__,
- description="Set of tools that work with and enhance portage.",
- author="",
- author_email="",
- maintainer="Gentoo Portage Tools Team",
- maintainer_email="tools-portage@gentoo.org",
- url="http://www.gentoo.org/proj/en/portage/tools/index.xml",
- download_url="http://distfiles.gentoo.org/distfiles/gentoolkit-%s.tar.gz"
- % __version__,
- package_dir={"": "pym"},
- packages=packages,
- package_data=test_data,
- scripts=(glob("bin/*")),
- data_files=(
- (
- os.path.join(os.sep, EPREFIX.lstrip(os.sep), "etc/env.d"),
- ["data/99gentoolkit-env"],
- ),
- (
- os.path.join(os.sep, EPREFIX.lstrip(os.sep), "etc/revdep-rebuild"),
- ["data/revdep-rebuild/99revdep-rebuild"],
- ),
- (
- os.path.join(os.sep, EPREFIX.lstrip(os.sep), "etc/eclean"),
- glob("data/eclean/*"),
- ),
- (
- os.path.join(os.sep, EPREFIX.lstrip(os.sep), "usr/share/man/man1"),
- glob("man/*"),
- ),
- (
- os.path.join(os.sep, EPREFIX.lstrip(os.sep), "usr/lib/tmpfiles.d"),
- ["data/tmpfiles.d/revdep-rebuild.conf"],
- ),
- ),
- cmdclass={
- "test": TestCommand,
- "set_version": set_version,
- },
-)
-
-# vim: set ts=4 sw=4 tw=79: