summaryrefslogtreecommitdiff
blob: 9fca1027820c0be256ff31128caaca476adb1086 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-arch/q7z/q7z-0.8.0.ebuild,v 1.3 2010/07/14 16:06:45 arfrever Exp $

EAPI="2"
PYTHON_DEPEND="2"
inherit eutils python

MY_PN="Q7Z"

DESCRIPTION="A GUI frontend for p7zip"
HOMEPAGE="http://code.google.com/p/k7z/"
SRC_URI="http://k7z.googlecode.com/files/${MY_PN}-${PV}.tar.bz2"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~sparc ~x86"
IUSE=""

RESTRICT="test"

DEPEND="app-arch/p7zip
	dev-python/PyQt4[X]"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MY_PN}/Build"

pkg_setup() {
	python_set_active_version 2
}

src_prepare() {
	cd ..

	# fix paths used at runtime
	epatch "${FILESDIR}/${PV}-fix_paths.patch"
	# remove '-r' flag from 7z as it's not supposed to be used
	epatch "${FILESDIR}/${PV}-fix_7z_flags.patch"
	# fix imports to reference the q7z package
	epatch "${FILESDIR}/${PV}-fix_imports.patch"

	# patch menu entry to have correct name
	mv "Desktop/Menu/${MY_PN}.desktop" "Desktop/Menu/${PN}.desktop"
	sed -i "s/${MY_PN}/${PN}/" "Desktop/Menu/${PN}.desktop" \
		|| die "sed failed"

	python_convert_shebangs -r 2 .

	cd Source
	mv "${MY_PN}.pyw" "${PN}.pyw"
}

src_install() {
	cd ..

	insinto "$(python_get_sitedir)/${PN}"
	doins Source/*.py || die
	newins "${FILESDIR}/${PV}-init.py" __init__.py || die

	insinto "/usr/share/${PN}/Options"
	doins Options/* || die
	insinto "/usr/share/${PN}/Profiles"
	doins Desktop/Profiles/* || die

	dobin "Source/${PN}.pyw" || die
	dosym "/usr/bin/${PN}.pyw" "/usr/bin/${PN}" || die

	# install menu entry
	insinto /usr/share/icons/hicolor/32x32/apps
	newins "Image/apps/${MY_PN}.png" "${PN}.png" || die
	domenu "Desktop/Menu/${PN}.desktop" || die
}

pkg_postinst() {
	python_mod_optimize "$(python_get_sitedir)/${PN}"
}

pkg_postrm() {
	python_mod_cleanup "$(python_get_sitedir)/${PN}"
}