summaryrefslogtreecommitdiff
path: root/debian/patches/version-info
blob: cb13493616198359103258eee9bcff87549218ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Stefano Rivera <stefanor@debian.org>
Date: Sat, 7 Oct 2017 09:38:57 +0200
Subject: Get version details from the Debian source package

Rather than VCS.

Return the Debian package version in sys.version.
Return null strings in sys._mercurial.

Forwarded: not-needed
Last-Update: 2013-02-23
---
 pypy/module/sys/version.py |  1 +
 rpython/tool/version.py    | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
index 317a0c1..6fe5862 100644
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -90,6 +90,7 @@ def get_subversion_info(space):
     return space.wrap(('PyPy', '', ''))
 
 def get_repo_info(space):
+    return space.wrap(('PyPy', '', ''))
     info = get_repo_version_info(root=pypyroot)
     if info:
         repo_tag, repo_version = info
diff --git a/rpython/tool/version.py b/rpython/tool/version.py
index a776f7e..245ab9d 100644
--- a/rpython/tool/version.py
+++ b/rpython/tool/version.py
@@ -17,6 +17,16 @@ def maywarn(err, repo_type='Mercurial'):
 def get_repo_version_info(hgexe=None, root=rpythonroot):
     '''Obtain version information by invoking the 'hg' or 'git' commands.'''
 
+    # Debian: built from a source tarball
+    p = Popen(('dpkg-parsechangelog',), stdout=PIPE, cwd=rpythonroot)
+    if p.wait() != 0:
+        maywarn(p.stderr.read(), 'dpkg-parsechangelog')
+        return default_retval
+    for line in p.stdout.read().split('\n'):
+        if line.split(':', 1)[0].strip() == 'Version':
+            version = line.split(':', 1)[1].strip()
+            return '', version
+
     # Try to see if we can get info from Git if hgexe is not specified.
     if not hgexe:
         if os.path.isdir(os.path.join(root, '.git')):