Fix install_venv-get_distro failure on Fedora
There was no check_exit_code=False used so install_venv died
on Fedora/RHEL/etc.
Also calling external grep command is not neccessary.
Change-Id: I280aed3019b8cb7fce67033158deb34937946fab
diff --git a/tools/install_venv.py b/tools/install_venv.py
index f4621c9..28275ba 100644
--- a/tools/install_venv.py
+++ b/tools/install_venv.py
@@ -150,16 +150,16 @@
def get_distro():
- if (os.path.exists('/etc/fedora-release') or
- os.path.exists('/etc/redhat-release')):
- if os.path.exists('/etc/redhat-release') \
- and run_command_with_code(['grep', 'CentOS',
- '/etc/redhat-release']) == 0:
- return CentOS()
- else:
- return Fedora()
- else:
- return Distro()
+ if os.path.exists('/etc/redhat-release'):
+ with open('/etc/redhat-release') as rh_release:
+ if 'CentOS' in rh_release.read():
+ return CentOS()
+ return Fedora()
+
+ if os.path.exists('/etc/fedora-release'):
+ return Fedora()
+
+ return Distro()
def check_dependencies():