[Reproducible-builds] [dh-python] 93/183: Interpreter: add default_version and binary_dv properties
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Sep 19 15:30:24 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 7c5b4fbfad45cf5af7a06314d4273bff814f1f57
Author: Piotr Ożarowski <piotr at debian.org>
Date: Wed Aug 28 23:40:24 2013 +0200
Interpreter: add default_version and binary_dv properties
---
dhpython/interpreter.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dhpython/interpreter.py b/dhpython/interpreter.py
index d32bfe5..8e75b62 100644
--- a/dhpython/interpreter.py
+++ b/dhpython/interpreter.py
@@ -145,20 +145,34 @@ class Interpreter:
def __str__(self):
return self._vstr(self.version)
- def _vstr(self, version):
+ def _vstr(self, version=None, consider_default_ver=False):
if self.impl == 'pypy':
# 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:
+ version = '3' if self.impl == 'cpython3' else ''
if isinstance(version, Version) and version == Version(major=2):
version = '' # do not promote /usr/bin/python2
if self.debug:
return 'python{}-dbg'.format(version)
return self.name + str(version)
- def binary(self, version):
+ def binary(self, version=None):
return '/usr/bin/{}'.format(self._vstr(version))
+ @property
+ def binary_dv(self):
+ """Like binary(), but returns path to default intepreter symlink
+ if version matches default one for given implementation.
+ """
+ return '/usr/bin/{}'.format(self._vstr(consider_default_ver=True))
+
+ @property
+ def default_version(self):
+ if self.impl:
+ return default(self.impl)
+
@staticmethod
def parse(shebang):
"""Return dict with parsed shebang
--
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