summaryrefslogtreecommitdiff
path: root/app-misc/rmlint/rmlint-2.10.2.ebuild
blob: 93b2c479581ffeb3b00b0ece64df72bf003a13ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..11} )

inherit gnome2-utils python-single-r1 scons-utils toolchain-funcs

DESCRIPTION="Extremely fast tool to remove duplicates and other lint from your filesystem"
HOMEPAGE="https://rmlint.readthedocs.io/"
SRC_URI="https://github.com/sahib/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc gui nls test"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RESTRICT="!test? ( test )"

DEPEND="
	dev-libs/glib:2
	dev-libs/json-glib
	virtual/libelf:0=
"
RDEPEND="
	${DEPEND}
	gui? (
		${PYTHON_DEPS}
		gnome-base/librsvg:2[introspection]
		x11-libs/gdk-pixbuf[introspection]
		x11-libs/gtk+:3[introspection]
		x11-libs/gtksourceview:3.0[introspection]
		x11-libs/pango[introspection]
		$(python_gen_cond_dep '
			dev-python/colorlog[${PYTHON_USEDEP}]
			dev-python/pygobject:3[${PYTHON_USEDEP}]
		')
	)
"
BDEPEND="
	virtual/pkgconfig
	doc? (
		${PYTHON_DEPS}
		$(python_gen_cond_dep '
			dev-python/sphinx[${PYTHON_USEDEP}]
			dev-python/sphinx-bootstrap-theme[${PYTHON_USEDEP}]
		')
	)
	nls? ( sys-devel/gettext )
	test? (
		${PYTHON_DEPS}
		app-shells/dash
		$(python_gen_cond_dep '
			dev-python/nose[${PYTHON_USEDEP}]
			dev-python/parameterized[${PYTHON_USEDEP}]
			dev-python/psutil[${PYTHON_USEDEP}]
			dev-python/pyxattr[${PYTHON_USEDEP}]
		')
	)
"

DOCS=(CHANGELOG.md README.rst)
PATCHES=(
	# The build system tries to override several CFLAGS
	"${FILESDIR}/${PN}-2.10.1-cflags.patch"
	# https://github.com/sahib/rmlint/pull/520
	"${FILESDIR}/${PN}-2.10.1-scons.patch"
	# Skip problematic tests
	"${FILESDIR}/${PN}-2.10.1-skip-tests.patch"
	# https://github.com/sahib/rmlint/pull/526
	"${FILESDIR}/${PN}-2.10.1-fix-cc.patch"
	# https://github.com/sahib/rmlint/commit/69d9dcb60c9e88084aba37545c77fd02fdc7df33
	"${FILESDIR}/${P}-fix-sorting-tests.patch"
)

src_prepare() {
	default
	# Force the GUI to run with the correct PYTHON_SINGLE_TARGET
	sed -i "/const char \*commands/s/python3/${EPYTHON}/" \
		lib/cmdline.c || die
}

src_configure() {
	# Needed for USE=-native-symlinks
	tc-export AR CC
	scons_opts=(
		VERBOSE=1
		$(use_with doc docs)
		$(use_with gui)
		$(use_with nls gettext)
	)
	escons "${scons_opts[@]}" config
}

src_compile() {
	escons "${scons_opts[@]}"
}

src_test() {
	RM_TS_DIR="${T}/tests" nosetests -s -v -a '!slow' || \
		die "Tests failed"
}

src_install() {
	escons "${scons_opts[@]}" --prefix="${ED}/usr" --actual-prefix="${EPREFIX}/usr" install

	# https://github.com/sahib/rmlint/pull/525
	if use doc; then
		gzip -d "${ED}/usr/share/man/man1/rmlint.1.gz" || die
	fi
	if use gui; then
		python_optimize
	fi
	einstalldocs
}

pkg_preinst() {
	if use gui; then
		gnome2_schemas_savelist
	fi
}

pkg_postinst() {
	if use gui; then
		gnome2_schemas_update
		xdg_icon_cache_update
	fi
}

pkg_postrm() {
	if use gui; then
		gnome2_schemas_update
		xdg_icon_cache_update
	fi
}