| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.163 2012/12/20 06:26:16 floppym Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.164 2012/12/20 06:34:57 floppym Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: python.eclass |
5 | # @ECLASS: python.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Gentoo Python Project <python@gentoo.org> |
7 | # Gentoo Python Project <python@gentoo.org> |
| 8 | # @BLURB: Eclass for Python packages |
8 | # @BLURB: Eclass for Python packages |
| … | |
… | |
| 1298 | pypy_interpreter_re = re.compile(r"^pypy-c(\d+\.\d+)$") |
1298 | pypy_interpreter_re = re.compile(r"^pypy-c(\d+\.\d+)$") |
| 1299 | cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)") |
1299 | cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)") |
| 1300 | python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)") |
1300 | python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)") |
| 1301 | python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$") |
1301 | python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$") |
| 1302 | |
1302 | |
| 1303 | pypy_versions_mapping = { |
1303 | #pypy_versions_mapping = { |
| 1304 | "1.5": "2.7", |
1304 | # "1.5": "2.7", |
| 1305 | "1.6": "2.7", |
1305 | # "1.6": "2.7", |
| 1306 | "1.7": "2.7", |
1306 | # "1.7": "2.7", |
| 1307 | "1.8": "2.7", |
1307 | # "1.8": "2.7", |
| 1308 | "1.9": "2.7", |
1308 | # "1.9": "2.7", |
| 1309 | "2.0": "2.7", |
1309 | # "2.0": "2.7", |
| 1310 | } |
1310 | #} |
| 1311 | |
1311 | |
| 1312 | def get_PYTHON_ABI(python_interpreter): |
1312 | def get_PYTHON_ABI(python_interpreter): |
| 1313 | cpython_matched = cpython_interpreter_re.match(python_interpreter) |
1313 | cpython_matched = cpython_interpreter_re.match(python_interpreter) |
| 1314 | jython_matched = jython_interpreter_re.match(python_interpreter) |
1314 | jython_matched = jython_interpreter_re.match(python_interpreter) |
| 1315 | pypy_matched = pypy_interpreter_re.match(python_interpreter) |
1315 | pypy_matched = pypy_interpreter_re.match(python_interpreter) |
| 1316 | if cpython_matched is not None: |
1316 | if cpython_matched is not None: |
| 1317 | PYTHON_ABI = cpython_matched.group(1) |
1317 | PYTHON_ABI = cpython_matched.group(1) |
| 1318 | elif jython_matched is not None: |
1318 | elif jython_matched is not None: |
| 1319 | PYTHON_ABI = jython_matched.group(1) + "-jython" |
1319 | PYTHON_ABI = jython_matched.group(1) + "-jython" |
| 1320 | elif pypy_matched is not None: |
1320 | elif pypy_matched is not None: |
| 1321 | PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1) |
1321 | #PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1) |
|
|
1322 | PYTHON_ABI = "2.7-pypy-" + pypy_matched.group(1) |
| 1322 | else: |
1323 | else: |
| 1323 | PYTHON_ABI = None |
1324 | PYTHON_ABI = None |
| 1324 | return PYTHON_ABI |
1325 | return PYTHON_ABI |
| 1325 | |
1326 | |
| 1326 | def get_python_interpreter(PYTHON_ABI): |
1327 | def get_python_interpreter(PYTHON_ABI): |