commit:     904e75fb255efdcaee9ecc04f52a64efb4b842c6
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 11 03:26:19 2015 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 03:31:14 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=904e75fb

dev-python/pbr: allowing install without git

backported upstream patch

gentoo-bug: 557008

Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 dev-python/pbr/files/pbr-1.4.0_no-git.patch | 43 +++++++++++++++++++++++++++++
 dev-python/pbr/pbr-1.4.0.ebuild             |  5 ++--
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/dev-python/pbr/files/pbr-1.4.0_no-git.patch 
b/dev-python/pbr/files/pbr-1.4.0_no-git.patch
new file mode 100644
index 0000000..78a451e
--- /dev/null
+++ b/dev-python/pbr/files/pbr-1.4.0_no-git.patch
@@ -0,0 +1,43 @@
+From 5c0bb9186fe2d65901744b00af24c8c50b3e1d29 Mon Sep 17 00:00:00 2001
+From: Robert Collins <[email protected]>
+Date: Mon, 10 Aug 2015 16:22:26 +1200
+Subject: Handle git being entirely absent
+
+When we try to find the git directory, if git is not present, treat
+that the same as an error from git itself. Sadly tests for this are
+nearly impossible to meaningfully write, since we always have git
+installed. I can do a mock based test if folk want one.
+
+Change-Id: If6160d1fb3def8133bdd0b66105e60ef93f80f82
+Closes-Bug: #1481468
+
+diff --git a/pbr/git.py b/pbr/git.py
+index b4ae300..60acd3c 100644
+--- a/pbr/git.py
++++ b/pbr/git.py
+@@ -18,6 +18,7 @@ from __future__ import unicode_literals
+ 
+ import distutils.errors
+ from distutils import log
++import errno
+ import io
+ import os
+ import re
+@@ -64,7 +65,13 @@ def _run_git_command(cmd, git_dir, **kwargs):
+ 
+ 
+ def _get_git_directory():
+-    return _run_shell_command(['git', 'rev-parse', '--git-dir'])
++    try:
++        return _run_shell_command(['git', 'rev-parse', '--git-dir'])
++    except OSError as e:
++        if e.errno == errno.ENOENT:
++            # git not installed.
++            return ''
++        raise
+ 
+ 
+ def _git_is_installed():
+-- 
+cgit v0.10.2
+

diff --git a/dev-python/pbr/pbr-1.4.0.ebuild b/dev-python/pbr/pbr-1.4.0.ebuild
index 0016a6f..525b148 100644
--- a/dev-python/pbr/pbr-1.4.0.ebuild
+++ b/dev-python/pbr/pbr-1.4.0.ebuild
@@ -14,8 +14,7 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
 
 LICENSE="Apache-2.0"
 SLOT="0"
-#KEYWORDS="~amd64 ~hppa ~amd64-linux ~x86-linux"
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux 
~x86-linux"
 IUSE="test"
 
 DEPEND="
@@ -59,6 +58,8 @@ python_prepare_all() {
        distutils-r1_python_prepare_all
 }
 
+PATCHES=( "${FILESDIR}/${PN}-${PV}_no-git.patch" )
+
 python_test() {
        # Note; Tests, that have been removed, pass once package is emerged.
        esetup.py testr

Reply via email to