Advertisement
yellowhat

pyload-9999.ebuild

Nov 26th, 2011
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $
  4.  
  5. EAPI=3
  6.  
  7. PYTHON_DEPEND="2"
  8. PYTHON_USE_WITH="sqlite"
  9.  
  10. inherit base eutils python systemd
  11.  
  12. if [[ ${PV} == *9999 ]]; then
  13. EHG_REPO_URI="http://bitbucket.org/spoob/pyload/"
  14. inherit mercurial
  15. else
  16. SRC_URI="http://get.pyload.org/static/${PN}-src-v${PV}.zip"
  17. fi
  18. DESCRIPTION="A fast, lightweight and full featured download manager for many One-Click-Hosters."
  19. HOMEPAGE="http://www.pyload.org"
  20. LICENSE="freedist"
  21. SLOT="0"
  22. IUSE="captcha clicknload container qt4 rar ssl systemd"
  23. KEYWORDS="~amd64 ~x86"
  24.  
  25. DEPEND="app-arch/unzip"
  26.  
  27. RDEPEND="${DEPEND}
  28. dev-python/beautifulsoup
  29. dev-python/beaker
  30. dev-python/feedparser
  31. dev-python/simplejson
  32. dev-python/pycurl
  33. dev-python/jinja
  34. captcha? (
  35. dev-python/imaging
  36. app-text/tesseract
  37. )
  38. clicknload? (
  39. || (
  40. dev-lang/spidermonkey
  41. dev-java/rhino
  42. )
  43. )
  44. container? ( dev-python/pycrypto )
  45. qt4? ( dev-python/PyQt4 )
  46. rar? ( app-arch/unrar )
  47. ssl? (
  48. dev-python/pycrypto
  49. dev-python/pyopenssl
  50. )"
  51. #clicknload? ( || ( ... ossp-js pyv8 ) )
  52.  
  53. S=${WORKDIR}/${PN}
  54.  
  55. PYLOAD_WORKDIR="/var/lib/pyload" # (/var/lib/ in lack of a better place)
  56.  
  57. pkg_setup() {
  58. python_pkg_setup
  59. python_set_active_version 2
  60. # enewuser pyload -1 -1 ${PYLOAD_WORKDIR}
  61. }
  62.  
  63. src_unpack() {
  64. if [[ ${PV} == *9999 ]]; then
  65. mercurial_src_unpack
  66. else
  67. default
  68. #base_src_unpack
  69. fi
  70.  
  71. cd "${S}"
  72. # epatch "${FILESDIR}/pyload-pid.patch"
  73. epatch "${FILESDIR}/pyload-sanitize-config.patch"
  74. # epatch "${FILESDIR}/pyload-locale-fix.patch"
  75. }
  76.  
  77. src_prepare() {
  78. # fix pidfile
  79. sed -i -e 's:self.pidfile = "pyload.pid":self.pidfile = "/var/run/pyload.pid":' ${S}/pyLoadCore.py
  80.  
  81. # fix workdir
  82. echo ${PYLOAD_WORKDIR} > ${S}/module/config/configdir
  83.  
  84. # replace some shipped dependencies with the system libraries
  85. rm -r \
  86. ${S}/module/lib/BeautifulSoup.py \
  87. ${S}/module/lib/beaker \
  88. ${S}/module/lib/feedparser.py \
  89. ${S}/module/lib/simplejson \
  90. ${S}/module/lib/jinja2 \
  91.  
  92.  
  93. find ${S}/module/ -name "*.py" -type f -print0 | xargs -0 \
  94. sed -i \
  95. -e 's:from module.lib.BeautifulSoup:from BeautifulSoup:' \
  96. -e 's:from module.lib \(import feedparser.*\):\1:' \
  97. -e 's:from module.lib.simplejson:from simplejson:' \
  98. -e 's:from module:from pyload:' \
  99. -e 's:"module\(.*\)":"pyload\1":' \
  100. #${S}/module/**/*.py # globbing not working -> find
  101.  
  102. sed -i -e 's:from module:from pyload:' pyLoadCore.py
  103.  
  104. sed -i -e 's:from module:from pyload:' pyLoadCli.py
  105.  
  106. if ! use qt4; then
  107. rm -r ${S}/module/gui
  108. fi
  109. }
  110.  
  111. src_configure() {
  112. :
  113. }
  114.  
  115. src_compile() {
  116. :
  117. }
  118.  
  119. src_install() {
  120. insinto $(python_get_sitedir)/${PN}
  121. doins -r ${S}/module/*
  122. insinto /usr/share/${PN}
  123. doins -r ${S}/locale
  124. #doins -r ${S}/module
  125. doins -r ${S}/scripts
  126. exeinto /usr/bin/
  127. newexe ${S}/pyLoadCore.py pyLoadCore
  128. newexe ${S}/pyLoadCli.py pyLoadCli
  129.  
  130.  
  131. if use qt4; then
  132. doins -r ${S}/icons
  133. make_wrapper pyloadgui /opt/${PN}/pyLoadGui.py
  134. fi
  135.  
  136. dodir ${PYLOAD_WORKDIR}
  137. # install default config
  138. if ! test -f ${PYLOAD_WORKDIR}/pyload.conf; then
  139. cp ${S}/module/config/default.conf ${D}/${PYLOAD_WORKDIR}/pyload.conf
  140. fi
  141.  
  142. #fix tmpdir
  143. dosym /tmp ${PYLOAD_WORKDIR}/tmp
  144.  
  145. newinitd ${FILESDIR}/pyload.init pyload
  146. newconfd ${FILESDIR}/pyload.confd pyload
  147.  
  148. if use systemd; then
  149. systemd_dounit ${FILESDIR}/pyload.service
  150. fi
  151.  
  152. python_convert_shebangs -q -r 2 "${D}"
  153. }
  154.  
  155. pkg_postinst() {
  156. python_mod_optimize ${PN}
  157. if use ssl && ! test -f ${PYLOAD_WORKDIR}/ssl.key; then
  158. einfo "If you plan using pyLoad's XML-RPC via SSL, you'll have to create a key in pyloads work directory"
  159. echo
  160. einfo "For the lazy, the list of needed commands is:"
  161. echo
  162. einfo "cd ${PYLOAD_WORKDIR}"
  163. einfo "openssl genrsa 1024 > ssl.key"
  164. einfo "openssl req -new -key ssl.key -out ssl.csr"
  165. einfo "openssl req -days 36500 -x509 -key ssl.key -in ssl.csr > ssl.crt"
  166. fi
  167. }
  168.  
  169. pkg_postrm() {
  170. python_mod_cleanup ${PN}
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement