Пример #1
0
    def name_prefix(self):
        """
        The name prefix for converted packages (a string).

        The default value of :attr:`name_prefix` depends on
        the Python interpreter that's used to run py2deb:

        - On Python 2 the default name prefix is ``python``.
        - On Python 3 the default name prefix is ``python3``.
        - On PyPy_ 2 the default name prefix is ``pypy``.
        - On PyPy_ 3 the default name prefix is ``pypy3``.

        When one of these default name prefixes is used, converted packages may
        conflict with system wide packages provided by Debian / Ubuntu. If this
        starts to bite then consider changing the name and installation prefix.

        .. versionadded:: 2.0

           Before his property became part of the documented and public API in
           release 2.0 the setter :func:`set_name_prefix()` was the only
           documented interface. The use of this setter is no longer required
           but still allowed.

           Release 2.0 introduced the alternative default name prefixes
           ``pypy`` and ``python3``. Before that release the default name
           prefix ``python`` was (erroneously) used for all interpreters.

        .. _PyPy: https://en.wikipedia.org/wiki/PyPy
        """
        return default_name_prefix()
Пример #2
0
def fix_name_prefix(name):
    """Change the name prefix of a Debian package to match the current Python version."""
    tokens = name.split('-')
    tokens[0] = default_name_prefix()
    return '-'.join(tokens)