|
3 | 3 | # Authors:
|
4 | 4 | # - Arjan Verwer
|
5 | 5 | # - Peter Odding <peter.odding@paylogic.com>
|
6 |
| -# Last Change: December 16, 2018 |
| 6 | +# Last Change: July 28, 2020 |
7 | 7 | # URL: https://py2deb.readthedocs.io
|
8 | 8 |
|
9 | 9 | """The :mod:`py2deb.utils` module contains miscellaneous code."""
|
|
37 | 37 |
|
38 | 38 | - pypy
|
39 | 39 | - pypy2.7
|
| 40 | +- pypy3 |
40 | 41 | - python
|
41 | 42 | - python2
|
42 | 43 | - python2.7
|
@@ -227,12 +228,10 @@ def default_name_prefix():
|
227 | 228 |
|
228 | 229 | :returns: One of the strings ``python``, ``python3`` or ``pypy``.
|
229 | 230 | """
|
230 |
| - if platform.python_implementation() == 'PyPy': |
231 |
| - return 'pypy' |
232 |
| - elif sys.version_info[0] == 3: |
233 |
| - return 'python3' |
234 |
| - else: |
235 |
| - return 'python' |
| 231 | + implementation = 'pypy' if platform.python_implementation() == 'PyPy' else 'python' |
| 232 | + if sys.version_info[0] == 3: |
| 233 | + implementation += '3' |
| 234 | + return implementation |
236 | 235 |
|
237 | 236 |
|
238 | 237 | def detect_python_script(handle):
|
@@ -403,12 +402,14 @@ def python_version():
|
403 | 402 | - The name of the Debian package providing the current Python version.
|
404 | 403 | - The name of the interpreter executable for the current Python version.
|
405 | 404 |
|
406 |
| - :returns: A string like ``python2.7``, ``python3.7`` or ``pypy``. |
| 405 | + :returns: A string like ``python2.7``, ``python3.8``, ``pypy`` or ``pypy3``. |
407 | 406 | """
|
408 |
| - python_version = ( |
409 |
| - 'pypy' if platform.python_implementation() == 'PyPy' |
410 |
| - else 'python%d.%d' % sys.version_info[:2] |
411 |
| - ) |
| 407 | + if platform.python_implementation() == 'PyPy': |
| 408 | + python_version = 'pypy' |
| 409 | + if sys.version_info[0] == 3: |
| 410 | + python_version += '3' |
| 411 | + else: |
| 412 | + python_version = 'python%d.%d' % sys.version_info[:2] |
412 | 413 | logger.debug("Detected Python version: %s", python_version)
|
413 | 414 | return python_version
|
414 | 415 |
|
|
0 commit comments