diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-08-22 04:50:54 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-08-22 04:50:54 +0000 |
commit | 486a3a1c707589e003a5e5d3cb6b6fcd578c245f (patch) | |
tree | 324a88c1686e66cbf6ea7576ead8990e2a247780 | |
parent | 8f76f0da296b60d094a15cdc9111722996bdbd38 (diff) | |
download | portage-486a3a1c707589e003a5e5d3cb6b6fcd578c245f.tar.gz portage-486a3a1c707589e003a5e5d3cb6b6fcd578c245f.tar.bz2 portage-486a3a1c707589e003a5e5d3cb6b6fcd578c245f.zip |
Make --info detect more /etc/*-release files as suggested by grobian.
svn path=/main/trunk/; revision=7659
-rw-r--r-- | pym/emerge/__init__.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index f220a09c6..8e0987a32 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -5137,17 +5137,25 @@ def action_info(settings, trees, myopts, myfiles): print header_width * "=" print "System uname: "+unameout - files = ('gentoo-release', 'redhat-release', 'lsb-release') - os_found = False - for f in files: - path = os.path.join(settings["ROOT"], '/etc/', f) - if os.path.exists(path): - lines = open(path).readlines() - map(writemsg, lines) - os_found = True - break - if not os_found: + release_files = set(['gentoo-release', 'centos-release', 'debian_version', + 'fedora-release', 'lsb-release', 'redhat-release', 'SuSE-release', + 'yellowdog-release']) + etc_dir = os.path.join(settings["ROOT"], 'etc') + try: + dir_list = os.listdir(etc_dir) + except OSError: + dir_list = [] + release_files = release_files.intersection(dir_list) + if not release_files: print "Unknown Host Operating System" + else: + my_release_file = None + if 'gentoo-release' in release_files: + my_release_file = 'gentoo-release' + else: + my_release_file = release_files.pop() + lines = portage.util.grablines(os.path.join(etc_dir, my_release_file)) + map(portage.writemsg_stdout, lines) lastSync = portage.grabfile(os.path.join( settings["PORTDIR"], "metadata", "timestamp.chk")) |