Annotation of /trunk/include/pypi.sminc
Parent Directory | Revision Log
Revision 29776 -
(hide annotations)
(download)
Wed Oct 11 09:52:54 2017 UTC (7 years ago) by niro
File size: 2790 byte(s)
Wed Oct 11 09:52:54 2017 UTC (7 years ago) by niro
File size: 2790 byte(s)
-be python2 and python3 friendly and automatically generate split_packages
1 | niro | 20726 | # $Id$ |
2 | # Pypi functions | ||
3 | |||
4 | niro | 29776 | # default to build modules for multiple python versions (atm python2 and python3) |
5 | : ${PYPI_MULTIPLE_PYTHON_VERSIONS=1} | ||
6 | |||
7 | niro | 20726 | # needs python |
8 | sminclude python | ||
9 | |||
10 | : ${PYPI_MODULE="${PNAME}"} | ||
11 | niro | 20731 | : ${PYPI_ARCHIVE="gz"} |
12 | niro | 20726 | |
13 | # some sane defaults | ||
14 | : ${PCAT="dev-python"} | ||
15 | # always lower letters | ||
16 | : ${HOMEPAGE="http://pypi.python.org/pypi/${PYPI_MODULE}"} | ||
17 | niro | 20731 | |
18 | case ${PYPI_ARCHIVE} in | ||
19 | niro | 29665 | gz|bz2|xz) : ${SRCFILE="${PYPI_MODULE}-${PVER}.tar.${PYPI_ARCHIVE}"} ;; |
20 | niro | 20731 | *) : ${SRCFILE="${PYPI_MODULE}-${PVER}.${PYPI_ARCHIVE}"} ;; |
21 | esac | ||
22 | |||
23 | niro | 20726 | : ${SRCDIR="${BUILDDIR}/${PYPI_MODULE}-${PVER}"} |
24 | |||
25 | |||
26 | niro | 29776 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
27 | then | ||
28 | sminclude python2 python3 | ||
29 | SPLIT_PACKAGES="python2-${PNAME} python3-${PNAME}" | ||
30 | |||
31 | eval "split_info_python2-${PNAME}() | ||
32 | { | ||
33 | DEPEND=\"\${DEPEND} | ||
34 | >= dev-lang/python2-2.7\" | ||
35 | }" | ||
36 | |||
37 | eval "split_info_python3-${PNAME}() | ||
38 | { | ||
39 | DEPEND=\"\${DEPEND} | ||
40 | >= dev-lang/python3-3.6\" | ||
41 | }" | ||
42 | |||
43 | else | ||
44 | DEPEND="${DEPEND} | ||
45 | >= dev-lang/python-2.7" | ||
46 | fi | ||
47 | |||
48 | niro | 20726 | SRC_URI=( |
49 | ${SRC_URI[*]} | ||
50 | https://pypi.python.org/packages/source/${PYPI_MODULE:0:1}/${PYPI_MODULE}/${SRCFILE} | ||
51 | mirror://${PNAME}/${SRCFILE} | ||
52 | ) | ||
53 | |||
54 | niro | 22054 | UP2SUBSTITUTE=".asc" |
55 | niro | 20742 | UP2DATE="updatecmd_pypi ${PYPI_MODULE} ${PYPI_ARCHIVE}" |
56 | niro | 20726 | |
57 | pypi_src_prepare() | ||
58 | { | ||
59 | niro | 29776 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
60 | then | ||
61 | python2_src_prepare || die | ||
62 | python3_src_prepare || die | ||
63 | else | ||
64 | python_src_prepare || die | ||
65 | fi | ||
66 | niro | 20726 | } |
67 | |||
68 | pypi_src_compile() | ||
69 | { | ||
70 | local configure_opts="$@" | ||
71 | niro | 29776 | |
72 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] | ||
73 | then | ||
74 | python2_src_compile ${configure_opts} || die | ||
75 | python3_src_compile ${configure_opts} || die | ||
76 | else | ||
77 | python_src_compile ${configure_opts} || die | ||
78 | fi | ||
79 | niro | 20726 | } |
80 | |||
81 | niro | 21128 | pypi_src_install() |
82 | { | ||
83 | niro | 29776 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
84 | then | ||
85 | python2_src_install || die | ||
86 | python3_src_install || die | ||
87 | else | ||
88 | python_src_install || die | ||
89 | fi | ||
90 | niro | 21128 | } |
91 | |||
92 | niro | 21032 | pypi_multilib_src_compile() |
93 | niro | 20726 | { |
94 | niro | 21032 | local configure_opts="$@" |
95 | python_multilib_src_compile ${configure_opts} || die | ||
96 | niro | 29776 | |
97 | niro | 20726 | } |
98 | |||
99 | niro | 29776 | pypi_multilib_python2_src_compile() |
100 | { | ||
101 | local configure_opts="$@" | ||
102 | |||
103 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] | ||
104 | then | ||
105 | python2_multilib_src_compile ${configure_opts} || die | ||
106 | python3_multilib_src_compile ${configure_opts} || die | ||
107 | else | ||
108 | python_multilib_src_compile ${configure_opts} || die | ||
109 | fi | ||
110 | } | ||
111 | |||
112 | niro | 21032 | pypi_multilib_src_install() |
113 | { | ||
114 | python_multilib_src_install || die | ||
115 | } | ||
116 | |||
117 | niro | 29776 | eval "pypi_multilib_src_compile-python2-${PNAME}() |
118 | { | ||
119 | python2_multilib_src_install || die | ||
120 | }" | ||
121 | |||
122 | eval "pypi_multilib_src_compile-python3-${PNAME}() | ||
123 | { | ||
124 | python3_multilib_src_install || die | ||
125 | }" | ||
126 | |||
127 | niro | 21032 | export_inherits pypi src_prepare |
128 | if [[ ${MULTILIB_BUILD} = true ]] | ||
129 | then | ||
130 | niro | 29776 | if [[ ${PYPI_MULTIPLE_PYTHON_VERSIONS} = 1 ]] |
131 | then | ||
132 | export_inherits pypi_multilib src_compile src_install_python2-${PNAME} src_install_python3-${PNAME} | ||
133 | else | ||
134 | export_inherits pypi_multilib src_compile src_install | ||
135 | fi | ||
136 | niro | 21032 | else |
137 | export_inherits pypi src_compile src_install | ||
138 | fi |