[Reproducible-builds] [dh-python] 106/183: Interpreter: add suggest_pkg_name method
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Sep 19 15:30:26 UTC 2014
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository dh-python.
commit 458d7b0ddfdf14113d32ec3c9e81d2df166a848a
Author: Piotr Ożarowski <piotr at debian.org>
Date: Sun Sep 1 01:49:11 2013 +0200
Interpreter: add suggest_pkg_name method
---
dhpython/interpreter.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dhpython/interpreter.py b/dhpython/interpreter.py
index d3013e4..415c4e5 100644
--- a/dhpython/interpreter.py
+++ b/dhpython/interpreter.py
@@ -150,7 +150,7 @@ class Interpreter:
# TODO: will Debian support more than one PyPy version?
return self.name
version = version or self.version or ''
- if consider_default_ver and version == self.default_version:
+ if consider_default_ver and (not version or version == self.default_version):
version = '3' if self.impl == 'cpython3' else ''
elif isinstance(version, Version) and version == Version(major=2):
version = '' # do not promote /usr/bin/python2
@@ -423,6 +423,20 @@ class Interpreter:
return
return join(fdir, result)
+ def suggest_pkg_name(self, name):
+ """Suggest binary package name with for given library name
+
+ >>> Interpreter('python3.3').suggest_pkg_name('foo')
+ 'python3-foo'
+ >>> Interpreter('python2.7-dbg').suggest_pkg_name('bar')
+ 'python-bar-dbg'
+ """
+ binary = self._vstr(consider_default_ver=True)
+ if '-' in binary:
+ tmp = binary.split('-', 1)
+ return '{}-{}-{}'.format(tmp[0], name, tmp[1])
+ return '{}-{}'.format(binary, name)
+
def _get_config(self, version=None):
version = Version(version or self.version)
# sysconfig module is available since Python 3.2
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dh-python.git
More information about the Reproducible-builds
mailing list