summaryrefslogtreecommitdiff
path: root/libre/python-markdown2/PKGBUILD
blob: beebc60e3b16de715b63c4911ee9201e388f7887 (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
# $Id$
# Maintainer: Luke Shumaker <lukeshu@lukeshu.com>
# Maintainer (Arch:python-markdown): Kyle Keen <keenerd@gmail.com>
# Contributor (Arch:python-markdown): Angel Velasquez <angvp@archlinux.org>
# Contributor (Arch:python-markdown): Andrew Antle <andrew dot antle at gmail dot com>
# Contributor (Arch:python-markdown): Thomas Dziedzic < gostrc at gmail >
# Contributor (Arch:python-markdown): Chaiwat Suttipongsakul <cwt at bashell dot com>

# Rational for inclusion in [libre]:
#  - Used by libre/parabolaweb-utils

pkgbase=python-markdown
pkgname=('python-markdown' 'python2-markdown')
pkgbase=${pkgbase}2
pkgname=("${pkgname[@]/%/2}")
_pkgbasename=Markdown
pkgver=2.6.11
pkgrel=2
pkgrel+=.1
pkgdesc="Python implementation of John Gruber's Markdown."
arch=('any')
url='http://pypi.python.org/pypi/Markdown'
license=('BSD')
depends=('python')
makedepends=('python' 'python2' 'python-setuptools' 'python2-setuptools')
source=("https://files.pythonhosted.org/packages/source/M/$_pkgbasename/$_pkgbasename-$pkgver.tar.gz")
md5sums=('a67c1b2914f7d74eeede2ebe0fdae470')

build() {
  # bug in 2.4, some DOS line endings slipped in
  find "$_pkgbasename-$pkgver/" -name '*py' | xargs sed -i 's|\r||g'

  cp -r $_pkgbasename-$pkgver "$srcdir/python2-markdown"
  cd "$srcdir/python2-markdown"
  find "$srcdir/python2-markdown" -name '*py' | xargs sed -i 's|#!/usr/bin/env python$|&2|'
}

package_python-markdown2() {
  depends=('python')
  provides=("python-markdown=$pkgver")
  conflicts=('python-markdown')
  cd "$srcdir/$_pkgbasename-$pkgver"
  python3 setup.py install --root="$pkgdir" --optimize=0
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_python2-markdown2() {
  depends=('python2')
  provides=("python2-markdown=$pkgver")
  conflicts=('python2-markdown')
  cd "$srcdir/python2-markdown"
  python2 setup.py install --root="$pkgdir" --optimize=0
  mv "$pkgdir/usr/bin/markdown_py" "$pkgdir/usr/bin/markdown_py2"
  install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

check_python-markdown2() {
  [[ $(python -c "import markdown; print(markdown.version)") == "$pkgver" ]]
  [[ $(python -c "import markdown; print(markdown.markdown('*test*'))") == "<p><em>test</em></p>" ]]
}

check_python2-markdown2() {
  [[ $(python2 -c "import markdown; print(markdown.version)") == "$pkgver" ]]
  [[ $(python2 -c "import markdown; print(markdown.markdown('*test*'))") == "<p><em>test</em></p>" ]]
}